| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_PREFS_TESTING_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ |
| 6 #define CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ | 6 #define CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 10 |
| 9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 12 #include "chrome/browser/prefs/pref_value_map.h" | 14 #include "chrome/browser/prefs/pref_value_map.h" |
| 13 #include "chrome/common/persistent_pref_store.h" | 15 #include "chrome/common/persistent_pref_store.h" |
| 14 | 16 |
| 15 // |TestingPrefStore| is a preference store implementation that allows tests to | 17 // |TestingPrefStore| is a preference store implementation that allows tests to |
| 16 // explicitly manipulate the contents of the store, triggering notifications | 18 // explicitly manipulate the contents of the store, triggering notifications |
| 17 // where appropriate. | 19 // where appropriate. |
| 18 class TestingPrefStore : public PersistentPrefStore { | 20 class TestingPrefStore : public PersistentPrefStore { |
| 19 public: | 21 public: |
| 20 TestingPrefStore(); | 22 TestingPrefStore(); |
| 21 virtual ~TestingPrefStore(); | 23 virtual ~TestingPrefStore(); |
| 22 | 24 |
| 23 // Overriden from PrefStore. | 25 // Overriden from PrefStore. |
| 24 virtual ReadResult GetValue(const std::string& key, | 26 virtual ReadResult GetValue(const std::string& key, |
| 25 const base::Value** result) const OVERRIDE; | 27 const base::Value** result) const OVERRIDE; |
| 26 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; | 28 virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; |
| 27 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; | 29 virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; |
| 30 virtual size_t NumberOfObservers() const OVERRIDE; |
| 28 virtual bool IsInitializationComplete() const OVERRIDE; | 31 virtual bool IsInitializationComplete() const OVERRIDE; |
| 29 | 32 |
| 30 // PersistentPrefStore overrides: | 33 // PersistentPrefStore overrides: |
| 31 virtual ReadResult GetMutableValue(const std::string& key, | 34 virtual ReadResult GetMutableValue(const std::string& key, |
| 32 base::Value** result) OVERRIDE; | 35 base::Value** result) OVERRIDE; |
| 33 virtual void ReportValueChanged(const std::string& key) OVERRIDE; | 36 virtual void ReportValueChanged(const std::string& key) OVERRIDE; |
| 34 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; | 37 virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; |
| 35 virtual void SetValueSilently(const std::string& key, | 38 virtual void SetValueSilently(const std::string& key, |
| 36 base::Value* value) OVERRIDE; | 39 base::Value* value) OVERRIDE; |
| 37 virtual void RemoveValue(const std::string& key) OVERRIDE; | 40 virtual void RemoveValue(const std::string& key) OVERRIDE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 75 |
| 73 // Whether initialization has been completed. | 76 // Whether initialization has been completed. |
| 74 bool init_complete_; | 77 bool init_complete_; |
| 75 | 78 |
| 76 ObserverList<PrefStore::Observer, true> observers_; | 79 ObserverList<PrefStore::Observer, true> observers_; |
| 77 | 80 |
| 78 DISALLOW_COPY_AND_ASSIGN(TestingPrefStore); | 81 DISALLOW_COPY_AND_ASSIGN(TestingPrefStore); |
| 79 }; | 82 }; |
| 80 | 83 |
| 81 #endif // CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ | 84 #endif // CHROME_BROWSER_PREFS_TESTING_PREF_STORE_H_ |
| OLD | NEW |