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

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 12340111: Introduce //components/user_prefs, use to eliminate c/b/prefs dependency in Autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index c08f9a11e1535547eb4fda5079b10e9a69d73b70..52e6a7610a31ea827f7a8adf3eff865ae2b7bd34 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -36,6 +36,8 @@
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/user_prefs/user_prefs.h"
+#include "components/user_prefs/user_prefs_delegate.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
@@ -171,6 +173,20 @@ void CheckCryptohomeIsMounted(chromeos::DBusMethodCallStatus call_status,
}
#endif
+class ChromeUserPrefsDelegate : public components::UserPrefsDelegate {
+ public:
+ ChromeUserPrefsDelegate() {}
+ virtual ~ChromeUserPrefsDelegate() {}
+
+ virtual PrefService* PrefServiceFromBrowserContext(
+ content::BrowserContext* context) OVERRIDE {
+ return static_cast<Profile*>(context)->GetPrefs();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ChromeUserPrefsDelegate);
+};
+
} // namespace
#if defined(ENABLE_SESSION_SERVICE)
@@ -267,6 +283,10 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir.empty())
profile_shortcut_manager_.reset(ProfileShortcutManager::Create(
this));
+
+ components::UserPrefs::GetInstance()->Initialize(
+ scoped_ptr<components::UserPrefsDelegate>(
+ new ChromeUserPrefsDelegate).Pass());
}
ProfileManager::~ProfileManager() {

Powered by Google App Engine
This is Rietveld 408576698