Index: chrome/browser/prefs/dictionary_pref_store.h |
diff --git a/chrome/browser/prefs/dictionary_pref_store.h b/chrome/browser/prefs/dictionary_pref_store.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..df950b7ada85a0e8dc05d2932c24e9887cc86015 |
--- /dev/null |
+++ b/chrome/browser/prefs/dictionary_pref_store.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_PREFS_DICTIONARY_PREF_STORE_H_ |
+#define CHROME_BROWSER_PREFS_DICTIONARY_PREF_STORE_H_ |
+ |
+#include <string> |
+ |
+#include "base/compiler_specific.h" |
+#include "base/macros.h" |
+#include "base/observer_list.h" |
+#include "base/prefs/writeable_pref_store.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+} // namespace base |
+ |
+// An in-memory PrefStore backed by a DictionaryValue. |
+class DictionaryPrefStore : public WriteablePrefStore { |
+ public: |
+ explicit DictionaryPrefStore(base::DictionaryValue* dictionary); |
+ |
+ // PrefStore implementation |
+ virtual bool GetValue(const std::string& key, |
+ const base::Value** result) const OVERRIDE; |
+ virtual void AddObserver(PrefStore::Observer* observer) OVERRIDE; |
+ virtual void RemoveObserver(PrefStore::Observer* observer) OVERRIDE; |
+ virtual bool HasObservers() const OVERRIDE; |
+ |
+ // WriteablePrefStore implementation |
+ virtual void SetValue(const std::string& key, base::Value* value) OVERRIDE; |
+ virtual void RemoveValue(const std::string& key) OVERRIDE; |
+ virtual bool GetMutableValue(const std::string& key, |
+ base::Value** result) OVERRIDE; |
+ virtual void ReportValueChanged(const std::string& key) OVERRIDE; |
+ |
+ private: |
+ virtual ~DictionaryPrefStore(); |
+ |
+ base::DictionaryValue* dictionary_; |
+ ObserverList<PrefStore::Observer, true> observers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DictionaryPrefStore); |
+}; |
+ |
+#endif // CHROME_BROWSER_PREFS_DICTIONARY_PREF_STORE_H_ |