| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/overlay_persistent_pref_store.h" | 5 #include "chrome/browser/prefs/overlay_persistent_pref_store.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 | 8 |
| 9 OverlayPersistentPrefStore::OverlayPersistentPrefStore( | 9 OverlayPersistentPrefStore::OverlayPersistentPrefStore( |
| 10 PersistentPrefStore* underlay) | 10 PersistentPrefStore* underlay) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 if (overlay_.RemoveValue(key)) | 73 if (overlay_.RemoveValue(key)) |
| 74 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 74 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool OverlayPersistentPrefStore::ReadOnly() const { | 77 bool OverlayPersistentPrefStore::ReadOnly() const { |
| 78 return false; | 78 return false; |
| 79 } | 79 } |
| 80 | 80 |
| 81 PersistentPrefStore::PrefReadError OverlayPersistentPrefStore::ReadPrefs() { | 81 PersistentPrefStore::PrefReadError OverlayPersistentPrefStore::ReadPrefs() { |
| 82 // We do not read intentionally. | 82 // We do not read intentionally. |
| 83 OnInitializationCompleted(); |
| 83 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 84 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 84 } | 85 } |
| 85 | 86 |
| 87 void OverlayPersistentPrefStore::ReadPrefsAsync() { |
| 88 // We do not read intentionally. |
| 89 OnInitializationCompleted(); |
| 90 } |
| 91 |
| 92 void OverlayPersistentPrefStore::GetErrors(PrefReadError* error, |
| 93 bool* is_fatal) { |
| 94 (*error) = PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 95 (*is_fatal) = false; |
| 96 } |
| 97 |
| 86 bool OverlayPersistentPrefStore::WritePrefs() { | 98 bool OverlayPersistentPrefStore::WritePrefs() { |
| 87 // We do not write intentionally. | 99 // We do not write intentionally. |
| 88 return true; | 100 return true; |
| 89 } | 101 } |
| 90 | 102 |
| 91 void OverlayPersistentPrefStore::ScheduleWritePrefs() { | 103 void OverlayPersistentPrefStore::ScheduleWritePrefs() { |
| 92 // We do not write intentionally. | 104 // We do not write intentionally. |
| 93 } | 105 } |
| 94 | 106 |
| 95 void OverlayPersistentPrefStore::CommitPendingWrite() { | 107 void OverlayPersistentPrefStore::CommitPendingWrite() { |
| 96 // We do not write intentionally. | 108 // We do not write intentionally. |
| 97 } | 109 } |
| 98 | 110 |
| 99 void OverlayPersistentPrefStore::ReportValueChanged(const std::string& key) { | 111 void OverlayPersistentPrefStore::ReportValueChanged(const std::string& key) { |
| 100 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 112 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
| 101 } | 113 } |
| 102 | 114 |
| 103 void OverlayPersistentPrefStore::OnPrefValueChanged(const std::string& key) { | 115 void OverlayPersistentPrefStore::OnPrefValueChanged(const std::string& key) { |
| 104 if (!overlay_.GetValue(key, NULL)) | 116 if (!overlay_.GetValue(key, NULL)) |
| 105 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 117 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
| 106 } | 118 } |
| 107 | 119 |
| 108 void OverlayPersistentPrefStore::OnInitializationCompleted() { | 120 void OverlayPersistentPrefStore::OnInitializationCompleted() { |
| 109 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 121 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
| 110 OnInitializationCompleted()); | 122 OnInitializationCompleted()); |
| 111 } | 123 } |
| OLD | NEW |