OLD | NEW |
---|---|
(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 }; | |
Elliot Glaysher
2013/02/28 21:13:18
The dependency on content isn't reflected in the g
tfarina
2013/02/28 21:40:49
it isn't necessary to list content.gyp:content_bro
Jói
2013/02/28 21:46:00
What Thiago said :)
Elliot Glaysher
2013/02/28 21:47:24
I'm aware that we aren't dereferencing the type, h
| |
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 // Retrieve the singleton UserPrefs. | |
30 static UserPrefs* GetInstance(); | |
31 | |
32 // This is shorthand for GetInstance()->Lookup(context). | |
33 static PrefService* Get(content::BrowserContext* context); | |
34 | |
35 ~UserPrefs(); | |
36 | |
37 // Returns true iff |Initialize| has been called. | |
38 bool IsInitialized() const; | |
39 | |
40 // Must be called exactly once, before any other method calls on | |
41 // this object. This object takes ownership of the delegate. | |
42 void Initialize(scoped_ptr<UserPrefsDelegate> delegate); | |
Elliot Glaysher
2013/02/28 21:13:18
I'd be a lot more comfortable with the UserPrefs i
Jói
2013/02/28 21:46:00
I'm not exactly sure what you mean. UserPrefs is
Elliot Glaysher
2013/02/28 21:58:57
What I'm asking is how likely is it that non-chrom
| |
43 | |
44 // Retrieves the PrefService for the user preferences tied to the | |
45 // given BrowserContext. Returns NULL if there is no such | |
46 // PrefService, or if |Initialize| has not been called. | |
47 PrefService* Lookup(content::BrowserContext* context); | |
48 | |
49 private: | |
50 UserPrefs(); | |
51 friend struct DefaultSingletonTraits<UserPrefs>; | |
52 | |
53 scoped_ptr<UserPrefsDelegate> delegate_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(UserPrefs); | |
56 }; | |
57 | |
58 } // namespace components | |
59 | |
60 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_ | |
OLD | NEW |