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

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

Issue 6773006: Add enableReferrers and enableHyperlinkAuditing to contentSettings.misc API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 8 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 | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/browser/prefs/pref_member.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // See PrefMember<> for description. 89 // See PrefMember<> for description.
90 void Destroy(); 90 void Destroy();
91 91
92 void MoveToThread(BrowserThread::ID thread_id); 92 void MoveToThread(BrowserThread::ID thread_id);
93 93
94 // NotificationObserver 94 // NotificationObserver
95 virtual void Observe(NotificationType type, 95 virtual void Observe(NotificationType type,
96 const NotificationSource& source, 96 const NotificationSource& source,
97 const NotificationDetails& details); 97 const NotificationDetails& details);
98 98
99 void VerifyValuePrefName() const; 99 void VerifyValuePrefName() const {
100 DCHECK(!pref_name_.empty());
101 }
100 102
101 // This method is used to do the actual sync with the preference. 103 // This method is used to do the actual sync with the preference.
102 // Note: it is logically const, because it doesn't modify the state 104 // Note: it is logically const, because it doesn't modify the state
103 // seen by the outside world. It is just doing a lazy load behind the scenes. 105 // seen by the outside world. It is just doing a lazy load behind the scenes.
104 virtual void UpdateValueFromPref() const; 106 virtual void UpdateValueFromPref() const;
105 107
106 // Verifies the preference name, and lazily loads the preference value if 108 // Verifies the preference name, and lazily loads the preference value if
107 // it hasn't been loaded yet. 109 // it hasn't been loaded yet.
108 void VerifyPref() const { 110 void VerifyPref() const;
109 VerifyValuePrefName();
110 if (!internal())
111 UpdateValueFromPref();
112 }
113 111
114 const std::string& pref_name() const { return pref_name_; } 112 const std::string& pref_name() const { return pref_name_; }
115 PrefService* prefs() { return prefs_; } 113 PrefService* prefs() { return prefs_; }
116 const PrefService* prefs() const { return prefs_; } 114 const PrefService* prefs() const { return prefs_; }
117 115
118 virtual Internal* internal() const = 0; 116 virtual Internal* internal() const = 0;
119 117
120 // Ordered the members to compact the class instance. 118 // Ordered the members to compact the class instance.
121 private: 119 private:
122 std::string pref_name_; 120 std::string pref_name_;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 DISALLOW_COPY_AND_ASSIGN(PrefMember); 239 DISALLOW_COPY_AND_ASSIGN(PrefMember);
242 }; 240 };
243 241
244 typedef PrefMember<bool> BooleanPrefMember; 242 typedef PrefMember<bool> BooleanPrefMember;
245 typedef PrefMember<int> IntegerPrefMember; 243 typedef PrefMember<int> IntegerPrefMember;
246 typedef PrefMember<double> DoublePrefMember; 244 typedef PrefMember<double> DoublePrefMember;
247 typedef PrefMember<std::string> StringPrefMember; 245 typedef PrefMember<std::string> StringPrefMember;
248 typedef PrefMember<FilePath> FilePathPrefMember; 246 typedef PrefMember<FilePath> FilePathPrefMember;
249 247
250 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ 248 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/browser/prefs/pref_member.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698