1// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "android_webview/browser/aw_pref_store.h" 6 7#include "base/memory/scoped_ptr.h" 8#include "base/values.h" 9 10AwPrefStore::AwPrefStore() {} 11 12AwPrefStore::~AwPrefStore() {} 13 14bool AwPrefStore::GetValue(const std::string& key, 15 const Value** value) const { 16 return prefs_.GetValue(key, value); 17} 18 19bool AwPrefStore::GetMutableValue(const std::string& key, 20 Value** value) { 21 return prefs_.GetValue(key, value); 22} 23 24void AwPrefStore::AddObserver(PrefStore::Observer* observer) { 25 observers_.AddObserver(observer); 26} 27 28void AwPrefStore::RemoveObserver(PrefStore::Observer* observer) { 29 observers_.RemoveObserver(observer); 30} 31 32size_t AwPrefStore::NumberOfObservers() const { 33 return observers_.size(); 34} 35 36bool AwPrefStore::IsInitializationComplete() const { 37 return true; 38} 39 40void AwPrefStore::SetValue(const std::string& key, Value* value) { 41 DCHECK(value); 42 if (prefs_.SetValue(key, value)) 43 ReportValueChanged(key); 44} 45 46void AwPrefStore::SetValueSilently(const std::string& key, Value* value) { 47 prefs_.SetValue(key, value); 48} 49 50void AwPrefStore::RemoveValue(const std::string& key) { 51 if (prefs_.RemoveValue(key)) 52 ReportValueChanged(key); 53} 54 55void AwPrefStore::MarkNeedsEmptyValue(const std::string& key) { 56} 57 58bool AwPrefStore::ReadOnly() const { 59 return false; 60} 61 62PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const { 63 return PersistentPrefStore::PREF_READ_ERROR_NONE; 64} 65 66PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() { 67 return PersistentPrefStore::PREF_READ_ERROR_NONE; 68} 69 70void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { 71} 72 73void AwPrefStore::ReportValueChanged(const std::string& key) { 74 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); 75} 76