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

Unified Diff: chrome/browser/prefs/overlay_persistent_pref_store.cc

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed whitespaces in mac files Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/prefs/overlay_persistent_pref_store.cc
diff --git a/chrome/browser/prefs/overlay_persistent_pref_store.cc b/chrome/browser/prefs/overlay_persistent_pref_store.cc
new file mode 100644
index 0000000000000000000000000000000000000000..16c082af8612ea0440f9ea49e019b3063c30a27d
--- /dev/null
+++ b/chrome/browser/prefs/overlay_persistent_pref_store.cc
@@ -0,0 +1,77 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/prefs/overlay_persistent_pref_store.h"
+
+OverlayPersistentPrefStore::OverlayPersistentPrefStore(
+ PersistentPrefStore* underlay)
+ : underlay_(underlay) {
+ underlay_->AddObserver(this);
+}
+OverlayPersistentPrefStore::~OverlayPersistentPrefStore() {
+ underlay_->RemoveObserver(this);
+}
+
+void OverlayPersistentPrefStore::AddObserver(PrefStore::Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void OverlayPersistentPrefStore::RemoveObserver(PrefStore::Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+bool OverlayPersistentPrefStore::IsInitializationComplete() const {
+ return underlay_->IsInitializationComplete();
+}
+
+PrefStore::ReadResult OverlayPersistentPrefStore::GetValue(
+ const std::string& key, Value** result) const {
+ if (overlay_.GetValue(key, result))
+ return READ_OK;
+ return underlay_->GetValue(key, result);
+}
+
+void OverlayPersistentPrefStore::SetValue(const std::string& key,
+ Value* value) {
+ if (overlay_.SetValue(key, value))
+ FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
+}
+
+void OverlayPersistentPrefStore::SetValueSilently(const std::string& key,
+ Value* value) {
+ overlay_.SetValue(key, value);
+}
+
+void OverlayPersistentPrefStore::RemoveValue(const std::string& key) {
+ if (overlay_.RemoveValue(key))
+ FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
+}
+
+bool OverlayPersistentPrefStore::ReadOnly() const {
+ return false;
+}
+
+PersistentPrefStore::PrefReadError OverlayPersistentPrefStore::ReadPrefs() {
+ // We do not read intentionally.
+ return PersistentPrefStore::PREF_READ_ERROR_NONE;
+}
+
+bool OverlayPersistentPrefStore::WritePrefs() {
+ // We do not write intentionally.
+ return true;
+}
+
+void OverlayPersistentPrefStore::ScheduleWritePrefs() {
+ // We do not write intentionally.
+}
+
+void OverlayPersistentPrefStore::OnPrefValueChanged(const std::string& key) {
+ if (!overlay_.GetValue(key, NULL))
+ FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
+}
+
+void OverlayPersistentPrefStore::OnInitializationCompleted() {
+ FOR_EACH_OBSERVER(PrefStore::Observer, observers_,
+ OnInitializationCompleted());
+}

Powered by Google App Engine
This is Rietveld 408576698