| 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) { | 
|   11 //     my_string_.Init(prefs::kHomePage, prefs, NULL /* no observer */); |   11 //     my_string_.Init(prefs::kHomePage, prefs, NULL /* no observer */); | 
|   12 //   } |   12 //   } | 
|   13 //  private: |   13 //  private: | 
|   14 //   StringPrefMember my_string_; |   14 //   StringPrefMember my_string_; | 
|   15 // }; |   15 // }; | 
|   16 // |   16 // | 
|   17 // my_string_ should stay in sync with the prefs::kHomePage pref and will |   17 // my_string_ should stay in sync with the prefs::kHomePage pref and will | 
|   18 // update if either the pref changes or if my_string_.SetValue is called. |   18 // update if either the pref changes or if my_string_.SetValue is called. | 
|   19 // |   19 // | 
|   20 // An optional observer can be passed into the Init method which can be used to |   20 // An optional observer can be passed into the Init method which can be used to | 
|   21 // notify MyClass of changes. Note that if you use SetValue(), the observer |   21 // notify MyClass of changes. Note that if you use SetValue(), the observer | 
|   22 // will not be notified. |   22 // will not be notified. | 
|   23  |   23  | 
|   24 #ifndef CHROME_BROWSER_PREF_MEMBER_H_ |   24 #ifndef CHROME_BROWSER_PREFS_PREF_MEMBER_H_ | 
|   25 #define CHROME_BROWSER_PREF_MEMBER_H_ |   25 #define CHROME_BROWSER_PREFS_PREF_MEMBER_H_ | 
|   26 #pragma once |   26 #pragma once | 
|   27  |   27  | 
|   28 #include <string> |   28 #include <string> | 
|   29  |   29  | 
|   30 #include "base/basictypes.h" |   30 #include "base/basictypes.h" | 
|   31 #include "base/file_path.h" |   31 #include "base/file_path.h" | 
|   32 #include "chrome/common/notification_observer.h" |   32 #include "chrome/common/notification_observer.h" | 
|   33  |   33  | 
|   34 class PrefService; |   34 class PrefService; | 
|   35  |   35  | 
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  198   virtual ~FilePathPrefMember(); |  198   virtual ~FilePathPrefMember(); | 
|  199  |  199  | 
|  200  protected: |  200  protected: | 
|  201   virtual void UpdateValueFromPref(); |  201   virtual void UpdateValueFromPref(); | 
|  202   virtual void UpdatePref(const FilePath& value); |  202   virtual void UpdatePref(const FilePath& value); | 
|  203  |  203  | 
|  204  private: |  204  private: | 
|  205   DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); |  205   DISALLOW_COPY_AND_ASSIGN(FilePathPrefMember); | 
|  206 }; |  206 }; | 
|  207  |  207  | 
|  208 #endif  // CHROME_BROWSER_PREF_MEMBER_H_ |  208 #endif  // CHROME_BROWSER_PREFS_PREF_MEMBER_H_ | 
| OLD | NEW |