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

Side by Side Diff: base/prefs/public/pref_service_base.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « base/prefs/json_pref_store.h ('k') | base/scoped_native_library.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This is the base interface for a preference services that provides 5 // This is the base interface for a preference services that provides
6 // a way to access the application's current preferences. 6 // a way to access the application's current preferences.
7 // 7 //
8 // This base interface assumes all preferences are local. See 8 // This base interface assumes all preferences are local. See
9 // SyncablePrefServiceBase for the interface to a preference service 9 // SyncablePrefServiceBase for the interface to a preference service
10 // that stores preferences that can be synced. 10 // that stores preferences that can be synced.
11 // 11 //
12 // Chromium settings and storage represent user-selected preferences and 12 // Chromium settings and storage represent user-selected preferences and
13 // information and MUST not be extracted, overwritten or modified except 13 // information and MUST not be extracted, overwritten or modified except
14 // through Chromium defined APIs. 14 // through Chromium defined APIs.
15 15
16 #ifndef BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ 16 #ifndef BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_
17 #define BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ 17 #define BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_
18 18
19 #include "base/values.h" 19 #include "base/values.h"
20 20
21 namespace base {
22 class FilePath;
23 }
24
21 namespace content { 25 namespace content {
22 class BrowserContext; 26 class BrowserContext;
23 } 27 }
24 28
25 namespace subtle { 29 namespace subtle {
26 class PrefMemberBase; 30 class PrefMemberBase;
27 } 31 }
28 32
29 class FilePath;
30 class PrefObserver; 33 class PrefObserver;
31 34
32 class PrefServiceBase { 35 class PrefServiceBase {
33 public: 36 public:
34 // Retrieves a PrefServiceBase for the given context. 37 // Retrieves a PrefServiceBase for the given context.
35 static PrefServiceBase* FromBrowserContext(content::BrowserContext* context); 38 static PrefServiceBase* FromBrowserContext(content::BrowserContext* context);
36 39
37 virtual ~PrefServiceBase() {} 40 virtual ~PrefServiceBase() {}
38 41
39 // Interface to a single preference. 42 // Interface to a single preference.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // registered. 114 // registered.
112 virtual const Preference* FindPreference(const char* pref_name) const = 0; 115 virtual const Preference* FindPreference(const char* pref_name) const = 0;
113 116
114 // If the path is valid and the value at the end of the path matches the type 117 // If the path is valid and the value at the end of the path matches the type
115 // specified, it will return the specified value. Otherwise, the default 118 // specified, it will return the specified value. Otherwise, the default
116 // value (set when the pref was registered) will be returned. 119 // value (set when the pref was registered) will be returned.
117 virtual bool GetBoolean(const char* path) const = 0; 120 virtual bool GetBoolean(const char* path) const = 0;
118 virtual int GetInteger(const char* path) const = 0; 121 virtual int GetInteger(const char* path) const = 0;
119 virtual double GetDouble(const char* path) const = 0; 122 virtual double GetDouble(const char* path) const = 0;
120 virtual std::string GetString(const char* path) const = 0; 123 virtual std::string GetString(const char* path) const = 0;
121 virtual FilePath GetFilePath(const char* path) const = 0; 124 virtual base::FilePath GetFilePath(const char* path) const = 0;
122 125
123 // Returns the branch if it exists, or the registered default value otherwise. 126 // Returns the branch if it exists, or the registered default value otherwise.
124 // Note that |path| must point to a registered preference. In that case, these 127 // Note that |path| must point to a registered preference. In that case, these
125 // functions will never return NULL. 128 // functions will never return NULL.
126 virtual const base::DictionaryValue* GetDictionary( 129 virtual const base::DictionaryValue* GetDictionary(
127 const char* path) const = 0; 130 const char* path) const = 0;
128 virtual const base::ListValue* GetList(const char* path) const = 0; 131 virtual const base::ListValue* GetList(const char* path) const = 0;
129 132
130 // Removes a user pref and restores the pref to its default value. 133 // Removes a user pref and restores the pref to its default value.
131 virtual void ClearPref(const char* path) = 0; 134 virtual void ClearPref(const char* path) = 0;
132 135
133 // If the path is valid (i.e., registered), update the pref value in the user 136 // If the path is valid (i.e., registered), update the pref value in the user
134 // prefs. 137 // prefs.
135 // To set the value of dictionary or list values in the pref tree use 138 // To set the value of dictionary or list values in the pref tree use
136 // Set(), but to modify the value of a dictionary or list use either 139 // Set(), but to modify the value of a dictionary or list use either
137 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h. 140 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h.
138 virtual void Set(const char* path, const base::Value& value) = 0; 141 virtual void Set(const char* path, const base::Value& value) = 0;
139 virtual void SetBoolean(const char* path, bool value) = 0; 142 virtual void SetBoolean(const char* path, bool value) = 0;
140 virtual void SetInteger(const char* path, int value) = 0; 143 virtual void SetInteger(const char* path, int value) = 0;
141 virtual void SetDouble(const char* path, double value) = 0; 144 virtual void SetDouble(const char* path, double value) = 0;
142 virtual void SetString(const char* path, const std::string& value) = 0; 145 virtual void SetString(const char* path, const std::string& value) = 0;
143 virtual void SetFilePath(const char* path, const FilePath& value) = 0; 146 virtual void SetFilePath(const char* path, const base::FilePath& value) = 0;
144 147
145 // Int64 helper methods that actually store the given value as a string. 148 // Int64 helper methods that actually store the given value as a string.
146 // Note that if obtaining the named value via GetDictionary or GetList, the 149 // Note that if obtaining the named value via GetDictionary or GetList, the
147 // Value type will be TYPE_STRING. 150 // Value type will be TYPE_STRING.
148 virtual void SetInt64(const char* path, int64 value) = 0; 151 virtual void SetInt64(const char* path, int64 value) = 0;
149 virtual int64 GetInt64(const char* path) const = 0; 152 virtual int64 GetInt64(const char* path) const = 0;
150 153
151 // As above, but for unsigned values. 154 // As above, but for unsigned values.
152 virtual void SetUint64(const char* path, uint64 value) = 0; 155 virtual void SetUint64(const char* path, uint64 value) = 0;
153 virtual uint64 GetUint64(const char* path) const = 0; 156 virtual uint64 GetUint64(const char* path) const = 0;
(...skipping 13 matching lines...) Expand all
167 // 170 //
168 // If the pref at the given path changes, we call the observer's 171 // If the pref at the given path changes, we call the observer's
169 // OnPreferenceChanged method. Note that observers should not call 172 // OnPreferenceChanged method. Note that observers should not call
170 // these methods directly but rather use a PrefChangeRegistrar to 173 // these methods directly but rather use a PrefChangeRegistrar to
171 // make sure the observer gets cleaned up properly. 174 // make sure the observer gets cleaned up properly.
172 virtual void AddPrefObserver(const char* path, PrefObserver* obs) = 0; 175 virtual void AddPrefObserver(const char* path, PrefObserver* obs) = 0;
173 virtual void RemovePrefObserver(const char* path, PrefObserver* obs) = 0; 176 virtual void RemovePrefObserver(const char* path, PrefObserver* obs) = 0;
174 }; 177 };
175 178
176 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ 179 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_
OLDNEW
« no previous file with comments | « base/prefs/json_pref_store.h ('k') | base/scoped_native_library.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698