1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
// Copyright (c) 2013 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 "android_webview/browser/aw_pref_store.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
AwPrefStore::AwPrefStore() {}
AwPrefStore::~AwPrefStore() {}
bool AwPrefStore::GetValue(const std::string& key,
const base::Value** value) const {
return prefs_.GetValue(key, value);
}
bool AwPrefStore::GetMutableValue(const std::string& key,
base::Value** value) {
return prefs_.GetValue(key, value);
}
void AwPrefStore::AddObserver(PrefStore::Observer* observer) {
observers_.AddObserver(observer);
}
void AwPrefStore::RemoveObserver(PrefStore::Observer* observer) {
observers_.RemoveObserver(observer);
}
bool AwPrefStore::HasObservers() const {
return observers_.might_have_observers();
}
bool AwPrefStore::IsInitializationComplete() const {
return true;
}
void AwPrefStore::SetValue(const std::string& key,
base::Value* value,
uint32 flags) {
DCHECK(value);
if (prefs_.SetValue(key, value))
ReportValueChanged(key, flags);
}
void AwPrefStore::SetValueSilently(const std::string& key,
base::Value* value,
uint32 flags) {
prefs_.SetValue(key, value);
}
void AwPrefStore::RemoveValue(const std::string& key, uint32 flags) {
if (prefs_.RemoveValue(key))
ReportValueChanged(key, flags);
}
bool AwPrefStore::ReadOnly() const {
return false;
}
PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const {
return PersistentPrefStore::PREF_READ_ERROR_NONE;
}
PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() {
return PersistentPrefStore::PREF_READ_ERROR_NONE;
}
void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) {
}
void AwPrefStore::ReportValueChanged(const std::string& key, uint32 flags) {
FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
}
|