add feature flag for dev updater url

This commit is contained in:
bridiver
2020-03-17 15:42:04 -04:00
committed by Deep
parent b1058c065d
commit 71d5f2c814
8 changed files with 27 additions and 2 deletions
@@ -7,4 +7,5 @@ package org.chromium.chrome.browser;
public abstract class BraveFeatureList {
public static final String BRAVE_REWARDS = "BraveRewards";
public static final String USE_DEV_UPDATER_URL = "UseDevUpdaterUrl";
}
@@ -10,6 +10,8 @@
#include <vector>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "brave/common/brave_features.h"
#include "brave/common/brave_switches.h"
#include "brave/common/network_constants.h"
#include "components/component_updater/component_updater_url_constants.h"
@@ -70,7 +72,8 @@ int OnBeforeURLRequest_CommonStaticRedirectWorkForGURL(
replacements.SetQueryStr(request_url.query_piece());
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kUseGoUpdateDev)) {
if (!command_line.HasSwitch(switches::kUseGoUpdateDev) &&
!base::FeatureList::IsEnabled(features::kUseDevUpdaterUrl)) {
*new_url = GURL(kBraveUpdatesExtensionsProdEndpoint)
.ReplaceComponents(replacements);
} else {
@@ -3,6 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "brave/common/brave_features.h"
#include "brave/components/brave_shields/common/features.h"
#include "brave/components/brave_sync/features.h"
#include "brave/components/ntp_sponsored_images/browser/features.h"
@@ -14,6 +15,10 @@ using ntp_sponsored_images::features::kBraveNTPBrandedWallpaper;
using ntp_sponsored_images::features::kBraveNTPBrandedWallpaperDemo;
#define BRAVE_FEATURE_ENTRIES \
{"use-dev-updater-url", \
flag_descriptions::kUseDevUpdaterUrlName, \
flag_descriptions::kUseDevUpdaterUrlDescription, kOsAll, \
FEATURE_VALUE_TYPE(features::kUseDevUpdaterUrl)}, \
{"brave-ntp-branded-wallpaper", \
flag_descriptions::kBraveNTPBrandedWallpaperName, \
flag_descriptions::kBraveNTPBrandedWallpaperDescription, kOsAll, \
@@ -6,6 +6,11 @@
#include "../../../../chrome/browser/flag_descriptions.cc"
namespace flag_descriptions {
const char kUseDevUpdaterUrlName[] =
"Use dev updater url";
const char kUseDevUpdaterUrlDescription[] =
"Use the dev url for the component updater. "
"This is for internal testing only.";
const char kBraveNTPBrandedWallpaperName[] =
"New Tab Page Branded Wallpapers";
const char kBraveNTPBrandedWallpaperDescription[] =
@@ -9,6 +9,8 @@
#include "../../../../chrome/browser/flag_descriptions.h"
namespace flag_descriptions {
extern const char kUseDevUpdaterUrlName[];
extern const char kUseDevUpdaterUrlDescription[];
extern const char kBraveNTPBrandedWallpaperName[];
extern const char kBraveNTPBrandedWallpaperDescription[];
extern const char kBraveNTPBrandedWallpaperDemoName[];
+4
View File
@@ -19,4 +19,8 @@ const base::Feature kBraveRewards{"BraveRewards",
#endif
#endif // defined(OS_ANDROID)
const base::Feature kUseDevUpdaterUrl{
"UseDevUpdaterUrl",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
+2
View File
@@ -17,6 +17,8 @@ COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kBraveRewards;
#endif // defined(OS_ANDROID)
extern const base::Feature kUseDevUpdaterUrl;
} // namespace features
#endif // BRAVE_COMMON_BRAVE_FEATURES_H_
@@ -15,6 +15,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
@@ -26,6 +27,7 @@
#include "base/task/post_task.h"
#include "base/task_runner_util.h"
#include "base/values.h"
#include "brave/common/brave_features.h"
#include "brave/common/brave_switches.h"
#include "brave/common/network_constants.h"
#include "brave/components/greaselion/browser/greaselion_download_service.h"
@@ -85,7 +87,8 @@ scoped_refptr<Extension> ConvertGreaselionRuleToExtensionOnTaskRunner(
std::string script_name = rule->name();
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (!command_line.HasSwitch(switches::kUseGoUpdateDev)) {
if (!command_line.HasSwitch(switches::kUseGoUpdateDev) &&
!base::FeatureList::IsEnabled(features::kUseDevUpdaterUrl)) {
crypto::SHA256HashString(kBraveUpdatesExtensionsDevEndpoint + script_name,
raw,
crypto::kSHA256Length);