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" | |
tfarina
2013/02/27 15:17:50
does scoped_ptr allow you to forward declare this?
| |
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 }; | |
tfarina
2013/02/27 15:17:50
no ; here
| |
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() {} | |
tfarina
2013/02/27 15:17:50
can you avoid inlining?
| |
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); | |
41 | |
42 private: | |
43 UserPrefs() {} | |
tfarina
2013/02/27 15:17:50
can you avoid inlining here?
| |
44 friend struct DefaultSingletonTraits<UserPrefs>; | |
tfarina
2013/02/27 15:17:50
can you put this first? right after private: ?
| |
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_ | |
OLD | NEW |