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..8aded634fa1c7d3130f029aead39a8466f0f2b6e 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 |name| is allowed to be forced |
+// via --force-fieldtrials. |
+bool IsForceableFieldTrial(const std::string& 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 (name == KUnforceableFieldTrials[i]) |
Alexei Svitkine (slow)
2014/02/12 14:26:47
KUnforceableFieldTrials -> kUnforceableFieldTrials
gab
2014/02/12 15:59:19
Right, I've already confirmed that it compiles/wor
|
+ 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)); |
CHECK(result) << "Invalid --" << switches::kForceFieldTrials |
<< " list specified."; |
} |