Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4292)

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index af8f4bc474373ec36f79ca75cb94b11032151cec..65cbf261fe71ac6841fde083a4c2ea62daeb87b2 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -69,6 +69,7 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/chrome_pref_service_factory.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
+#include "chrome/browser/prefs/pref_registry_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
@@ -232,27 +233,10 @@ PrefService* InitializeLocalState(
bool local_state_file_exists = file_util::PathExists(local_state_path);
// Load local state. This includes the application locale so we know which
- // locale dll to load.
- PrefServiceSimple* local_state = g_browser_process->local_state();
+ // locale dll to load. This also causes local state prefs to be registered.
+ PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
- // TODO(brettw,*): this comment about ResourceBundle was here since
- // initial commit. This comment seems unrelated, bit-rotten and
- // a candidate for removal.
- // Initialize ResourceBundle which handles files loaded from external
- // sources. This has to be done before uninstall code path and before prefs
- // are registered.
- local_state->RegisterStringPref(prefs::kApplicationLocale, std::string());
-#if defined(OS_CHROMEOS)
- local_state->RegisterStringPref(prefs::kOwnerLocale, std::string());
- local_state->RegisterStringPref(prefs::kHardwareKeyboardLayout,
- std::string());
-#endif // defined(OS_CHROMEOS)
-#if !defined(OS_CHROMEOS)
- local_state->RegisterBooleanPref(prefs::kMetricsReportingEnabled,
- GoogleUpdateSettings::GetCollectStatsConsent());
-#endif // !defined(OS_CHROMEOS)
-
if (is_first_run) {
#if defined(OS_WIN)
// During first run we read the google_update registry key to find what
@@ -277,19 +261,23 @@ PrefService* InitializeLocalState(
// inherit and reset the user's setting.
//
// TODO(mnissler): We should probably just instantiate a
- // JSONPrefStore here instead of an entire PrefService.
+ // JSONPrefStore here instead of an entire PrefService. Once this is
+ // addressed, the call to browser_prefs::RegisterLocalState can move
+ // to chrome_prefs::CreateLocalState.
if (!local_state_file_exists &&
parsed_command_line.HasSwitch(switches::kParentProfile)) {
FilePath parent_profile =
parsed_command_line.GetSwitchValuePath(switches::kParentProfile);
- scoped_ptr<PrefServiceSimple> parent_local_state(
+ scoped_refptr<PrefRegistrySimple> registry = new PrefRegistrySimple();
+ scoped_ptr<PrefService> parent_local_state(
chrome_prefs::CreateLocalState(
parent_profile,
local_state_task_runner,
g_browser_process->policy_service(),
- NULL, false));
- parent_local_state->RegisterStringPref(prefs::kApplicationLocale,
- std::string());
+ NULL,
+ registry,
+ false));
+ registry->RegisterStringPref(prefs::kApplicationLocale, std::string());
// Right now, we only inherit the locale setting from the parent profile.
local_state->SetString(
prefs::kApplicationLocale,

Powered by Google App Engine
This is Rietveld 408576698