| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return NULL; | 222 return NULL; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void ContentSettingsStore::ClearContentSettingsForExtension( | 225 void ContentSettingsStore::ClearContentSettingsForExtension( |
| 226 const std::string& ext_id, | 226 const std::string& ext_id, |
| 227 ExtensionPrefsScope scope) { | 227 ExtensionPrefsScope scope) { |
| 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. | |
| 233 // Remove once the bug is fixed. | |
| 234 if (!map) { | 232 if (!map) { |
| 235 char ext_id_buffer[33]; | 233 // Fail gracefully in Release builds. |
| 236 base::strlcpy(ext_id_buffer, ext_id.c_str(), sizeof(ext_id_buffer)); | 234 NOTREACHED(); |
| 237 base::debug::Alias(ext_id_buffer); | 235 return; |
| 238 // Do a clean crash. | |
| 239 CHECK(false); | |
| 240 } | 236 } |
| 241 notify = !map->empty(); | 237 notify = !map->empty(); |
| 242 map->clear(); | 238 map->clear(); |
| 243 } | 239 } |
| 244 if (notify) { | 240 if (notify) { |
| 245 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular); | 241 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular); |
| 246 } | 242 } |
| 247 } | 243 } |
| 248 | 244 |
| 249 base::ListValue* ContentSettingsStore::GetSettingsForExtension( | 245 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 { | 367 ContentSettingsStore::FindEntry(const std::string& ext_id) const { |
| 372 ExtensionEntryMap::const_iterator i; | 368 ExtensionEntryMap::const_iterator i; |
| 373 for (i = entries_.begin(); i != entries_.end(); ++i) { | 369 for (i = entries_.begin(); i != entries_.end(); ++i) { |
| 374 if (i->second->id == ext_id) | 370 if (i->second->id == ext_id) |
| 375 return i; | 371 return i; |
| 376 } | 372 } |
| 377 return entries_.end(); | 373 return entries_.end(); |
| 378 } | 374 } |
| 379 | 375 |
| 380 } // namespace extensions | 376 } // namespace extensions |
| OLD | NEW |