OLD | NEW |
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 virtual ~IntegerPrefMember(); | 171 virtual ~IntegerPrefMember(); |
172 | 172 |
173 protected: | 173 protected: |
174 virtual void UpdateValueFromPref() const; | 174 virtual void UpdateValueFromPref() const; |
175 virtual void UpdatePref(const int& value); | 175 virtual void UpdatePref(const int& value); |
176 | 176 |
177 private: | 177 private: |
178 DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember); | 178 DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember); |
179 }; | 179 }; |
180 | 180 |
181 class RealPrefMember : public PrefMember<double> { | 181 class DoublePrefMember : public PrefMember<double> { |
182 public: | 182 public: |
183 RealPrefMember(); | 183 DoublePrefMember(); |
184 virtual ~RealPrefMember(); | 184 virtual ~DoublePrefMember(); |
185 | 185 |
186 protected: | 186 protected: |
187 virtual void UpdateValueFromPref() const; | 187 virtual void UpdateValueFromPref() const; |
188 virtual void UpdatePref(const double& value); | 188 virtual void UpdatePref(const double& value); |
189 | 189 |
190 private: | 190 private: |
191 DISALLOW_COPY_AND_ASSIGN(RealPrefMember); | 191 DISALLOW_COPY_AND_ASSIGN(DoublePrefMember); |
192 }; | 192 }; |
193 | 193 |
194 class StringPrefMember : public PrefMember<std::string> { | 194 class StringPrefMember : public PrefMember<std::string> { |
195 public: | 195 public: |
196 StringPrefMember(); | 196 StringPrefMember(); |
197 virtual ~StringPrefMember(); | 197 virtual ~StringPrefMember(); |
198 | 198 |
199 protected: | 199 protected: |
200 virtual void UpdateValueFromPref() const; | 200 virtual void UpdateValueFromPref() const; |
201 virtual void UpdatePref(const std::string& value); | 201 virtual void UpdatePref(const std::string& value); |
202 | 202 |
203 private: | 203 private: |
204 DISALLOW_COPY_AND_ASSIGN(StringPrefMember); | 204 DISALLOW_COPY_AND_ASSIGN(StringPrefMember); |
205 }; | 205 }; |
206 | 206 |
207 class FilePathPrefMember : public PrefMember<FilePath> { | 207 class FilePathPrefMember : public PrefMember<FilePath> { |
208 public: | 208 public: |
209 FilePathPrefMember(); | 209 FilePathPrefMember(); |
210 virtual ~FilePathPrefMember(); | 210 virtual ~FilePathPrefMember(); |
211 | 211 |
212 protected: | 212 protected: |
213 virtual void UpdateValueFromPref() const; | 213 virtual void UpdateValueFromPref() const; |
214 virtual void UpdatePref(const FilePath& value); | 214 virtual void UpdatePref(const FilePath& value); |
215 | 215 |
216 private: | 216 private: |
217 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); | 217 DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); |
218 }; | 218 }; |
219 | 219 |
220 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ | 220 #endif // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ |
OLD | NEW |