OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/browser/aw_pref_store.h" | 5 #include "android_webview/browser/aw_pref_store.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 10 #include "base/values.h" |
9 | 11 |
10 AwPrefStore::AwPrefStore() {} | 12 AwPrefStore::AwPrefStore() {} |
11 | 13 |
12 AwPrefStore::~AwPrefStore() {} | 14 AwPrefStore::~AwPrefStore() {} |
13 | 15 |
14 bool AwPrefStore::GetValue(const std::string& key, | 16 bool AwPrefStore::GetValue(const std::string& key, |
15 const base::Value** value) const { | 17 const base::Value** value) const { |
16 return prefs_.GetValue(key, value); | 18 return prefs_.GetValue(key, value); |
(...skipping 17 matching lines...) Expand all Loading... |
34 } | 36 } |
35 | 37 |
36 bool AwPrefStore::IsInitializationComplete() const { | 38 bool AwPrefStore::IsInitializationComplete() const { |
37 return true; | 39 return true; |
38 } | 40 } |
39 | 41 |
40 void AwPrefStore::SetValue(const std::string& key, | 42 void AwPrefStore::SetValue(const std::string& key, |
41 scoped_ptr<base::Value> value, | 43 scoped_ptr<base::Value> value, |
42 uint32_t flags) { | 44 uint32_t flags) { |
43 DCHECK(value); | 45 DCHECK(value); |
44 if (prefs_.SetValue(key, value.Pass())) | 46 if (prefs_.SetValue(key, std::move(value))) |
45 ReportValueChanged(key, flags); | 47 ReportValueChanged(key, flags); |
46 } | 48 } |
47 | 49 |
48 void AwPrefStore::SetValueSilently(const std::string& key, | 50 void AwPrefStore::SetValueSilently(const std::string& key, |
49 scoped_ptr<base::Value> value, | 51 scoped_ptr<base::Value> value, |
50 uint32_t flags) { | 52 uint32_t flags) { |
51 prefs_.SetValue(key, value.Pass()); | 53 prefs_.SetValue(key, std::move(value)); |
52 } | 54 } |
53 | 55 |
54 void AwPrefStore::RemoveValue(const std::string& key, uint32_t flags) { | 56 void AwPrefStore::RemoveValue(const std::string& key, uint32_t flags) { |
55 if (prefs_.RemoveValue(key)) | 57 if (prefs_.RemoveValue(key)) |
56 ReportValueChanged(key, flags); | 58 ReportValueChanged(key, flags); |
57 } | 59 } |
58 | 60 |
59 bool AwPrefStore::ReadOnly() const { | 61 bool AwPrefStore::ReadOnly() const { |
60 return false; | 62 return false; |
61 } | 63 } |
62 | 64 |
63 PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const { | 65 PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const { |
64 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 66 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
65 } | 67 } |
66 | 68 |
67 PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() { | 69 PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() { |
68 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 70 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
69 } | 71 } |
70 | 72 |
71 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { | 73 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { |
72 } | 74 } |
73 | 75 |
74 void AwPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) { | 76 void AwPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) { |
75 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); | 77 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); |
76 } | 78 } |
OLD | NEW |