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

Side by Side Diff: chrome/browser/extensions/extension_pref_store.cc

Issue 5915004: Introduce incognito preference settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Continued work from last year 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 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/extensions/extension_pref_store.h" 5 #include "chrome/browser/extensions/extension_pref_store.h"
6 6
7 ExtensionPrefStore::ExtensionPrefStore() 7 #include "base/values.h"
8 : initialization_complete_(false) { 8 #include "chrome/browser/extensions/extension_pref_value_map.h"
9
10 ExtensionPrefStore::ExtensionPrefStore(bool incognito_pref_store)
11 : incognito_pref_store_(incognito_pref_store) {
9 } 12 }
10 13
11 void ExtensionPrefStore::SetExtensionPref(const std::string& key, 14 ExtensionPrefStore::~ExtensionPrefStore() {}
12 Value* value) {
13 SetValue(key, value);
14 }
15 15
16 void ExtensionPrefStore::RemoveExtensionPref(const std::string& key) { 16 void ExtensionPrefStore::SetExtensionPrefValueMap(
17 RemoveValue(key); 17 ExtensionPrefValueMap* extension_pref_value_map) {
18 extension_pref_value_map_ = extension_pref_value_map;
18 } 19 }
19 20
20 void ExtensionPrefStore::OnInitializationCompleted() { 21 void ExtensionPrefStore::OnInitializationCompleted() {
21 DCHECK(!initialization_complete_);
22 initialization_complete_ = true;
23 NotifyInitializationCompleted(); 22 NotifyInitializationCompleted();
24 } 23 }
25 24
26 bool ExtensionPrefStore::IsInitializationComplete() const { 25 void ExtensionPrefStore::OnPrefValueChanged(const std::string& key) {
27 return initialization_complete_; 26 CHECK(extension_pref_value_map_);
27 const Value *winner =
28 extension_pref_value_map_->GetEffectivePrefValue(key,
29 incognito_pref_store_);
30 if (winner)
31 SetValue(key, winner->DeepCopy());
32 else
33 RemoveValue(key);
28 } 34 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698