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

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

Issue 10559052: Split mode incognito extension can get misleading pref changed events from regular mode (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_value_map.h" 5 #include "chrome/browser/extensions/extension_pref_value_map.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/prefs/pref_value_map.h" 9 #include "chrome/browser/prefs/pref_value_map.h"
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const std::string& extension_id, 103 const std::string& extension_id,
104 const std::string& pref_key, 104 const std::string& pref_key,
105 bool incognito) const { 105 bool incognito) const {
106 ExtensionEntryMap::const_iterator winner = 106 ExtensionEntryMap::const_iterator winner =
107 GetEffectivePrefValueController(pref_key, incognito, NULL); 107 GetEffectivePrefValueController(pref_key, incognito, NULL);
108 if (winner == entries_.end()) 108 if (winner == entries_.end())
109 return false; 109 return false;
110 return winner->first == extension_id; 110 return winner->first == extension_id;
111 } 111 }
112 112
113 bool ExtensionPrefValueMap::DoesExtensionControlIncognitoPref(
Bernhard Bauer 2012/06/19 01:12:56 This method is very similar to the previous one. I
mitchellwrosen 2012/06/20 18:28:26 Done.
114 const std::string& extension_id,
115 const std::string& pref_key) const {
116 bool from_incognito = false;
117 ExtensionEntryMap::const_iterator winner =
118 GetEffectivePrefValueController(pref_key, true, &from_incognito);
119 if (winner == entries_.end())
120 return false;
121 return from_incognito && winner->first == extension_id;
122 }
123
113 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id, 124 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id,
114 const base::Time& install_time, 125 const base::Time& install_time,
115 bool is_enabled) { 126 bool is_enabled) {
116 if (entries_.find(ext_id) != entries_.end()) 127 if (entries_.find(ext_id) != entries_.end())
117 UnregisterExtension(ext_id); 128 UnregisterExtension(ext_id);
118 entries_[ext_id] = new ExtensionEntry; 129 entries_[ext_id] = new ExtensionEntry;
119 entries_[ext_id]->install_time = install_time; 130 entries_[ext_id]->install_time = install_time;
120 entries_[ext_id]->enabled = is_enabled; 131 entries_[ext_id]->enabled = is_enabled;
121 } 132 }
122 133
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 362
352 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { 363 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) {
353 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 364 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
354 OnPrefValueChanged(key)); 365 OnPrefValueChanged(key));
355 } 366 }
356 367
357 void ExtensionPrefValueMap::NotifyOfDestruction() { 368 void ExtensionPrefValueMap::NotifyOfDestruction() {
358 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 369 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
359 OnExtensionPrefValueMapDestruction()); 370 OnExtensionPrefValueMapDestruction());
360 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698