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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 TestingPrefStore::TestingPrefStore() | 10 TestingPrefStore::TestingPrefStore() |
11 : read_only_(true), | 11 : read_only_(true), |
12 init_complete_(false) { | 12 init_complete_(false) { |
13 } | 13 } |
14 | 14 |
15 PrefStore::ReadResult TestingPrefStore::GetValue(const std::string& key, | 15 bool TestingPrefStore::GetValue(const std::string& key, |
16 const Value** value) const { | 16 const Value** value) const { |
17 return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; | 17 return prefs_.GetValue(key, value); |
18 } | 18 } |
19 | 19 |
20 PrefStore::ReadResult TestingPrefStore::GetMutableValue(const std::string& key, | 20 bool TestingPrefStore::GetMutableValue(const std::string& key, |
21 Value** value) { | 21 Value** value) { |
22 return prefs_.GetValue(key, value) ? READ_OK : READ_NO_VALUE; | 22 return prefs_.GetValue(key, value); |
23 } | 23 } |
24 | 24 |
25 void TestingPrefStore::AddObserver(PrefStore::Observer* observer) { | 25 void TestingPrefStore::AddObserver(PrefStore::Observer* observer) { |
26 observers_.AddObserver(observer); | 26 observers_.AddObserver(observer); |
27 } | 27 } |
28 | 28 |
29 void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 29 void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
30 observers_.RemoveObserver(observer); | 30 observers_.RemoveObserver(observer); |
31 } | 31 } |
32 | 32 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 return false; | 126 return false; |
127 | 127 |
128 return stored_value->GetAsBoolean(value); | 128 return stored_value->GetAsBoolean(value); |
129 } | 129 } |
130 | 130 |
131 void TestingPrefStore::set_read_only(bool read_only) { | 131 void TestingPrefStore::set_read_only(bool read_only) { |
132 read_only_ = read_only; | 132 read_only_ = read_only; |
133 } | 133 } |
134 | 134 |
135 TestingPrefStore::~TestingPrefStore() {} | 135 TestingPrefStore::~TestingPrefStore() {} |
OLD | NEW |