| 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 <memory> |
| 7 #include <utility> | 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 | 11 |
| 12 AwPrefStore::AwPrefStore() {} | 12 AwPrefStore::AwPrefStore() {} |
| 13 | 13 |
| 14 AwPrefStore::~AwPrefStore() {} | 14 AwPrefStore::~AwPrefStore() {} |
| 15 | 15 |
| 16 bool AwPrefStore::GetValue(const std::string& key, | 16 bool AwPrefStore::GetValue(const std::string& key, |
| 17 const base::Value** value) const { | 17 const base::Value** value) const { |
| 18 return prefs_.GetValue(key, value); | 18 return prefs_.GetValue(key, value); |
| 19 } | 19 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 bool AwPrefStore::HasObservers() const { | 34 bool AwPrefStore::HasObservers() const { |
| 35 return observers_.might_have_observers(); | 35 return observers_.might_have_observers(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool AwPrefStore::IsInitializationComplete() const { | 38 bool AwPrefStore::IsInitializationComplete() const { |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AwPrefStore::SetValue(const std::string& key, | 42 void AwPrefStore::SetValue(const std::string& key, |
| 43 scoped_ptr<base::Value> value, | 43 std::unique_ptr<base::Value> value, |
| 44 uint32_t flags) { | 44 uint32_t flags) { |
| 45 DCHECK(value); | 45 DCHECK(value); |
| 46 if (prefs_.SetValue(key, std::move(value))) | 46 if (prefs_.SetValue(key, std::move(value))) |
| 47 ReportValueChanged(key, flags); | 47 ReportValueChanged(key, flags); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void AwPrefStore::SetValueSilently(const std::string& key, | 50 void AwPrefStore::SetValueSilently(const std::string& key, |
| 51 scoped_ptr<base::Value> value, | 51 std::unique_ptr<base::Value> value, |
| 52 uint32_t flags) { | 52 uint32_t flags) { |
| 53 prefs_.SetValue(key, std::move(value)); | 53 prefs_.SetValue(key, std::move(value)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void AwPrefStore::RemoveValue(const std::string& key, uint32_t flags) { | 56 void AwPrefStore::RemoveValue(const std::string& key, uint32_t flags) { |
| 57 if (prefs_.RemoveValue(key)) | 57 if (prefs_.RemoveValue(key)) |
| 58 ReportValueChanged(key, flags); | 58 ReportValueChanged(key, flags); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool AwPrefStore::ReadOnly() const { | 61 bool AwPrefStore::ReadOnly() const { |
| 62 return false; | 62 return false; |
| 63 } | 63 } |
| 64 | 64 |
| 65 PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const { | 65 PersistentPrefStore::PrefReadError AwPrefStore::GetReadError() const { |
| 66 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 66 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 67 } | 67 } |
| 68 | 68 |
| 69 PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() { | 69 PersistentPrefStore::PrefReadError AwPrefStore::ReadPrefs() { |
| 70 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 70 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { | 73 void AwPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate_raw) { |
| 74 } | 74 } |
| 75 | 75 |
| 76 void AwPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) { | 76 void AwPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) { |
| 77 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); | 77 FOR_EACH_OBSERVER(Observer, observers_, OnPrefValueChanged(key)); |
| 78 } | 78 } |
| OLD | NEW |