diff options
Diffstat (limited to 'chrome/browser/prefs/value_map_pref_store.cc')
-rw-r--r-- | chrome/browser/prefs/value_map_pref_store.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/prefs/value_map_pref_store.cc b/chrome/browser/prefs/value_map_pref_store.cc new file mode 100644 index 0000000..82574b2 --- /dev/null +++ b/chrome/browser/prefs/value_map_pref_store.cc @@ -0,0 +1,37 @@ +// Copyright (c) 2010 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/value_map_pref_store.h" + +#include <algorithm> + +#include "base/stl_util-inl.h" +#include "base/values.h" + +PrefStore::ReadResult ValueMapPrefStore::GetValue(const std::string& key, + Value** value) const { + return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; +} + +void ValueMapPrefStore::AddObserver(PrefStore::Observer* observer) { + observers_.AddObserver(observer); +} + +void ValueMapPrefStore::RemoveObserver(PrefStore::Observer* observer) { + observers_.RemoveObserver(observer); +} + +void ValueMapPrefStore::SetValue(const std::string& key, Value* value) { + if (prefs_.SetValue(key, value)) + FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); +} + +void ValueMapPrefStore::RemoveValue(const std::string& key) { + if (prefs_.RemoveValue(key)) + FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); +} + +void ValueMapPrefStore::NotifyInitializationCompleted() { + FOR_EACH_OBSERVER(Observer, observers_, OnInitializationCompleted()); +} |