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

Side by Side Diff: components/user_prefs/user_prefs.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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/user_prefs/user_prefs.h"
6
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9
10 namespace components {
11
12 UserPrefs::UserPrefs() {
13 }
14
15 UserPrefs::~UserPrefs() {
16 }
17
18 // static
19 UserPrefs* UserPrefs::GetInstance() {
20 return Singleton<UserPrefs>::get();
21 }
22
23 // static
24 PrefService* UserPrefs::Get(content::BrowserContext* context) {
25 return GetInstance()->Lookup(context);
26 }
27
28 bool UserPrefs::IsInitialized() const {
29 return delegate_.get() != NULL;
30 }
31
32 void UserPrefs::Initialize(scoped_ptr<UserPrefsDelegate> delegate) {
33 DCHECK(!delegate_.get());
34 delegate_ = delegate.Pass();
35 }
36
37 PrefService* UserPrefs::Lookup(content::BrowserContext* context) {
38 return delegate_->PrefServiceFromBrowserContext(context);
39 }
40
41 } // namespace components
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698