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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_store.cc

Issue 10544094: Add extension ID to crash dump info when trying to clear content settings for an unregistered exten… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
12 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/string_util.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co nstants.h" 16 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co nstants.h"
15 #include "chrome/browser/extensions/api/content_settings/content_settings_helper s.h" 17 #include "chrome/browser/extensions/api/content_settings/content_settings_helper s.h"
16 #include "chrome/browser/content_settings/content_settings_origin_identifier_val ue_map.h" 18 #include "chrome/browser/content_settings/content_settings_origin_identifier_val ue_map.h"
17 #include "chrome/browser/content_settings/content_settings_rule.h" 19 #include "chrome/browser/content_settings/content_settings_rule.h"
18 #include "chrome/browser/content_settings/content_settings_utils.h" 20 #include "chrome/browser/content_settings/content_settings_utils.h"
19 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
20 22
21 using content::BrowserThread; 23 using content::BrowserThread;
22 using content_settings::ConcatenationIterator; 24 using content_settings::ConcatenationIterator;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return NULL; 214 return NULL;
213 } 215 }
214 216
215 void ContentSettingsStore::ClearContentSettingsForExtension( 217 void ContentSettingsStore::ClearContentSettingsForExtension(
216 const std::string& ext_id, 218 const std::string& ext_id,
217 ExtensionPrefsScope scope) { 219 ExtensionPrefsScope scope) {
218 bool notify = false; 220 bool notify = false;
219 { 221 {
220 base::AutoLock lock(lock_); 222 base::AutoLock lock(lock_);
221 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope); 223 OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);
222 if (!map) 224 // TODO(bauerb): This is for debugging http://crbug.com/128652.
223 return; 225 // Remove once the bug is fixed.
226 if (!map) {
227 char ext_id_buffer[33];
228 base::strlcpy(ext_id_buffer, ext_id.c_str(), sizeof(ext_id_buffer));
229 base::debug::Alias(ext_id_buffer);
230 // Do a clean crash.
231 CHECK(false);
232 }
224 notify = !map->empty(); 233 notify = !map->empty();
225 map->clear(); 234 map->clear();
226 } 235 }
227 if (notify) { 236 if (notify) {
228 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular); 237 NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular);
229 } 238 }
230 } 239 }
231 240
232 base::ListValue* ContentSettingsStore::GetSettingsForExtension( 241 base::ListValue* ContentSettingsStore::GetSettingsForExtension(
233 const std::string& extension_id, 242 const std::string& extension_id,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 ContentSettingsStore::FindEntry(const std::string& ext_id) const { 363 ContentSettingsStore::FindEntry(const std::string& ext_id) const {
355 ExtensionEntryMap::const_iterator i; 364 ExtensionEntryMap::const_iterator i;
356 for (i = entries_.begin(); i != entries_.end(); ++i) { 365 for (i = entries_.begin(); i != entries_.end(); ++i) {
357 if (i->second->id == ext_id) 366 if (i->second->id == ext_id)
358 return i; 367 return i;
359 } 368 }
360 return entries_.end(); 369 return entries_.end();
361 } 370 }
362 371
363 } // namespace extensions 372 } // namespace extensions
OLDNEW
« 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