OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/prefs/testing_pref_store.h" | 5 #include "base/prefs/testing_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 TestingPrefStore::TestingPrefStore() | 12 TestingPrefStore::TestingPrefStore() |
11 : read_only_(true), | 13 : read_only_(true), |
12 read_success_(true), | 14 read_success_(true), |
13 read_error_(PersistentPrefStore::PREF_READ_ERROR_NONE), | 15 read_error_(PersistentPrefStore::PREF_READ_ERROR_NONE), |
14 block_async_read_(false), | 16 block_async_read_(false), |
15 pending_async_read_(false), | 17 pending_async_read_(false), |
16 init_complete_(false), | 18 init_complete_(false), |
(...skipping 21 matching lines...) Expand all Loading... |
38 return observers_.might_have_observers(); | 40 return observers_.might_have_observers(); |
39 } | 41 } |
40 | 42 |
41 bool TestingPrefStore::IsInitializationComplete() const { | 43 bool TestingPrefStore::IsInitializationComplete() const { |
42 return init_complete_; | 44 return init_complete_; |
43 } | 45 } |
44 | 46 |
45 void TestingPrefStore::SetValue(const std::string& key, | 47 void TestingPrefStore::SetValue(const std::string& key, |
46 scoped_ptr<base::Value> value, | 48 scoped_ptr<base::Value> value, |
47 uint32 flags) { | 49 uint32 flags) { |
48 if (prefs_.SetValue(key, value.Pass())) { | 50 if (prefs_.SetValue(key, std::move(value))) { |
49 committed_ = false; | 51 committed_ = false; |
50 NotifyPrefValueChanged(key); | 52 NotifyPrefValueChanged(key); |
51 } | 53 } |
52 } | 54 } |
53 | 55 |
54 void TestingPrefStore::SetValueSilently(const std::string& key, | 56 void TestingPrefStore::SetValueSilently(const std::string& key, |
55 scoped_ptr<base::Value> value, | 57 scoped_ptr<base::Value> value, |
56 uint32 flags) { | 58 uint32 flags) { |
57 if (prefs_.SetValue(key, value.Pass())) | 59 if (prefs_.SetValue(key, std::move(value))) |
58 committed_ = false; | 60 committed_ = false; |
59 } | 61 } |
60 | 62 |
61 void TestingPrefStore::RemoveValue(const std::string& key, uint32 flags) { | 63 void TestingPrefStore::RemoveValue(const std::string& key, uint32 flags) { |
62 if (prefs_.RemoveValue(key)) { | 64 if (prefs_.RemoveValue(key)) { |
63 committed_ = false; | 65 committed_ = false; |
64 NotifyPrefValueChanged(key); | 66 NotifyPrefValueChanged(key); |
65 } | 67 } |
66 } | 68 } |
67 | 69 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 read_success_ = read_success; | 172 read_success_ = read_success; |
171 } | 173 } |
172 | 174 |
173 void TestingPrefStore::set_read_error( | 175 void TestingPrefStore::set_read_error( |
174 PersistentPrefStore::PrefReadError read_error) { | 176 PersistentPrefStore::PrefReadError read_error) { |
175 DCHECK(!init_complete_); | 177 DCHECK(!init_complete_); |
176 read_error_ = read_error; | 178 read_error_ = read_error; |
177 } | 179 } |
178 | 180 |
179 TestingPrefStore::~TestingPrefStore() {} | 181 TestingPrefStore::~TestingPrefStore() {} |
OLD | NEW |