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

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

Issue 10828218: Add chrome.runtime.onStartup, which is fired on browser start. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm debug logs Created 8 years, 4 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
« no previous file with comments | « chrome/browser/extensions/event_router.cc ('k') | chrome/browser/extensions/lazy_background_task_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_process_manager.cc
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index e9562e9370799eddb4c4e459c543e79675e6fba3..27ffc2186a1aebd6de07b17580539b9020a826dd 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -10,6 +10,7 @@
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/time.h"
+#include "chrome/browser/extensions/api/runtime/runtime_api.h"
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_info_map.h"
@@ -89,16 +90,20 @@ class IncognitoExtensionProcessManager : public ExtensionProcessManager {
static void CreateBackgroundHostForExtensionLoad(
ExtensionProcessManager* manager, const Extension* extension) {
- if (extension->has_persistent_background_page()) {
+ if (extension->has_persistent_background_page())
manager->CreateBackgroundHost(extension, extension->GetBackgroundURL());
- }
}
static void CreateBackgroundHostsForProfileStartup(
- ExtensionProcessManager* manager, const ExtensionSet* extensions) {
+ Profile* profile,
+ ExtensionProcessManager* manager,
+ const ExtensionSet* extensions) {
for (ExtensionSet::const_iterator extension = extensions->begin();
extension != extensions->end(); ++extension) {
CreateBackgroundHostForExtensionLoad(manager, *extension);
+
+ extensions::RuntimeEventRouter::DispatchOnStartupEvent(
+ profile, (*extension)->id());
}
}
@@ -557,19 +562,19 @@ void ExtensionProcessManager::Observe(
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_EXTENSIONS_READY: {
- CreateBackgroundHostsForProfileStartup(this,
- content::Source<Profile>(source).ptr()->
- GetExtensionService()->extensions());
+ Profile* profile = content::Source<Profile>(source).ptr();
+ CreateBackgroundHostsForProfileStartup(profile, this,
+ profile->GetExtensionService()->extensions());
break;
}
case chrome::NOTIFICATION_EXTENSION_LOADED: {
- ExtensionService* service =
- content::Source<Profile>(source).ptr()->GetExtensionService();
+ Profile* profile = content::Source<Profile>(source).ptr();
+ ExtensionService* service = profile->GetExtensionService();
if (service->is_ready()) {
const Extension* extension =
content::Details<const Extension>(details).ptr();
- ::CreateBackgroundHostForExtensionLoad(this, extension);
+ CreateBackgroundHostForExtensionLoad(this, extension);
}
break;
}
@@ -805,7 +810,8 @@ void IncognitoExtensionProcessManager::Observe(
// service will be NULL.
ExtensionService* service = GetProfile()->GetExtensionService();
if (service && service->is_ready())
- CreateBackgroundHostsForProfileStartup(this, service->extensions());
+ CreateBackgroundHostsForProfileStartup(GetProfile(),
+ this, service->extensions());
}
break;
}
« no previous file with comments | « chrome/browser/extensions/event_router.cc ('k') | chrome/browser/extensions/lazy_background_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698