| 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 #ifndef CHROME_COMMON_PREF_STORE_BASE_H_ | 5 #ifndef CHROME_COMMON_PREF_STORE_BASE_H_ |
| 6 #define CHROME_COMMON_PREF_STORE_BASE_H_ | 6 #define CHROME_COMMON_PREF_STORE_BASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "chrome/common/pref_store.h" | 10 #include "chrome/common/pref_store.h" |
| 11 | 11 |
| 12 // Implements the observer-related bits of the PrefStore interface. This is | 12 // Implements the observer-related bits of the PrefStore interface. This is |
| 13 // provided as a convenience for PrefStore implementations to derive from. | 13 // provided as a convenience for PrefStore implementations to derive from. |
| 14 class PrefStoreBase : public PrefStore { | 14 class PrefStoreBase : public PrefStore { |
| 15 public: | 15 public: |
| 16 virtual ~PrefStoreBase() {} | 16 PrefStoreBase(); |
| 17 virtual ~PrefStoreBase(); |
| 17 | 18 |
| 18 // Overriden from PrefStore. | 19 // Overriden from PrefStore. |
| 19 virtual void AddObserver(ObserverInterface* observer); | 20 virtual void AddObserver(ObserverInterface* observer); |
| 20 virtual void RemoveObserver(ObserverInterface* observer); | 21 virtual void RemoveObserver(ObserverInterface* observer); |
| 21 | 22 |
| 22 protected: | 23 protected: |
| 23 // Send a notification about a changed preference value. | 24 // Send a notification about a changed preference value. |
| 24 virtual void NotifyPrefValueChanged(const std::string& key); | 25 virtual void NotifyPrefValueChanged(const std::string& key); |
| 25 | 26 |
| 26 // Notify observers about initialization being complete. | 27 // Notify observers about initialization being complete. |
| 27 virtual void NotifyInitializationCompleted(); | 28 virtual void NotifyInitializationCompleted(); |
| 28 | 29 |
| 29 private: | 30 private: |
| 30 ObserverList<ObserverInterface, true> observers_; | 31 ObserverList<ObserverInterface, true> observers_; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 #endif // CHROME_COMMON_PREF_STORE_BASE_H_ | 34 #endif // CHROME_COMMON_PREF_STORE_BASE_H_ |
| OLD | NEW |