Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Unified Diff: chrome/browser/prefs/dictionary_pref_store.h

Issue 324493002: Move preference MACs to the protected preference stores. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to CR comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698