| OLD | NEW |
| 1 // Copyright (c) 2011 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 "chrome/browser/prefs/testing_pref_store.h" | 5 #include "chrome/browser/prefs/testing_pref_store.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 | 8 |
| 9 TestingPrefStore::TestingPrefStore() | 9 TestingPrefStore::TestingPrefStore() |
| 10 : read_only_(true), | 10 : read_only_(true), |
| 11 prefs_written_(false), | 11 prefs_written_(false), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TestingPrefStore::AddObserver(PrefStore::Observer* observer) { | 26 void TestingPrefStore::AddObserver(PrefStore::Observer* observer) { |
| 27 observers_.AddObserver(observer); | 27 observers_.AddObserver(observer); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { | 30 void TestingPrefStore::RemoveObserver(PrefStore::Observer* observer) { |
| 31 observers_.RemoveObserver(observer); | 31 observers_.RemoveObserver(observer); |
| 32 } | 32 } |
| 33 | 33 |
| 34 size_t TestingPrefStore::NumberOfObservers() const { |
| 35 return observers_.size(); |
| 36 } |
| 37 |
| 34 bool TestingPrefStore::IsInitializationComplete() const { | 38 bool TestingPrefStore::IsInitializationComplete() const { |
| 35 return init_complete_; | 39 return init_complete_; |
| 36 } | 40 } |
| 37 | 41 |
| 38 void TestingPrefStore::SetValue(const std::string& key, Value* value) { | 42 void TestingPrefStore::SetValue(const std::string& key, Value* value) { |
| 39 if (prefs_.SetValue(key, value)) | 43 if (prefs_.SetValue(key, value)) |
| 40 NotifyPrefValueChanged(key); | 44 NotifyPrefValueChanged(key); |
| 41 } | 45 } |
| 42 | 46 |
| 43 void TestingPrefStore::SetValueSilently(const std::string& key, Value* value) { | 47 void TestingPrefStore::SetValueSilently(const std::string& key, Value* value) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const Value* stored_value; | 120 const Value* stored_value; |
| 117 if (!prefs_.GetValue(key, &stored_value) || !stored_value) | 121 if (!prefs_.GetValue(key, &stored_value) || !stored_value) |
| 118 return false; | 122 return false; |
| 119 | 123 |
| 120 return stored_value->GetAsBoolean(value); | 124 return stored_value->GetAsBoolean(value); |
| 121 } | 125 } |
| 122 | 126 |
| 123 void TestingPrefStore::set_read_only(bool read_only) { | 127 void TestingPrefStore::set_read_only(bool read_only) { |
| 124 read_only_ = read_only; | 128 read_only_ = read_only; |
| 125 } | 129 } |
| OLD | NEW |