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

Side by Side Diff: android_webview/browser/aw_pref_store.cc

Issue 1881253003: Create a PrefStore in support of Blimp metrics collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix conflict with ptr migration work. Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « android_webview/browser/aw_pref_store.h ('k') | android_webview/native/aw_autofill_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 <memory>
8 #include <utility>
9
10 #include "base/values.h"
11
12 AwPrefStore::AwPrefStore() {}
13
14 AwPrefStore::~AwPrefStore() {}
15
16 bool AwPrefStore::GetValue(const std::string& key,
17 const base::Value** value) const {
18 return prefs_.GetValue(key, value);
19 }
20
21 bool AwPrefStore::GetMutableValue(const std::string& key,
22 base::Value** value) {
23 return prefs_.GetValue(key, value);
24 }
25
26 void AwPrefStore::AddObserver(PrefStore::Observer* observer) {
27 observers_.AddObserver(observer);
28 }
29
30 void AwPrefStore::RemoveObserver(PrefStore::Observer* observer) {
31 observers_.RemoveObserver(observer);
32 }
33
34 bool AwPrefStore::HasObservers() const {
35 return observers_.might_have_observers();
36 }
37
38 bool AwPrefStore::IsInitializationComplete() const {
39 return true;
40 }
41
42 void AwPrefStore::SetValue(const std::string& key,
43 std::unique_ptr<base::Value> value,
44 uint32_t flags) {
45 DCHECK(value);
46 if (prefs_.SetValue(key, std::move(value)))
47 ReportValueChanged(key, flags);
48 }
49
50 void AwPrefStore::SetValueSilently(const std::string& key,
51 std::unique_ptr<base::Value> value,
52 uint32_t flags) {
53 prefs_.SetValue(key, std::move(value));
54 }
55
56 void AwPrefStore::RemoveValue(const std::string& key, uint32_t flags) {
57 if (prefs_.RemoveValue(key))
58 ReportValueChanged(key, flags);
59 }
60
61 bool AwPrefStore::ReadOnly() const {
62 return false;
63 }
64
65 PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const {
66 return PersistentPrefStore::PREF_READ_ERROR_NONE;
67 }
68
69 PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() {
70 return PersistentPrefStore::PREF_READ_ERROR_NONE;
71 }
72
73 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) {
74 }
75
76 void AwPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) {
77 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key));
78 }
OLDNEW
« no previous file with comments | « android_webview/browser/aw_pref_store.h ('k') | android_webview/native/aw_autofill_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698