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

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

Issue 1062083003: Implement BrowserStateKeyedServiceFactory::GetAssociatedPrefRegistry() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing include in card_unmask_prompt_controller_impl_unittest.cc Created 5 years, 8 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/DEPS ('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
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/basictypes.h"
9 #include "base/supports_user_data.h" 9 #include "base/supports_user_data.h"
10 #include "components/user_prefs/user_prefs_export.h" 10 #include "components/user_prefs/user_prefs_export.h"
11 11
12 class PrefService; 12 class PrefService;
13 13
14 namespace content {
15 class BrowserContext;
16 }
17
18 namespace user_prefs { 14 namespace user_prefs {
19 15
20 // Components may use preferences associated with a given user. These 16 // Components may use preferences associated with a given user. These hang off
21 // hang off of content::BrowserContext and can be retrieved using 17 // of base::SupportsUserData and can be retrieved using UserPrefs::Get().
22 // UserPrefs::Get().
23 // 18 //
24 // It is up to the embedder to create and own the PrefService and 19 // It is up to the embedder to create and own the PrefService and attach it to
25 // attach it to BrowserContext using the UserPrefs::Set() function. 20 // base::SupportsUserData using the UserPrefs::Set() function.
26 class USER_PREFS_EXPORT UserPrefs : public base::SupportsUserData::Data { 21 class USER_PREFS_EXPORT UserPrefs : public base::SupportsUserData::Data {
27 public: 22 public:
28 // Retrieves the PrefService for a given BrowserContext, or NULL if 23 // Retrieves the PrefService for a given context, or null if none is attached.
29 // none is attached. 24 static PrefService* Get(base::SupportsUserData* context);
30 static PrefService* Get(content::BrowserContext* context);
31 25
32 // Hangs the specified |prefs| off of |context|. Should be called 26 // Hangs the specified |prefs| off of |context|. Should be called
33 // only once per BrowserContext. 27 // only once per context.
34 static void Set(content::BrowserContext* context, PrefService* prefs); 28 static void Set(base::SupportsUserData* context, PrefService* prefs);
35 29
36 private: 30 private:
37 explicit UserPrefs(PrefService* prefs); 31 explicit UserPrefs(PrefService* prefs);
38 ~UserPrefs() override; 32 ~UserPrefs() override;
39 33
40 // Non-owning; owned by embedder. 34 // Non-owning; owned by embedder.
41 PrefService* prefs_; 35 PrefService* prefs_;
42 36
43 DISALLOW_COPY_AND_ASSIGN(UserPrefs); 37 DISALLOW_COPY_AND_ASSIGN(UserPrefs);
44 }; 38 };
45 39
46 } // namespace user_prefs 40 } // namespace user_prefs
47 41
48 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_ 42 #endif // COMPONENTS_USER_PREFS_USER_PREFS_H_
OLDNEW
« no previous file with comments | « components/user_prefs/DEPS ('k') | components/user_prefs/user_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698