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

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

Issue 1258653002: components: Make user_prefs a source_set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « components/user_prefs/BUILD.gn ('k') | components/user_prefs/user_prefs_export.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_USER_PREFS_USER_PREFS_H_ 5 #ifndef COMPONENTS_USER_PREFS_USER_PREFS_H_
6 #define COMPONENTS_USER_PREFS_USER_PREFS_H_ 6 #define COMPONENTS_USER_PREFS_USER_PREFS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/macros.h"
9 #include "base/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "components/user_prefs/user_prefs_export.h"
11 10
12 class PrefService; 11 class PrefService;
13 12
14 namespace user_prefs { 13 namespace user_prefs {
15 14
16 // Components may use preferences associated with a given user. These hang off 15 // Components may use preferences associated with a given user. These hang off
17 // of base::SupportsUserData and can be retrieved using UserPrefs::Get(). 16 // of base::SupportsUserData and can be retrieved using UserPrefs::Get().
18 // 17 //
19 // It is up to the embedder to create and own the PrefService and attach it to 18 // It is up to the embedder to create and own the PrefService and attach it to
20 // base::SupportsUserData using the UserPrefs::Set() function. 19 // base::SupportsUserData using the UserPrefs::Set() function.
21 class USER_PREFS_EXPORT UserPrefs : public base::SupportsUserData::Data { 20 class UserPrefs : public base::SupportsUserData::Data {
22 public: 21 public:
23 // Retrieves the PrefService for a given context, or null if none is attached. 22 // Retrieves the PrefService for a given context, or null if none is attached.
24 static PrefService* Get(base::SupportsUserData* context); 23 static PrefService* Get(base::SupportsUserData* context);
25 24
26 // Hangs the specified |prefs| off of |context|. Should be called 25 // Hangs the specified |prefs| off of |context|. Should be called
27 // only once per context. 26 // only once per context.
28 static void Set(base::SupportsUserData* context, PrefService* prefs); 27 static void Set(base::SupportsUserData* context, PrefService* prefs);
29 28
30 private: 29 private:
31 explicit UserPrefs(PrefService* prefs); 30 explicit UserPrefs(PrefService* prefs);
32 ~UserPrefs() override; 31 ~UserPrefs() override;
33 32
34 // Non-owning; owned by embedder. 33 // Non-owning; owned by embedder.
35 PrefService* prefs_; 34 PrefService* prefs_;
36 35
37 DISALLOW_COPY_AND_ASSIGN(UserPrefs); 36 DISALLOW_COPY_AND_ASSIGN(UserPrefs);
38 }; 37 };
39 38
40 } // namespace user_prefs 39 } // namespace user_prefs
41 40
42 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_ 41 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_
OLDNEW
« no previous file with comments | « components/user_prefs/BUILD.gn ('k') | components/user_prefs/user_prefs_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698