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

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

Issue 12315116: Add ability to change default pref values, and use in BrowserInstantController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Add a bit of documentation. Created 7 years, 9 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_registry.cc » ('j') | base/prefs/pref_service.h » ('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 #ifndef BASE_PREFS_PREF_REGISTRY_H_ 5 #ifndef BASE_PREFS_PREF_REGISTRY_H_
6 #define BASE_PREFS_PREF_REGISTRY_H_ 6 #define BASE_PREFS_PREF_REGISTRY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/prefs/base_prefs_export.h" 10 #include "base/prefs/base_prefs_export.h"
(...skipping 22 matching lines...) Expand all
33 33
34 PrefRegistry(); 34 PrefRegistry();
35 35
36 // Gets the registered defaults. 36 // Gets the registered defaults.
37 scoped_refptr<PrefStore> defaults(); 37 scoped_refptr<PrefStore> defaults();
38 38
39 // Allows iteration over defaults. 39 // Allows iteration over defaults.
40 const_iterator begin() const; 40 const_iterator begin() const;
41 const_iterator end() const; 41 const_iterator end() const;
42 42
43 // Changes the default value for a preference. Takes ownership of |value|.
44 //
45 // |pref_name| must be a previously registered preference.
46 void SetDefaultPrefValue(const char* pref_name, base::Value* value);
47
43 // Exactly one callback can be set for registration. The callback 48 // Exactly one callback can be set for registration. The callback
44 // will be invoked each time registration has been performed on this 49 // will be invoked each time registration has been performed on this
45 // object. 50 // object.
46 // 51 //
47 // Calling this method after a callback has already been set will 52 // Calling this method after a callback has already been set will
48 // make the object forget the previous callback and use the new one 53 // make the object forget the previous callback and use the new one
49 // instead. 54 // instead.
50 void SetRegistrationCallback(const RegistrationCallback& callback); 55 void SetRegistrationCallback(const RegistrationCallback& callback);
51 56
52 protected: 57 protected:
53 friend class base::RefCounted<PrefRegistry>; 58 friend class base::RefCounted<PrefRegistry>;
54 virtual ~PrefRegistry(); 59 virtual ~PrefRegistry();
55 60
56 // Used by subclasses to register a default value for a preference. 61 // Used by subclasses to register a default value for a preference.
57 void RegisterPreference(const char* path, base::Value* default_value); 62 void RegisterPreference(const char* path, base::Value* default_value);
58 63
59 scoped_refptr<DefaultPrefStore> defaults_; 64 scoped_refptr<DefaultPrefStore> defaults_;
60 65
61 private: 66 private:
62 RegistrationCallback registration_callback_; 67 RegistrationCallback registration_callback_;
63 68
64 DISALLOW_COPY_AND_ASSIGN(PrefRegistry); 69 DISALLOW_COPY_AND_ASSIGN(PrefRegistry);
65 }; 70 };
66 71
67 #endif // BASE_PREFS_PREF_REGISTRY_H_ 72 #endif // BASE_PREFS_PREF_REGISTRY_H_
OLDNEW
« no previous file with comments | « no previous file | base/prefs/pref_registry.cc » ('j') | base/prefs/pref_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698