Chromium Code Reviews| Index: chrome/browser/chrome_browser_main.cc |
| diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc |
| index d8608c9aca69b5f95a749f87c222f169251249ac..dc6939f2bf2a9fdb9461c163a98ec815384e7744 100644 |
| --- a/chrome/browser/chrome_browser_main.cc |
| +++ b/chrome/browser/chrome_browser_main.cc |
| @@ -483,6 +483,24 @@ void LaunchDevToolsHandlerIfNeeded(const CommandLine& command_line) { |
| } |
| } |
| +// Returns true if the field trial described by |trial_name| is allowed to be |
| +// forced via --force-fieldtrials. |
| +bool IsForceableFieldTrial(const std::string& trial_name) { |
| +#if defined(OFFICIAL_BUILD) |
| + // A list of field trials which cannot be forced to a different value in the |
| + // official build. |
| + static const char* const kUnforceableFieldTrials[] = { |
| + "SettingsEnforcement", |
| + }; |
| + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(KUnforceableFieldTrials); ++i) { |
| + if (trial_name == KUnforceableFieldTrials[i]) |
| + return false; |
| + } |
| +#endif // defined(OFFICIAL_BUILD) |
| + |
| + return true; |
| +} |
| + |
| // Heap allocated class that listens for first page load, kicks off stat |
| // recording and then deletes itself. |
| class LoadCompleteListener : public content::NotificationObserver { |
| @@ -518,6 +536,7 @@ void InitializeAllPrefHashStores() { |
| chrome_prefs::InitializePrefHashStoreIfRequired(profile_path); |
| } |
| } |
| + |
| } // namespace |
| namespace chrome_browser { |
| @@ -606,7 +625,8 @@ void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { |
| // consistent manner with field trials created from the server. |
| bool result = base::FieldTrialList::CreateTrialsFromString( |
| command_line->GetSwitchValueASCII(switches::kForceFieldTrials), |
| - base::FieldTrialList::DONT_ACTIVATE_TRIALS); |
| + base::FieldTrialList::DONT_ACTIVATE_TRIALS, |
| + base::Bind(&IsForceableFieldTrial)); |
|
sky
2014/02/12 18:17:30
Is there a reason you need the function and can't
gab
2014/02/12 23:38:37
Nope, used a set instead; much easier, not sure wh
|
| CHECK(result) << "Invalid --" << switches::kForceFieldTrials |
| << " list specified."; |
| } |