Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/prefs/overlay_persistent_pref_store.cc

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittest for asyn reading Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(true);
83 return PersistentPrefStore::PREF_READ_ERROR_NONE; 84 return PersistentPrefStore::PREF_READ_ERROR_NONE;
84 } 85 }
85 86
87 void OverlayPersistentPrefStore::ReadPrefsAsync(ReadErrorDelegate* delegate) {
88 // We do not read intentionally.
89 OnInitializationCompleted(true);
90 }
91
86 bool OverlayPersistentPrefStore::WritePrefs() { 92 bool OverlayPersistentPrefStore::WritePrefs() {
87 // We do not write intentionally. 93 // We do not write intentionally.
88 return true; 94 return true;
89 } 95 }
90 96
91 void OverlayPersistentPrefStore::ScheduleWritePrefs() { 97 void OverlayPersistentPrefStore::ScheduleWritePrefs() {
92 // We do not write intentionally. 98 // We do not write intentionally.
93 } 99 }
94 100
95 void OverlayPersistentPrefStore::CommitPendingWrite() { 101 void OverlayPersistentPrefStore::CommitPendingWrite() {
96 // We do not write intentionally. 102 // We do not write intentionally.
97 } 103 }
98 104
99 void OverlayPersistentPrefStore::ReportValueChanged(const std::string& key) { 105 void OverlayPersistentPrefStore::ReportValueChanged(const std::string& key) {
100 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); 106 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
101 } 107 }
102 108
103 void OverlayPersistentPrefStore::OnPrefValueChanged(const std::string& key) { 109 void OverlayPersistentPrefStore::OnPrefValueChanged(const std::string& key) {
104 if (!overlay_.GetValue(key, NULL)) 110 if (!overlay_.GetValue(key, NULL))
105 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); 111 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
106 } 112 }
107 113
108 void OverlayPersistentPrefStore::OnInitializationCompleted() { 114 void OverlayPersistentPrefStore::OnInitializationCompleted(bool succeeded) {
109 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, 115 FOR_EACH_OBSERVER(PrefStore::Observer, observers_,
110 OnInitializationCompleted()); 116 OnInitializationCompleted(succeeded));
111 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698