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

Side by Side Diff: components/prefs/pref_service.h

Issue 2276043004: Add PrefMember<base::Time> Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add PrefService::{Get,Set}Time(..., base::Time) Created 4 years, 3 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 | « no previous file | components/prefs/pref_service.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 (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 provides a way to access the application's current preferences. 5 // This provides a way to access the application's current preferences.
6 6
7 // Chromium settings and storage represent user-selected preferences and 7 // Chromium settings and storage represent user-selected preferences and
8 // information and MUST not be extracted, overwritten or modified except 8 // information and MUST not be extracted, overwritten or modified except
9 // through Chromium defined APIs. 9 // through Chromium defined APIs.
10 10
11 #ifndef COMPONENTS_PREFS_PREF_SERVICE_H_ 11 #ifndef COMPONENTS_PREFS_PREF_SERVICE_H_
12 #define COMPONENTS_PREFS_PREF_SERVICE_H_ 12 #define COMPONENTS_PREFS_PREF_SERVICE_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <memory> 16 #include <memory>
17 #include <set> 17 #include <set>
18 #include <string> 18 #include <string>
19 19
20 #include "base/callback.h" 20 #include "base/callback.h"
21 #include "base/compiler_specific.h" 21 #include "base/compiler_specific.h"
22 #include "base/containers/hash_tables.h" 22 #include "base/containers/hash_tables.h"
23 #include "base/macros.h" 23 #include "base/macros.h"
24 #include "base/memory/ref_counted.h" 24 #include "base/memory/ref_counted.h"
25 #include "base/observer_list.h" 25 #include "base/observer_list.h"
26 #include "base/threading/non_thread_safe.h" 26 #include "base/threading/non_thread_safe.h"
27 #include "base/time/time.h"
27 #include "base/values.h" 28 #include "base/values.h"
28 #include "components/prefs/base_prefs_export.h" 29 #include "components/prefs/base_prefs_export.h"
29 #include "components/prefs/persistent_pref_store.h" 30 #include "components/prefs/persistent_pref_store.h"
30 31
31 class PrefNotifier; 32 class PrefNotifier;
32 class PrefNotifierImpl; 33 class PrefNotifierImpl;
33 class PrefObserver; 34 class PrefObserver;
34 class PrefRegistry; 35 class PrefRegistry;
35 class PrefValueStore; 36 class PrefValueStore;
36 class PrefStore; 37 class PrefStore;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 const PrefService::Preference* FindPreference(const std::string& path) const; 192 const PrefService::Preference* FindPreference(const std::string& path) const;
192 193
193 // If the path is valid and the value at the end of the path matches the type 194 // If the path is valid and the value at the end of the path matches the type
194 // specified, it will return the specified value. Otherwise, the default 195 // specified, it will return the specified value. Otherwise, the default
195 // value (set when the pref was registered) will be returned. 196 // value (set when the pref was registered) will be returned.
196 bool GetBoolean(const std::string& path) const; 197 bool GetBoolean(const std::string& path) const;
197 int GetInteger(const std::string& path) const; 198 int GetInteger(const std::string& path) const;
198 double GetDouble(const std::string& path) const; 199 double GetDouble(const std::string& path) const;
199 std::string GetString(const std::string& path) const; 200 std::string GetString(const std::string& path) const;
200 base::FilePath GetFilePath(const std::string& path) const; 201 base::FilePath GetFilePath(const std::string& path) const;
202 base::Time GetTime(const std::string& path) const;
201 203
202 // Returns the branch if it exists, or the registered default value otherwise. 204 // Returns the branch if it exists, or the registered default value otherwise.
203 // Note that |path| must point to a registered preference. In that case, these 205 // Note that |path| must point to a registered preference. In that case, these
204 // functions will never return NULL. 206 // functions will never return NULL.
205 const base::DictionaryValue* GetDictionary(const std::string& path) const; 207 const base::DictionaryValue* GetDictionary(const std::string& path) const;
206 const base::ListValue* GetList(const std::string& path) const; 208 const base::ListValue* GetList(const std::string& path) const;
207 209
208 // Removes a user pref and restores the pref to its default value. 210 // Removes a user pref and restores the pref to its default value.
209 void ClearPref(const std::string& path); 211 void ClearPref(const std::string& path);
210 212
211 // If the path is valid (i.e., registered), update the pref value in the user 213 // If the path is valid (i.e., registered), update the pref value in the user
212 // prefs. 214 // prefs.
213 // To set the value of dictionary or list values in the pref tree use 215 // To set the value of dictionary or list values in the pref tree use
214 // Set(), but to modify the value of a dictionary or list use either 216 // Set(), but to modify the value of a dictionary or list use either
215 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h. 217 // ListPrefUpdate or DictionaryPrefUpdate from scoped_user_pref_update.h.
216 void Set(const std::string& path, const base::Value& value); 218 void Set(const std::string& path, const base::Value& value);
217 void SetBoolean(const std::string& path, bool value); 219 void SetBoolean(const std::string& path, bool value);
218 void SetInteger(const std::string& path, int value); 220 void SetInteger(const std::string& path, int value);
219 void SetDouble(const std::string& path, double value); 221 void SetDouble(const std::string& path, double value);
220 void SetString(const std::string& path, const std::string& value); 222 void SetString(const std::string& path, const std::string& value);
221 void SetFilePath(const std::string& path, const base::FilePath& value); 223 void SetFilePath(const std::string& path, const base::FilePath& value);
224 void SetTime(const std::string& path, base::Time time);
222 225
223 // Int64 helper methods that actually store the given value as a string. 226 // Int64 helper methods that actually store the given value as a string.
224 // Note that if obtaining the named value via GetDictionary or GetList, the 227 // Note that if obtaining the named value via GetDictionary or GetList, the
225 // Value type will be TYPE_STRING. 228 // Value type will be TYPE_STRING.
226 void SetInt64(const std::string& path, int64_t value); 229 void SetInt64(const std::string& path, int64_t value);
227 int64_t GetInt64(const std::string& path) const; 230 int64_t GetInt64(const std::string& path) const;
228 231
229 // As above, but for unsigned values. 232 // As above, but for unsigned values.
230 void SetUint64(const std::string& path, uint64_t value); 233 void SetUint64(const std::string& path, uint64_t value);
231 uint64_t GetUint64(const std::string& path) const; 234 uint64_t GetUint64(const std::string& path) const;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 383
381 // Local cache of registered Preference objects. The pref_registry_ 384 // Local cache of registered Preference objects. The pref_registry_
382 // is authoritative with respect to what the types and default values 385 // is authoritative with respect to what the types and default values
383 // of registered preferences are. 386 // of registered preferences are.
384 mutable PreferenceMap prefs_map_; 387 mutable PreferenceMap prefs_map_;
385 388
386 DISALLOW_COPY_AND_ASSIGN(PrefService); 389 DISALLOW_COPY_AND_ASSIGN(PrefService);
387 }; 390 };
388 391
389 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ 392 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | components/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698