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

Unified Diff: chrome/browser/extensions/api/content_settings/content_settings_store.cc

Issue 10383303: Gracefully deal with clearing content settings for unregistered extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/content_settings/content_settings_store.cc
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.cc b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
index b15001271b777b7bb78f8599f0ed968678624731..71304fbe5f0a85c975b6510150e3dacef9e4955c 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_store.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
@@ -196,16 +196,19 @@ const OriginIdentifierValueMap* ContentSettingsStore::GetValueMap(
const std::string& ext_id,
ExtensionPrefsScope scope) const {
ExtensionEntryMap::const_iterator i = FindEntry(ext_id);
- if (i != entries_.end()) {
- switch (scope) {
- case kExtensionPrefsScopeRegular:
- return &(i->second->settings);
- case kExtensionPrefsScopeIncognitoPersistent:
- return &(i->second->incognito_persistent_settings);
- case kExtensionPrefsScopeIncognitoSessionOnly:
- return &(i->second->incognito_session_only_settings);
- }
+ if (i == entries_.end())
+ return NULL;
+
+ switch (scope) {
+ case kExtensionPrefsScopeRegular:
+ return &(i->second->settings);
+ case kExtensionPrefsScopeIncognitoPersistent:
+ return &(i->second->incognito_persistent_settings);
+ case kExtensionPrefsScopeIncognitoSessionOnly:
+ return &(i->second->incognito_session_only_settings);
}
+
+ NOTREACHED();
return NULL;
}
@@ -216,6 +219,8 @@ void ContentSettingsStore::ClearContentSettingsForExtension(
{
base::AutoLock lock(lock_);
OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
+ if (!map)
+ return;
notify = !map->empty();
map->clear();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698