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

Side by Side Diff: chrome/browser/prefs/pref_member.h

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed whitespaces in mac files Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // A helper class that stays in sync with a preference (bool, int, real, 5 // A helper class that stays in sync with a preference (bool, int, real,
6 // string or filepath). For example: 6 // string or filepath). For example:
7 // 7 //
8 // class MyClass { 8 // class MyClass {
9 // public: 9 // public:
10 // MyClass(PrefService* prefs) { 10 // MyClass(PrefService* prefs) {
(...skipping 27 matching lines...) Expand all
38 class PrefMemberBase : public NotificationObserver { 38 class PrefMemberBase : public NotificationObserver {
39 protected: 39 protected:
40 PrefMemberBase(); 40 PrefMemberBase();
41 virtual ~PrefMemberBase(); 41 virtual ~PrefMemberBase();
42 42
43 // See PrefMember<> for description. 43 // See PrefMember<> for description.
44 void Init(const char* pref_name, PrefService* prefs, 44 void Init(const char* pref_name, PrefService* prefs,
45 NotificationObserver* observer); 45 NotificationObserver* observer);
46 46
47 // See PrefMember<> for description. 47 // See PrefMember<> for description.
48 void Destroy();
49
50 // See PrefMember<> for description.
48 bool IsManaged() const; 51 bool IsManaged() const;
49 52
50 // NotificationObserver 53 // NotificationObserver
51 virtual void Observe(NotificationType type, 54 virtual void Observe(NotificationType type,
52 const NotificationSource& source, 55 const NotificationSource& source,
53 const NotificationDetails& details); 56 const NotificationDetails& details);
54 57
55 void VerifyValuePrefName() const; 58 void VerifyValuePrefName() const;
56 59
57 // This methods is used to do the actual sync with pref of the specified type. 60 // This methods is used to do the actual sync with pref of the specified type.
(...skipping 27 matching lines...) Expand all
85 PrefMember() : value_(ValueType()) {} 88 PrefMember() : value_(ValueType()) {}
86 virtual ~PrefMember() {} 89 virtual ~PrefMember() {}
87 90
88 // Do the actual initialization of the class. |observer| may be null if you 91 // Do the actual initialization of the class. |observer| may be null if you
89 // don't want any notifications of changes. 92 // don't want any notifications of changes.
90 void Init(const char* pref_name, PrefService* prefs, 93 void Init(const char* pref_name, PrefService* prefs,
91 NotificationObserver* observer) { 94 NotificationObserver* observer) {
92 subtle::PrefMemberBase::Init(pref_name, prefs, observer); 95 subtle::PrefMemberBase::Init(pref_name, prefs, observer);
93 } 96 }
94 97
98 // Unsubscribes the PrefMember from the PrefService. After calling this
99 // function, the PrefMember may not be used any more.
100 void Destroy() {
101 subtle::PrefMemberBase::Destroy();
102 }
103
95 // Check whether the pref is managed, i.e. controlled externally through 104 // Check whether the pref is managed, i.e. controlled externally through
96 // enterprise configuration management (e.g. windows group policy). Returns 105 // enterprise configuration management (e.g. windows group policy). Returns
97 // false for unknown prefs. 106 // false for unknown prefs.
98 bool IsManaged() { 107 bool IsManaged() {
99 return subtle::PrefMemberBase::IsManaged(); 108 return subtle::PrefMemberBase::IsManaged();
100 } 109 }
101 110
102 // Retrieve the value of the member variable. 111 // Retrieve the value of the member variable.
103 ValueType GetValue() const { 112 ValueType GetValue() const {
104 VerifyValuePrefName(); 113 VerifyValuePrefName();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 211
203 protected: 212 protected:
204 virtual void UpdateValueFromPref() const; 213 virtual void UpdateValueFromPref() const;
205 virtual void UpdatePref(const FilePath& value); 214 virtual void UpdatePref(const FilePath& value);
206 215
207 private: 216 private:
208 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); 217 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember);
209 }; 218 };
210 219
211 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ 220 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698