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

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

Issue 511393003: No longer register app window placement preference keys on the fly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/prefs/pref_service.cc » ('j') | chrome/browser/devtools/devtools_window.cc » ('J')
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
(...skipping 12 matching lines...) Expand all
23 #include "base/prefs/base_prefs_export.h" 23 #include "base/prefs/base_prefs_export.h"
24 #include "base/prefs/persistent_pref_store.h" 24 #include "base/prefs/persistent_pref_store.h"
25 #include "base/threading/non_thread_safe.h" 25 #include "base/threading/non_thread_safe.h"
26 #include "base/values.h" 26 #include "base/values.h"
27 27
28 class PrefNotifier; 28 class PrefNotifier;
29 class PrefNotifierImpl; 29 class PrefNotifierImpl;
30 class PrefObserver; 30 class PrefObserver;
31 class PrefRegistry; 31 class PrefRegistry;
32 class PrefValueStore; 32 class PrefValueStore;
33 class PrefService;
33 class PrefStore; 34 class PrefStore;
34 35
35 namespace base { 36 namespace base {
36 class FilePath; 37 class FilePath;
37 } 38 }
38 39
40 namespace chrome {
41 void MigrateBrowserUIUserPrefs(PrefService* prefs);
42 }
43
39 namespace subtle { 44 namespace subtle {
40 class PrefMemberBase; 45 class PrefMemberBase;
41 class ScopedUserPrefUpdateBase; 46 class ScopedUserPrefUpdateBase;
42 } 47 }
43 48
44 // Base class for PrefServices. You can use the base class to read and 49 // Base class for PrefServices. You can use the base class to read and
45 // interact with preferences, but not to register new preferences; for 50 // interact with preferences, but not to register new preferences; for
46 // that see e.g. PrefRegistrySimple. 51 // that see e.g. PrefRegistrySimple.
47 // 52 //
48 // Settings and storage accessed through this class represent 53 // Settings and storage accessed through this class represent
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 305
301 // Registration of pref change observers must be done using the 306 // Registration of pref change observers must be done using the
302 // PrefChangeRegistrar, which is declared as a friend here to grant it 307 // PrefChangeRegistrar, which is declared as a friend here to grant it
303 // access to the otherwise protected members Add/RemovePrefObserver. 308 // access to the otherwise protected members Add/RemovePrefObserver.
304 // PrefMember registers for preferences changes notification directly to 309 // PrefMember registers for preferences changes notification directly to
305 // avoid the storage overhead of the registrar, so its base class must be 310 // avoid the storage overhead of the registrar, so its base class must be
306 // declared as a friend, too. 311 // declared as a friend, too.
307 friend class PrefChangeRegistrar; 312 friend class PrefChangeRegistrar;
308 friend class subtle::PrefMemberBase; 313 friend class subtle::PrefMemberBase;
309 314
315 // For access to GetBrowserDictionary below.
316 friend void chrome::MigrateBrowserUIUserPrefs(PrefService* prefs);
317
310 // These are protected so they can only be accessed by the friend 318 // These are protected so they can only be accessed by the friend
311 // classes listed above. 319 // classes listed above.
312 // 320 //
313 // If the pref at the given path changes, we call the observer's 321 // If the pref at the given path changes, we call the observer's
314 // OnPreferenceChanged method. Note that observers should not call 322 // OnPreferenceChanged method. Note that observers should not call
315 // these methods directly but rather use a PrefChangeRegistrar to 323 // these methods directly but rather use a PrefChangeRegistrar to
316 // make sure the observer gets cleaned up properly. 324 // make sure the observer gets cleaned up properly.
317 // 325 //
318 // Virtual for testing. 326 // Virtual for testing.
319 virtual void AddPrefObserver(const char* path, PrefObserver* obs); 327 virtual void AddPrefObserver(const char* path, PrefObserver* obs);
(...skipping 21 matching lines...) Expand all
341 base::Value* GetMutableUserPref(const char* path, 349 base::Value* GetMutableUserPref(const char* path,
342 base::Value::Type type); 350 base::Value::Type type);
343 351
344 // GetPreferenceValue is the equivalent of FindPreference(path)->GetValue(), 352 // GetPreferenceValue is the equivalent of FindPreference(path)->GetValue(),
345 // it has been added for performance. If is faster because it does 353 // it has been added for performance. If is faster because it does
346 // not need to find or create a Preference object to get the 354 // not need to find or create a Preference object to get the
347 // value (GetValue() calls back though the preference service to 355 // value (GetValue() calls back though the preference service to
348 // actually get the value.). 356 // actually get the value.).
349 const base::Value* GetPreferenceValue(const std::string& path) const; 357 const base::Value* GetPreferenceValue(const std::string& path) const;
350 358
359 // This is only to be used to migrate unregistered prefs to become registered.
360 // TODO(dgrogan): Can be removed when m39 goes to stable. See
361 // http://crbug.com/167256.
362 scoped_ptr<base::DictionaryValue> GetBrowserDictionary() const;
363
351 // Local cache of registered Preference objects. The pref_registry_ 364 // Local cache of registered Preference objects. The pref_registry_
352 // is authoritative with respect to what the types and default values 365 // is authoritative with respect to what the types and default values
353 // of registered preferences are. 366 // of registered preferences are.
354 mutable PreferenceMap prefs_map_; 367 mutable PreferenceMap prefs_map_;
355 368
356 DISALLOW_COPY_AND_ASSIGN(PrefService); 369 DISALLOW_COPY_AND_ASSIGN(PrefService);
357 }; 370 };
358 371
359 #endif // BASE_PREFS_PREF_SERVICE_H_ 372 #endif // BASE_PREFS_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | base/prefs/pref_service.cc » ('j') | chrome/browser/devtools/devtools_window.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698