| OLD | NEW |
| 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/api/content_settings/content_settings_store.
h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 bool notify = false; | 228 bool notify = false; |
| 229 { | 229 { |
| 230 base::AutoLock lock(lock_); | 230 base::AutoLock lock(lock_); |
| 231 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); | 231 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); |
| 232 // TODO(bauerb): This is for debugging http://crbug.com/128652. | 232 // TODO(bauerb): This is for debugging http://crbug.com/128652. |
| 233 // Remove once the bug is fixed. | 233 // Remove once the bug is fixed. |
| 234 if (!map) { | 234 if (!map) { |
| 235 char ext_id_buffer[33]; | 235 char ext_id_buffer[33]; |
| 236 base::strlcpy(ext_id_buffer, ext_id.c_str(), sizeof(ext_id_buffer)); | 236 base::strlcpy(ext_id_buffer, ext_id.c_str(), sizeof(ext_id_buffer)); |
| 237 base::debug::Alias(ext_id_buffer); | 237 base::debug::Alias(ext_id_buffer); |
| 238 // Do a clean crash. | 238 // Gracefully return instead of crashing below. |
| 239 CHECK(false); | 239 return; |
| 240 } | 240 } |
| 241 notify = !map->empty(); | 241 notify = !map->empty(); |
| 242 map->clear(); | 242 map->clear(); |
| 243 } | 243 } |
| 244 if (notify) { | 244 if (notify) { |
| 245 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular); | 245 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 base::ListValue* ContentSettingsStore::GetSettingsForExtension( | 249 base::ListValue* ContentSettingsStore::GetSettingsForExtension( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 ContentSettingsStore::FindEntry(const std::string& ext_id) const { | 371 ContentSettingsStore::FindEntry(const std::string& ext_id) const { |
| 372 ExtensionEntryMap::const_iterator i; | 372 ExtensionEntryMap::const_iterator i; |
| 373 for (i = entries_.begin(); i != entries_.end(); ++i) { | 373 for (i = entries_.begin(); i != entries_.end(); ++i) { |
| 374 if (i->second->id == ext_id) | 374 if (i->second->id == ext_id) |
| 375 return i; | 375 return i; |
| 376 } | 376 } |
| 377 return entries_.end(); | 377 return entries_.end(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace extensions | 380 } // namespace extensions |
| OLD | NEW |