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.
5 #include "android_webview/browser/aw_pref_store.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/values.h"
10 AwPrefStore::AwPrefStore() {}
12 AwPrefStore::~AwPrefStore() {}
14 bool AwPrefStore::GetValue(const std::string
& key
,
15 const base::Value
** value
) const {
16 return prefs_
.GetValue(key
, value
);
19 bool AwPrefStore::GetMutableValue(const std::string
& key
,
20 base::Value
** value
) {
21 return prefs_
.GetValue(key
, value
);
24 void AwPrefStore::AddObserver(PrefStore::Observer
* observer
) {
25 observers_
.AddObserver(observer
);
28 void AwPrefStore::RemoveObserver(PrefStore::Observer
* observer
) {
29 observers_
.RemoveObserver(observer
);
32 bool AwPrefStore::HasObservers() const {
33 return observers_
.might_have_observers();
36 bool AwPrefStore::IsInitializationComplete() const {
40 void AwPrefStore::SetValue(const std::string
& key
,
41 scoped_ptr
<base::Value
> value
,
44 if (prefs_
.SetValue(key
, value
.Pass()))
45 ReportValueChanged(key
, flags
);
48 void AwPrefStore::SetValueSilently(const std::string
& key
,
49 scoped_ptr
<base::Value
> value
,
51 prefs_
.SetValue(key
, value
.Pass());
54 void AwPrefStore::RemoveValue(const std::string
& key
, uint32 flags
) {
55 if (prefs_
.RemoveValue(key
))
56 ReportValueChanged(key
, flags
);
59 bool AwPrefStore::ReadOnly() const {
63 PersistentPrefStore::PrefReadError
AwPrefStore::GetReadError() const {
64 return PersistentPrefStore::PREF_READ_ERROR_NONE
;
67 PersistentPrefStore::PrefReadError
AwPrefStore::ReadPrefs() {
68 return PersistentPrefStore::PREF_READ_ERROR_NONE
;
71 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate
* error_delegate_raw
) {
74 void AwPrefStore::ReportValueChanged(const std::string
& key
, uint32 flags
) {
75 FOR_EACH_OBSERVER(Observer
, observers_
, OnPrefValueChanged(key
));