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

Unified Diff: chrome/browser/extensions/extension_module.cc

Issue 9791011: Add experimental.alarms API to allow lazy background pages to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_module.cc
diff --git a/chrome/browser/extensions/extension_module.cc b/chrome/browser/extensions/extension_module.cc
index a1c884bdc08c736b7eeddc06a1f55b34d031acf8..eb5f1e758c212c32b9d71bf3b7888bb8997bcf7e 100644
--- a/chrome/browser/extensions/extension_module.cc
+++ b/chrome/browser/extensions/extension_module.cc
@@ -6,10 +6,32 @@
#include <string>
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/extensions/extension_prefs.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
+namespace {
+
+const char kOnInstalledEvent[] = "experimental.extension.onInstalled";
+
+}
+
+// static
+void ExtensionModuleEventRouter::DispatchOnInstalledEvent(
+ Profile* profile, const Extension* extension) {
+ // Special case: normally, extensions add their own lazy event listeners.
+ // However, since the extension has just been installed, it hasn't had a
+ // chance to register for events. So we register on its behalf. If the
+ // extension does not actually have a listener, the event will just be
+ // ignored.
+ ExtensionEventRouter* router = profile->GetExtensionEventRouter();
+ router->AddLazyEventListener(kOnInstalledEvent, extension->id());
+ router->DispatchEventToExtension(
+ extension->id(), kOnInstalledEvent, "[]", NULL, GURL());
+}
+
ExtensionPrefs* SetUpdateUrlDataFunction::extension_prefs() {
return profile()->GetExtensionService()->extension_prefs();
}
« no previous file with comments | « chrome/browser/extensions/extension_module.h ('k') | chrome/browser/extensions/lazy_background_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698