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

Side by Side Diff: components/user_prefs/user_prefs.h

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: Add README and update c/b/autofill/DEPS. 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
« no previous file with comments | « components/user_prefs/pref_registry_syncable.cc ('k') | components/user_prefs/user_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_USER_PREFS_USER_PREFS_H_
6 #define COMPONENTS_USER_PREFS_USER_PREFS_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/user_prefs/user_prefs_delegate.h"
11 #include "components/user_prefs/user_prefs_export.h"
12
13 template <typename T> struct DefaultSingletonTraits;
14 class PrefService;
15
16 namespace content {
17 class BrowserContext;
18 };
19
20 namespace components {
21
22 // Components may use preferences associated with a given user. These
23 // are retrieved based on content::BrowserContext.
24 //
25 // This singleton is initialized by embedders, to provide other
26 // components with a means of doing this lookup.
27 class USER_PREFS_EXPORT UserPrefs {
28 public:
29 static UserPrefs* GetInstance();
30
31 ~UserPrefs() {}
32
33 // Must be called exactly once, before any other method calls on
34 // this object. This object takes ownership of the delegate.
35 void Initialize(scoped_ptr<UserPrefsDelegate> delegate);
36
37 // Retrieves the PrefService for the user preferences tied to the
38 // given BrowserContext. Returns NULL if there is no such
39 // PrefService, or if |Initialize| has not been called.
40 PrefService* Lookup(content::BrowserContext* context);
Mattias Nissler (ping if slow) 2013/02/27 16:16:43 I wonder whether you want to make a static helper
41
42 private:
43 UserPrefs() {}
44 friend struct DefaultSingletonTraits<UserPrefs>;
45
46 scoped_ptr<UserPrefsDelegate> delegate_;
47
48 DISALLOW_COPY_AND_ASSIGN(UserPrefs);
49 };
50
51 } // namespace components
52
53 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_
OLDNEW
« no previous file with comments | « components/user_prefs/pref_registry_syncable.cc ('k') | components/user_prefs/user_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698