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

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

Issue 3012001: Move implementation from header to source. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: blank line Created 10 years, 5 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // We cache the value of the pref so we don't have to keep walking the pref 127 // We cache the value of the pref so we don't have to keep walking the pref
128 // tree. 128 // tree.
129 ValueType value_; 129 ValueType value_;
130 }; 130 };
131 131
132 /////////////////////////////////////////////////////////////////////////////// 132 ///////////////////////////////////////////////////////////////////////////////
133 // Implementations of Boolean, Integer, Real, and String PrefMember below. 133 // Implementations of Boolean, Integer, Real, and String PrefMember below.
134 134
135 class BooleanPrefMember : public PrefMember<bool> { 135 class BooleanPrefMember : public PrefMember<bool> {
136 public: 136 public:
137 BooleanPrefMember() : PrefMember<bool>() { } 137 BooleanPrefMember();
138 virtual ~BooleanPrefMember() { } 138 virtual ~BooleanPrefMember();
139 139
140 protected: 140 protected:
141 virtual void UpdateValueFromPref(); 141 virtual void UpdateValueFromPref();
142 virtual void UpdatePref(const bool& value); 142 virtual void UpdatePref(const bool& value);
143 143
144 private: 144 private:
145 DISALLOW_COPY_AND_ASSIGN(BooleanPrefMember); 145 DISALLOW_COPY_AND_ASSIGN(BooleanPrefMember);
146 }; 146 };
147 147
148 class IntegerPrefMember : public PrefMember<int> { 148 class IntegerPrefMember : public PrefMember<int> {
149 public: 149 public:
150 IntegerPrefMember() : PrefMember<int>() { } 150 IntegerPrefMember();
151 virtual ~IntegerPrefMember() { } 151 virtual ~IntegerPrefMember();
152 152
153 protected: 153 protected:
154 virtual void UpdateValueFromPref(); 154 virtual void UpdateValueFromPref();
155 virtual void UpdatePref(const int& value); 155 virtual void UpdatePref(const int& value);
156 156
157 private: 157 private:
158 DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember); 158 DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember);
159 }; 159 };
160 160
161 class RealPrefMember : public PrefMember<double> { 161 class RealPrefMember : public PrefMember<double> {
162 public: 162 public:
163 RealPrefMember() : PrefMember<double>() { } 163 RealPrefMember();
164 virtual ~RealPrefMember() { } 164 virtual ~RealPrefMember();
165 165
166 protected: 166 protected:
167 virtual void UpdateValueFromPref(); 167 virtual void UpdateValueFromPref();
168 virtual void UpdatePref(const double& value); 168 virtual void UpdatePref(const double& value);
169 169
170 private: 170 private:
171 DISALLOW_COPY_AND_ASSIGN(RealPrefMember); 171 DISALLOW_COPY_AND_ASSIGN(RealPrefMember);
172 }; 172 };
173 173
174 class StringPrefMember : public PrefMember<std::string> { 174 class StringPrefMember : public PrefMember<std::string> {
175 public: 175 public:
176 StringPrefMember() : PrefMember<std::string>() { } 176 StringPrefMember();
177 virtual ~StringPrefMember() { } 177 virtual ~StringPrefMember();
178 178
179 protected: 179 protected:
180 virtual void UpdateValueFromPref(); 180 virtual void UpdateValueFromPref();
181 virtual void UpdatePref(const std::string& value); 181 virtual void UpdatePref(const std::string& value);
182 182
183 private: 183 private:
184 DISALLOW_COPY_AND_ASSIGN(StringPrefMember); 184 DISALLOW_COPY_AND_ASSIGN(StringPrefMember);
185 }; 185 };
186 186
187 class FilePathPrefMember : public PrefMember<FilePath> { 187 class FilePathPrefMember : public PrefMember<FilePath> {
188 public: 188 public:
189 FilePathPrefMember() : PrefMember<FilePath>() { } 189 FilePathPrefMember();
190 virtual ~FilePathPrefMember() { } 190 virtual ~FilePathPrefMember();
191 191
192 protected: 192 protected:
193 virtual void UpdateValueFromPref(); 193 virtual void UpdateValueFromPref();
194 virtual void UpdatePref(const FilePath& value); 194 virtual void UpdatePref(const FilePath& value);
195 195
196 private: 196 private:
197 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); 197 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember);
198 }; 198 };
199 199
200 #endif // CHROME_BROWSER_PREF_MEMBER_H_ 200 #endif // CHROME_BROWSER_PREF_MEMBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698