| 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/incognito_user_pref_store.h" | 5 #include "chrome/browser/prefs/incognito_user_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 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return PersistentPrefStore::PREF_READ_ERROR_NONE; | 108 return PersistentPrefStore::PREF_READ_ERROR_NONE; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void IncognitoUserPrefStore::ReadPrefsAsync( | 111 void IncognitoUserPrefStore::ReadPrefsAsync( |
| 112 ReadErrorDelegate* error_delegate_raw) { | 112 ReadErrorDelegate* error_delegate_raw) { |
| 113 scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); | 113 scoped_ptr<ReadErrorDelegate> error_delegate(error_delegate_raw); |
| 114 // We do not read intentionally. | 114 // We do not read intentionally. |
| 115 OnInitializationCompleted(true); | 115 OnInitializationCompleted(true); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool IncognitoUserPrefStore::WritePrefs() { | |
| 119 // We do not write our content intentionally. | |
| 120 return true; | |
| 121 } | |
| 122 | |
| 123 void IncognitoUserPrefStore::ScheduleWritePrefs() { | |
| 124 underlay_->ScheduleWritePrefs(); | |
| 125 // We do not write our content intentionally. | |
| 126 } | |
| 127 | |
| 128 void IncognitoUserPrefStore::CommitPendingWrite() { | 118 void IncognitoUserPrefStore::CommitPendingWrite() { |
| 129 underlay_->CommitPendingWrite(); | 119 underlay_->CommitPendingWrite(); |
| 130 // We do not write our content intentionally. | 120 // We do not write our content intentionally. |
| 131 } | 121 } |
| 132 | 122 |
| 133 void IncognitoUserPrefStore::ReportValueChanged(const std::string& key) { | 123 void IncognitoUserPrefStore::ReportValueChanged(const std::string& key) { |
| 134 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); | 124 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key)); |
| 135 } | 125 } |
| 136 | 126 |
| 137 void IncognitoUserPrefStore::OnPrefValueChanged(const std::string& key) { | 127 void IncognitoUserPrefStore::OnPrefValueChanged(const std::string& key) { |
| 138 if (!overlay_.GetValue(key, NULL)) | 128 if (!overlay_.GetValue(key, NULL)) |
| 139 ReportValueChanged(key); | 129 ReportValueChanged(key); |
| 140 } | 130 } |
| 141 | 131 |
| 142 void IncognitoUserPrefStore::OnInitializationCompleted(bool succeeded) { | 132 void IncognitoUserPrefStore::OnInitializationCompleted(bool succeeded) { |
| 143 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, | 133 FOR_EACH_OBSERVER(PrefStore::Observer, observers_, |
| 144 OnInitializationCompleted(succeeded)); | 134 OnInitializationCompleted(succeeded)); |
| 145 } | 135 } |
| 146 | 136 |
| 147 bool IncognitoUserPrefStore::ShallBeStoredInOverlay( | 137 bool IncognitoUserPrefStore::ShallBeStoredInOverlay( |
| 148 const std::string& key) const { | 138 const std::string& key) const { |
| 149 // List of keys that cannot be changed in the user prefs file by the incognito | 139 // List of keys that cannot be changed in the user prefs file by the incognito |
| 150 // profile: | 140 // profile: |
| 151 return key == prefs::kBrowserWindowPlacement; | 141 return key == prefs::kBrowserWindowPlacement; |
| 152 } | 142 } |
| OLD | NEW |