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/user_script_listener.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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/user_script_listener.h" 5 #include "chrome/browser/extensions/user_script_listener.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/chrome_notification_types.h" 10 #include "chrome/common/chrome_notification_types.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 const Extension* unloaded_extension = 224 const Extension* unloaded_extension =
225 content::Details<UnloadedExtensionInfo>(details)->extension; 225 content::Details<UnloadedExtensionInfo>(details)->extension;
226 if (ContentScriptsInfo::GetContentScripts(unloaded_extension).empty()) 226 if (ContentScriptsInfo::GetContentScripts(unloaded_extension).empty())
227 return; // no patterns to delete for this extension. 227 return; // no patterns to delete for this extension.
228 228
229 // Clear all our patterns and reregister all the still-loaded extensions. 229 // Clear all our patterns and reregister all the still-loaded extensions.
230 URLPatterns new_patterns; 230 URLPatterns new_patterns;
231 ExtensionService* service = profile->GetExtensionService(); 231 ExtensionService* service = profile->GetExtensionService();
232 for (ExtensionSet::const_iterator it = service->extensions()->begin(); 232 for (ExtensionSet::const_iterator it = service->extensions()->begin();
233 it != service->extensions()->end(); ++it) { 233 it != service->extensions()->end(); ++it) {
234 if (*it != unloaded_extension) 234 if (it->get() != unloaded_extension)
235 CollectURLPatterns(*it, &new_patterns); 235 CollectURLPatterns(it->get(), &new_patterns);
236 } 236 }
237 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 237 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
238 &UserScriptListener::ReplaceURLPatterns, this, 238 &UserScriptListener::ReplaceURLPatterns, this,
239 profile, new_patterns)); 239 profile, new_patterns));
240 break; 240 break;
241 } 241 }
242 242
243 case chrome::NOTIFICATION_USER_SCRIPTS_UPDATED: { 243 case chrome::NOTIFICATION_USER_SCRIPTS_UPDATED: {
244 Profile* profile = content::Source<Profile>(source).ptr(); 244 Profile* profile = content::Source<Profile>(source).ptr();
245 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 245 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
246 &UserScriptListener::UserScriptsReady, this, profile)); 246 &UserScriptListener::UserScriptsReady, this, profile));
247 break; 247 break;
248 } 248 }
249 249
250 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 250 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
251 Profile* profile = content::Source<Profile>(source).ptr(); 251 Profile* profile = content::Source<Profile>(source).ptr();
252 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 252 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
253 &UserScriptListener::ProfileDestroyed, this, profile)); 253 &UserScriptListener::ProfileDestroyed, this, profile));
254 break; 254 break;
255 } 255 }
256 256
257 default: 257 default:
258 NOTREACHED(); 258 NOTREACHED();
259 } 259 }
260 } 260 }
261 261
262 } // namespace extensions 262 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/updater/safe_manifest_parser.cc ('k') | chrome/browser/extensions/webstore_install_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698