| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_pref_value_map.h" | 5 #include "extensions/browser/extension_pref_value_map.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_value_map.h" | 7 #include "base/prefs/pref_value_map.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (prefs->RemoveValue(key)) | 64 if (prefs->RemoveValue(key)) |
| 65 NotifyPrefValueChanged(key); | 65 NotifyPrefValueChanged(key); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool ExtensionPrefValueMap::CanExtensionControlPref( | 68 bool ExtensionPrefValueMap::CanExtensionControlPref( |
| 69 const std::string& extension_id, | 69 const std::string& extension_id, |
| 70 const std::string& pref_key, | 70 const std::string& pref_key, |
| 71 bool incognito) const { | 71 bool incognito) const { |
| 72 ExtensionEntryMap::const_iterator ext = entries_.find(extension_id); | 72 ExtensionEntryMap::const_iterator ext = entries_.find(extension_id); |
| 73 if (ext == entries_.end()) { | 73 if (ext == entries_.end()) { |
| 74 NOTREACHED(); | 74 NOTREACHED() << "Extension " << extension_id |
| 75 << " is not registered but accesses pref " << pref_key |
| 76 << " (incognito: " << incognito << ")." |
| 77 << " http://crbug.com/454513"; |
| 75 return false; | 78 return false; |
| 76 } | 79 } |
| 77 | 80 |
| 78 if (incognito && !ext->second->incognito_enabled) | 81 if (incognito && !ext->second->incognito_enabled) |
| 79 return false; | 82 return false; |
| 80 | 83 |
| 81 ExtensionEntryMap::const_iterator winner = | 84 ExtensionEntryMap::const_iterator winner = |
| 82 GetEffectivePrefValueController(pref_key, incognito, NULL); | 85 GetEffectivePrefValueController(pref_key, incognito, NULL); |
| 83 if (winner == entries_.end()) | 86 if (winner == entries_.end()) |
| 84 return true; | 87 return true; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 | 396 |
| 394 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { | 397 void ExtensionPrefValueMap::NotifyPrefValueChanged(const std::string& key) { |
| 395 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, | 398 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, |
| 396 OnPrefValueChanged(key)); | 399 OnPrefValueChanged(key)); |
| 397 } | 400 } |
| 398 | 401 |
| 399 void ExtensionPrefValueMap::NotifyOfDestruction() { | 402 void ExtensionPrefValueMap::NotifyOfDestruction() { |
| 400 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, | 403 FOR_EACH_OBSERVER(ExtensionPrefValueMap::Observer, observers_, |
| 401 OnExtensionPrefValueMapDestruction()); | 404 OnExtensionPrefValueMapDestruction()); |
| 402 } | 405 } |
| OLD | NEW |