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

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: Fixed some callbacks, other nits Created 8 years, 5 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 KeySet::iterator k; 97 KeySet::iterator k;
98 for (k = deleted_keys.begin(); k != deleted_keys.end(); ++k) 98 for (k = deleted_keys.begin(); k != deleted_keys.end(); ++k)
99 NotifyPrefValueChanged(*k); 99 NotifyPrefValueChanged(*k);
100 } 100 }
101 101
102 bool ExtensionPrefValueMap::DoesExtensionControlPref( 102 bool ExtensionPrefValueMap::DoesExtensionControlPref(
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* from_incognito) const {
106 bool incognito = (from_incognito != NULL);
106 ExtensionEntryMap::const_iterator winner = 107 ExtensionEntryMap::const_iterator winner =
107 GetEffectivePrefValueController(pref_key, incognito, NULL); 108 GetEffectivePrefValueController(pref_key, incognito, from_incognito);
108 if (winner == entries_.end()) 109 if (winner == entries_.end())
109 return false; 110 return false;
110 return winner->first == extension_id; 111 return winner->first == extension_id;
111 } 112 }
112 113
113 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id, 114 void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id,
114 const base::Time& install_time, 115 const base::Time& install_time,
115 bool is_enabled) { 116 bool is_enabled) {
116 if (entries_.find(ext_id) != entries_.end()) 117 if (entries_.find(ext_id) != entries_.end())
117 UnregisterExtension(ext_id); 118 UnregisterExtension(ext_id);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 352
352 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { 353 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) {
353 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 354 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
354 OnPrefValueChanged(key)); 355 OnPrefValueChanged(key));
355 } 356 }
356 357
357 void ExtensionPrefValueMap::NotifyOfDestruction() { 358 void ExtensionPrefValueMap::NotifyOfDestruction() {
358 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, 359 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_,
359 OnExtensionPrefValueMapDestruction()); 360 OnExtensionPrefValueMapDestruction());
360 } 361 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_pref_value_map.h ('k') | chrome/browser/extensions/extension_pref_value_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698