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

Unified Diff: chrome/browser/browser_process_impl.cc

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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/browser_process_impl.cc
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 1129bd0fe65b12bd65f3013c1720f6a3bc600710..c1af6d9ec71b837e61752251f4c951670f02f4a3 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -50,6 +50,8 @@
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/chrome_pref_service_factory.h"
+#include "chrome/browser/prefs/pref_registrar_simple.h"
+#include "chrome/browser/prefs/pref_registrar_simple.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prerender/prerender_tracker.h"
#include "chrome/browser/printing/background_printing_manager.h"
@@ -398,10 +400,7 @@ ProfileManager* BrowserProcessImpl::profile_manager() {
return profile_manager_.get();
}
-// TODO(joi): Switch to returning just PrefService, since those
-// calling this function shouldn't be doing ad-hoc registration, that
-// happens earlier in browser_prefs::RegisterLocalState.
-PrefServiceSimple* BrowserProcessImpl::local_state() {
+PrefService* BrowserProcessImpl::local_state() {
DCHECK(CalledOnValidThread());
if (!created_local_state_)
CreateLocalState();
@@ -598,6 +597,45 @@ void BrowserProcessImpl::PlatformSpecificCommandLineProcessing(
}
#endif
+// static
+void BrowserProcessImpl::RegisterPrefs(PrefRegistrarSimple* registrar) {
+ registrar->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled,
+ false);
+ // This policy needs to be defined before the net subsystem is initialized,
+ // so we do it here.
+ registrar->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy,
+ net::kDefaultMaxSocketsPerProxyServer);
+
+ // This is observed by ChildProcessSecurityPolicy, which lives in content/
+ // though, so it can't register itself.
+ registrar->RegisterListPref(prefs::kDisabledSchemes);
+
+ registrar->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false);
+
+#if defined(OS_WIN)
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8)
+ registrar->RegisterBooleanPref(prefs::kRestartSwitchMode, false);
+#endif
+
+ // 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.
+ registrar->RegisterStringPref(prefs::kApplicationLocale, std::string());
+#if defined(OS_CHROMEOS)
+ registrar->RegisterStringPref(prefs::kOwnerLocale, std::string());
+ registrar->RegisterStringPref(prefs::kHardwareKeyboardLayout,
+ std::string());
+#endif // defined(OS_CHROMEOS)
+#if !defined(OS_CHROMEOS)
+ registrar->RegisterBooleanPref(
+ prefs::kMetricsReportingEnabled,
+ GoogleUpdateSettings::GetCollectStatsConsent());
+#endif // !defined(OS_CHROMEOS)
+}
+
DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
DCHECK(CalledOnValidThread());
if (!download_request_limiter_)
@@ -747,17 +785,11 @@ void BrowserProcessImpl::CreateLocalState() {
pref_change_registrar_.Init(local_state_.get());
// Initialize the notification for the default browser setting policy.
- local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled,
- false);
pref_change_registrar_.Add(
prefs::kDefaultBrowserSettingEnabled,
base::Bind(&BrowserProcessImpl::ApplyDefaultBrowserPolicy,
base::Unretained(this)));
- // This policy needs to be defined before the net subsystem is initialized,
- // so we do it here.
- local_state_->RegisterIntegerPref(prefs::kMaxConnectionsPerProxy,
- net::kDefaultMaxSocketsPerProxyServer);
int max_per_proxy = local_state_->GetInteger(prefs::kMaxConnectionsPerProxy);
net::ClientSocketPoolManager::set_max_sockets_per_proxy_server(
net::HttpNetworkSession::NORMAL_SOCKET_POOL,
@@ -765,21 +797,11 @@ void BrowserProcessImpl::CreateLocalState() {
net::ClientSocketPoolManager::max_sockets_per_group(
net::HttpNetworkSession::NORMAL_SOCKET_POOL)));
- // This is observed by ChildProcessSecurityPolicy, which lives in content/
- // though, so it can't register itself.
- local_state_->RegisterListPref(prefs::kDisabledSchemes);
pref_change_registrar_.Add(
prefs::kDisabledSchemes,
base::Bind(&BrowserProcessImpl::ApplyDisabledSchemesPolicy,
base::Unretained(this)));
ApplyDisabledSchemesPolicy();
-
- local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false);
-
-#if defined(OS_WIN)
- if (base::win::GetVersion() >= base::win::VERSION_WIN8)
- local_state_->RegisterBooleanPref(prefs::kRestartSwitchMode, false);
-#endif
}
void BrowserProcessImpl::PreCreateThreads() {

Powered by Google App Engine
This is Rietveld 408576698