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

Unified Diff: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc

Issue 11348301: Force-load a lazy background page whenever an extension is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
diff --git a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
index c52920ac8fd8c60a8f985a7ffbd57b508789b0df..7bfcaaa58113733ef5069b48f61e653cd7612195 100644
--- a/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
+++ b/chrome/browser/extensions/api/app_runtime/app_runtime_api.cc
@@ -37,10 +37,14 @@ namespace extensions {
// static.
void AppEventRouter::DispatchOnLaunchedEvent(
Profile* profile, const Extension* extension) {
+ ExtensionSystem* system = ExtensionSystem::Get(profile);
scoped_ptr<ListValue> arguments(new ListValue());
- extensions::ExtensionSystem::Get(profile)->event_router()->
- DispatchEventToExtension(extension->id(), kOnLaunchedEvent,
- arguments.Pass(), profile, GURL());
+ system->event_router()->AddLazyEventListener(kOnLaunchedEvent,
+ extension->id());
+ system->event_router()->DispatchEventToExtension(
+ extension->id(), kOnLaunchedEvent, arguments.Pass(), profile, GURL());
+ system->event_router()->RemoveLazyEventListener(kOnLaunchedEvent,
+ extension->id());
Matt Perry 2012/11/29 20:24:46 If you go this route, can you move this chunk to a
Marijn Kruisselbrink 2012/11/29 21:07:19 Done.
}
// static.
@@ -68,9 +72,13 @@ void AppEventRouter::DispatchOnLaunchedEventWithFileEntry(
items->Append(launch_item);
launch_data->Set("items", items);
args->Append(launch_data);
- extensions::ExtensionSystem::Get(profile)->event_router()->
- DispatchEventToExtension(extension->id(), kOnLaunchedEvent, args.Pass(),
- profile, GURL());
+ ExtensionSystem* system = ExtensionSystem::Get(profile);
+ system->event_router()->AddLazyEventListener(kOnLaunchedEvent,
+ extension->id());
+ system->event_router()->DispatchEventToExtension(
+ extension->id(), kOnLaunchedEvent, args.Pass(), profile, GURL());
+ system->event_router()->RemoveLazyEventListener(kOnLaunchedEvent,
+ extension->id());
}
// static.
@@ -126,9 +134,13 @@ void AppEventRouter::DispatchOnLaunchedEventWithWebIntent(
int intent_id =
callbacks->RegisterCallback(extension, intents_dispatcher, source);
args->Append(base::Value::CreateIntegerValue(intent_id));
- extensions::ExtensionSystem::Get(profile)->event_router()->
- DispatchEventToExtension(extension->id(), kOnLaunchedEvent, args.Pass(),
- profile, GURL());
+ ExtensionSystem* system = ExtensionSystem::Get(profile);
+ system->event_router()->AddLazyEventListener(kOnLaunchedEvent,
+ extension->id());
+ system->event_router()->DispatchEventToExtension(
+ extension->id(), kOnLaunchedEvent, args.Pass(), profile, GURL());
+ system->event_router()->RemoveLazyEventListener(kOnLaunchedEvent,
+ extension->id());
}
bool AppRuntimePostIntentResponseFunction::RunImpl() {
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/extensions/extension_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698