diff options
author | bbudge@google.com <bbudge@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-24 22:28:39 +0000 |
---|---|---|
committer | bbudge@google.com <bbudge@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-24 22:28:39 +0000 |
commit | 42cbc84334ad96afbdc02695ada603df8a13bb0c (patch) | |
tree | 94b50658bcc2f9e1aaf66c34ab54d3ef169292e5 | |
parent | c8d20957e55523e173b7edcbdbabddf043eca5fd (diff) | |
download | chromium_src-42cbc84334ad96afbdc02695ada603df8a13bb0c.zip chromium_src-42cbc84334ad96afbdc02695ada603df8a13bb0c.tar.gz chromium_src-42cbc84334ad96afbdc02695ada603df8a13bb0c.tar.bz2 |
This patch moves the experiments settings from the user profile to the browser's local state, since these settings correspond to command line switches. It restores 6267009 http://codereview.chromium.org/6267009/ which got reverted because it broke ChromeOS tests. The patch also removes some migration code for ChromeOS experiments. Users' settings should be migrated by now.
This is a release blocker for NaCl, so we are pushing this through.
TEST=manual
BUG= http://code.google.com/p/nativeclient/issues/detail?id=1322
Review URL: http://codereview.chromium.org/6389002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72404 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/about_flags.cc | 25 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 6 | ||||
-rw-r--r-- | chrome/browser/dom_ui/flags_ui.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/flags_ui.h | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/browser_prefs.cc | 2 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 4 |
6 files changed, 10 insertions, 36 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 6266d83..3f769e7 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -314,25 +314,6 @@ class FlagsState { DISALLOW_COPY_AND_ASSIGN(FlagsState); }; -#if defined(OS_CHROMEOS) -// Migrates Chrome OS Labs settings to experiments adding flags to enabled -// experiment list if the corresponding pref is on. -void MigrateChromeOSLabsPrefs(PrefService* prefs, - std::set<std::string>* result) { - DCHECK(prefs); - DCHECK(result); - if (prefs->GetBoolean(prefs::kLabsMediaplayerEnabled)) - result->insert(kMediaPlayerExperimentName); - if (prefs->GetBoolean(prefs::kLabsAdvancedFilesystemEnabled)) - result->insert(kAdvancedFileSystemExperimentName); - if (prefs->GetBoolean(prefs::kUseVerticalTabs)) - result->insert(kVerticalTabsExperimentName); - prefs->SetBoolean(prefs::kLabsMediaplayerEnabled, false); - prefs->SetBoolean(prefs::kLabsAdvancedFilesystemEnabled, false); - prefs->SetBoolean(prefs::kUseVerticalTabs, false); -} -#endif - // Extracts the list of enabled lab experiments from preferences and stores them // in a set. void GetEnabledFlags(const PrefService* prefs, std::set<std::string>* result) { @@ -557,12 +538,6 @@ void FlagsState::ConvertFlagsToSwitches( std::set<std::string> enabled_experiments; -#if defined(OS_CHROMEOS) - // Some experiments were implemented via prefs on Chrome OS and we want to - // seamlessly migrate these prefs to about:flags for updated users. - MigrateChromeOSLabsPrefs(prefs, &enabled_experiments); -#endif - GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments); typedef std::map<std::string, std::string> NameToSwitchMap; diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 45db759..c3a62a3 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -1245,6 +1245,10 @@ int BrowserMain(const MainFunctionParams& parameters) { // Initialize the prefs of the local state. browser::RegisterLocalState(local_state); + // Convert active labs into switches. Modifies the current command line. + about_flags::ConvertFlagsToSwitches(local_state, + CommandLine::ForCurrentProcess()); + // Now that all preferences have been registered, set the install date // for the uninstall metrics if this is our first run. This only actually // gets used if the user has metrics reporting enabled at uninstall time. @@ -1580,7 +1584,7 @@ int BrowserMain(const MainFunctionParams& parameters) { HandleTestParameters(parsed_command_line); RecordBreakpadStatusUMA(metrics); - about_flags::RecordUMAStatistics(user_prefs); + about_flags::RecordUMAStatistics(local_state); // Stat the directory with the inspector's files so that we can know if we // should display the entry in the context menu or not. diff --git a/chrome/browser/dom_ui/flags_ui.cc b/chrome/browser/dom_ui/flags_ui.cc index c301463..3689074 100644 --- a/chrome/browser/dom_ui/flags_ui.cc +++ b/chrome/browser/dom_ui/flags_ui.cc @@ -14,7 +14,6 @@ #include "chrome/browser/browser_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" #include "chrome/browser/prefs/pref_service.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -136,7 +135,7 @@ void FlagsDOMHandler::HandleRequestFlagsExperiments(const ListValue* args) { DictionaryValue results; results.Set("flagsExperiments", about_flags::GetFlagsExperimentsData( - dom_ui_->GetProfile()->GetPrefs())); + g_browser_process->local_state())); results.SetBoolean("needsRestart", about_flags::IsRestartNeededToCommitChanges()); dom_ui_->CallJavascriptFunction(L"returnFlagsExperiments", results); @@ -155,7 +154,7 @@ void FlagsDOMHandler::HandleEnableFlagsExperimentMessage( return; about_flags::SetExperimentEnabled( - dom_ui_->GetProfile()->GetPrefs(), + g_browser_process->local_state(), experiment_internal_name, enable_str == "true"); } @@ -195,6 +194,6 @@ RefCountedMemory* FlagsUI::GetFaviconResourceBytes() { } // static -void FlagsUI::RegisterUserPrefs(PrefService* prefs) { +void FlagsUI::RegisterPrefs(PrefService* prefs) { prefs->RegisterListPref(prefs::kEnabledLabsExperiments); } diff --git a/chrome/browser/dom_ui/flags_ui.h b/chrome/browser/dom_ui/flags_ui.h index 831ffe4..7f14604 100644 --- a/chrome/browser/dom_ui/flags_ui.h +++ b/chrome/browser/dom_ui/flags_ui.h @@ -16,7 +16,7 @@ class FlagsUI : public DOMUI { explicit FlagsUI(TabContents* contents); static RefCountedMemory* GetFaviconResourceBytes(); - static void RegisterUserPrefs(PrefService* prefs); + static void RegisterPrefs(PrefService* prefs); private: DISALLOW_COPY_AND_ASSIGN(FlagsUI); diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 4bbd995..8253246 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc @@ -86,6 +86,7 @@ void RegisterAllPrefs(PrefService* user_prefs, PrefService* local_state) { void RegisterLocalState(PrefService* local_state) { // Prefs in Local State Browser::RegisterPrefs(local_state); + FlagsUI::RegisterPrefs(local_state); WebCacheManager::RegisterPrefs(local_state); ExternalProtocolHandler::RegisterPrefs(local_state); GoogleURLTracker::RegisterPrefs(local_state); @@ -128,7 +129,6 @@ void RegisterUserPrefs(PrefService* user_prefs) { TemplateURLPrepopulateData::RegisterUserPrefs(user_prefs); ExtensionDOMUI::RegisterUserPrefs(user_prefs); ExtensionsUI::RegisterUserPrefs(user_prefs); - FlagsUI::RegisterUserPrefs(user_prefs); NewTabUI::RegisterUserPrefs(user_prefs); PluginsUI::RegisterUserPrefs(user_prefs); ProfileImpl::RegisterUserPrefs(user_prefs); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 05e0436..01cd530 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -13,7 +13,6 @@ #include "base/scoped_ptr.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "chrome/browser/about_flags.h" #include "chrome/browser/appcache/chrome_appcache_service.h" #include "chrome/browser/autocomplete/autocomplete_classifier.h" #include "chrome/browser/autofill/personal_data_manager.h" @@ -278,9 +277,6 @@ ProfileImpl::ProfileImpl(const FilePath& path) pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); - // Convert active labs into switches. Modifies the current command line. - about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); - // It would be nice to use PathService for fetching this directory, but // the cache directory depends on the profile directory, which isn't available // to PathService. |