diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 19:46:46 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 19:46:46 +0000 |
commit | ae09ca6b5ae2e930ef40fd291a08afd1289fafa1 (patch) | |
tree | 7dc3f5ca8440d45cfe905511d2cfd6c776dc4cc1 /chrome/browser/extensions/user_script_master.cc | |
parent | ef6688c58eb5b2d238fd38bcf3513d4ebf7baa78 (diff) | |
download | chromium_src-ae09ca6b5ae2e930ef40fd291a08afd1289fafa1.zip chromium_src-ae09ca6b5ae2e930ef40fd291a08afd1289fafa1.tar.gz chromium_src-ae09ca6b5ae2e930ef40fd291a08afd1289fafa1.tar.bz2 |
Load extensions that have their manifest in the Prefs on the UI thread.
There is some migration code for loading old extensions which we do on the UI
thread as well, for simplicity. This will only happen the first time the user
starts Chrome, so I think it's OK.
Also cleaned up the EXTENSIONS_LOADED notification to send out a single
extension, instead of a 1-element list of extensions.
BUG=18293
TEST=loading extensions should still work
Review URL: http://codereview.chromium.org/174208
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/user_script_master.cc')
-rw-r--r-- | chrome/browser/extensions/user_script_master.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index e49dfa1..7fa7832 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -268,7 +268,7 @@ UserScriptMaster::UserScriptMaster(MessageLoop* worker_loop, registrar_.Add(this, NotificationType::EXTENSIONS_READY, NotificationService::AllSources()); - registrar_.Add(this, NotificationType::EXTENSIONS_LOADED, + registrar_.Add(this, NotificationType::EXTENSION_LOADED, NotificationService::AllSources()); registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, NotificationService::AllSources()); @@ -336,22 +336,18 @@ void UserScriptMaster::Observe(NotificationType type, extensions_service_ready_ = true; StartScan(); break; - case NotificationType::EXTENSIONS_LOADED: { + case NotificationType::EXTENSION_LOADED: { // TODO(aa): Fix race here. A page could need a content script on startup, // before the extension has loaded. We need to freeze the renderer in // that case. // See: http://code.google.com/p/chromium/issues/detail?id=11547. // Add any content scripts inside the extension. - ExtensionList* extensions = Details<ExtensionList>(details).ptr(); - for (ExtensionList::iterator extension_iterator = extensions->begin(); - extension_iterator != extensions->end(); ++extension_iterator) { - Extension* extension = *extension_iterator; - const UserScriptList& scripts = extension->content_scripts(); - for (UserScriptList::const_iterator iter = scripts.begin(); - iter != scripts.end(); ++iter) { - lone_scripts_.push_back(*iter); - } + Extension* extension = Details<Extension>(details).ptr(); + const UserScriptList& scripts = extension->content_scripts(); + for (UserScriptList::const_iterator iter = scripts.begin(); + iter != scripts.end(); ++iter) { + lone_scripts_.push_back(*iter); } if (extensions_service_ready_) StartScan(); |