Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PREFS_OVERLAY_PERSISTENT_PREF_STORE_H_ | |
| 6 #define CHROME_BROWSER_PREFS_OVERLAY_PERSISTENT_PREF_STORE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/observer_list.h" | |
| 13 #include "base/ref_counted.h" | |
| 14 #include "chrome/browser/prefs/pref_value_map.h" | |
| 15 #include "chrome/common/persistent_pref_store.h" | |
| 16 | |
| 17 class OverlayPersistentPrefStore : public PersistentPrefStore, | |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
Could use a class comment describing the behavior
battre
2010/12/21 18:51:59
Done.
| |
| 18 public PrefStore::Observer { | |
| 19 public: | |
| 20 // Creates an overlay pref store. Assumes ownership of |overlay| but keeps | |
| 21 // underlay as a weak pointer. | |
|
Mattias Nissler (ping if slow)
2010/12/20 14:50:02
A scoped_refptr is not weak.
battre
2010/12/21 18:51:59
Done.
| |
| 22 explicit OverlayPersistentPrefStore( | |
| 23 scoped_refptr<PersistentPrefStore> underlay); | |
| 24 virtual ~OverlayPersistentPrefStore(); | |
| 25 | |
| 26 // Methods of PrefStore. | |
| 27 virtual void AddObserver(PrefStore::Observer* observer); | |
| 28 virtual void RemoveObserver(PrefStore::Observer* observer); | |
| 29 virtual bool IsInitializationComplete() const; | |
| 30 virtual ReadResult GetValue(const std::string& key, Value** result) const; | |
| 31 | |
| 32 // Methods of PersistentPrefStore. | |
| 33 virtual void SetValue(const std::string& key, Value* value); | |
| 34 virtual void SetValueSilently(const std::string& key, Value* value); | |
| 35 virtual void RemoveValue(const std::string& key); | |
| 36 virtual bool ReadOnly() const; | |
| 37 virtual PrefReadError ReadPrefs(); | |
| 38 virtual bool WritePrefs(); | |
| 39 virtual void ScheduleWritePrefs(); | |
| 40 | |
| 41 private: | |
| 42 // Methods of PrefStore::Observer. | |
| 43 virtual void OnPrefValueChanged(const std::string& key); | |
| 44 virtual void OnInitializationCompleted(); | |
| 45 | |
| 46 ObserverList<PrefStore::Observer, true> observers_; | |
| 47 PrefValueMap overlay_; | |
| 48 scoped_refptr<PersistentPrefStore> underlay_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(OverlayPersistentPrefStore); | |
| 51 }; | |
| 52 | |
| 53 #endif // CHROME_BROWSER_PREFS_OVERLAY_PERSISTENT_PREF_STORE_H_ | |
| OLD | NEW |