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

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

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.cc
diff --git a/chrome/browser/prefs/dictionary_pref_store.cc b/chrome/browser/prefs/dictionary_pref_store.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8f51ab52d1c0b65407adf97f3e87c543e1ef7809
--- /dev/null
+++ b/chrome/browser/prefs/dictionary_pref_store.cc
@@ -0,0 +1,50 @@
+// 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.
+
+#include "chrome/browser/prefs/dictionary_pref_store.h"
+
+#include "base/values.h"
+
+DictionaryPrefStore::DictionaryPrefStore(base::DictionaryValue* dictionary)
+ : dictionary_(dictionary) {
+}
+
+bool DictionaryPrefStore::GetValue(const std::string& key,
+ const base::Value** result) const {
+ return dictionary_->Get(key, result);
+}
+
+void DictionaryPrefStore::AddObserver(PrefStore::Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void DictionaryPrefStore::RemoveObserver(PrefStore::Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+bool DictionaryPrefStore::HasObservers() const {
+ return observers_.might_have_observers();
+}
+
+void DictionaryPrefStore::SetValue(const std::string& key, base::Value* value) {
+ dictionary_->Set(key, value);
+ ReportValueChanged(key);
+}
+
+void DictionaryPrefStore::RemoveValue(const std::string& key) {
+ dictionary_->Remove(key, NULL);
+ ReportValueChanged(key);
+}
+
+bool DictionaryPrefStore::GetMutableValue(const std::string& key,
+ base::Value** result) {
+ return dictionary_->Get(key, result);
+}
+
+void DictionaryPrefStore::ReportValueChanged(const std::string& key) {
+ FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
+}
+
+DictionaryPrefStore::~DictionaryPrefStore() {
+}

Powered by Google App Engine
This is Rietveld 408576698