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

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

Issue 2162983002: [Extensions] Ensure ordering of extension [un]loaded, activated messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Istiaque's Created 4 years, 5 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_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index bb578e1db6ae68b13e19757e9bcfddd83cafeeee..77322386a39c3abe9fa5908988d30680a609cbf2 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -73,6 +73,7 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/external_install_info.h"
#include "extensions/browser/install_flag.h"
+#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/uninstall_reason.h"
#include "extensions/browser/update_observer.h"
@@ -309,6 +310,9 @@ ExtensionService::ExtensionService(Profile* profile,
extensions_enabled_(extensions_enabled),
ready_(ready),
shared_module_service_(new extensions::SharedModuleService(profile_)),
+ renderer_helper_(
+ extensions::RendererStartupHelperFactory::GetForBrowserContext(
+ profile_)),
app_data_migrator_(new extensions::AppDataMigrator(profile_, registry_)) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
TRACE_EVENT0("browser,startup", "ExtensionService::ExtensionService::ctor");
@@ -1030,27 +1034,7 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
base::Bind(&ExtensionService::OnExtensionRegisteredWithRequestContexts,
AsWeakPtr(), make_scoped_refptr(extension)));
- // Tell renderers about the new extension, unless it's a theme (renderers
- // don't need to know about themes).
- if (!extension->is_theme()) {
- for (content::RenderProcessHost::iterator i(
- content::RenderProcessHost::AllHostsIterator());
- !i.IsAtEnd(); i.Advance()) {
- content::RenderProcessHost* host = i.GetCurrentValue();
- Profile* host_profile =
- Profile::FromBrowserContext(host->GetBrowserContext());
- if (host_profile->GetOriginalProfile() ==
- profile_->GetOriginalProfile()) {
- // We don't need to include tab permisisons here, since the extension
- // was just loaded.
- std::vector<ExtensionMsg_Loaded_Params> loaded_extensions(
- 1, ExtensionMsg_Loaded_Params(extension,
- false /* no tab permissions */));
- host->Send(
- new ExtensionMsg_Loaded(loaded_extensions));
- }
- }
- }
+ renderer_helper_->OnExtensionLoaded(*extension);
// Tell subsystems that use the EXTENSION_LOADED notification about the new
// extension.
@@ -1122,15 +1106,7 @@ void ExtensionService::NotifyExtensionUnloaded(
content::Source<Profile>(profile_),
content::Details<UnloadedExtensionInfo>(&details));
- for (content::RenderProcessHost::iterator i(
- content::RenderProcessHost::AllHostsIterator());
- !i.IsAtEnd(); i.Advance()) {
- content::RenderProcessHost* host = i.GetCurrentValue();
- Profile* host_profile =
- Profile::FromBrowserContext(host->GetBrowserContext());
- if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile())
- host->Send(new ExtensionMsg_Unloaded(extension->id()));
- }
+ renderer_helper_->OnExtensionUnloaded(extension->id());
system_->UnregisterExtensionWithRequestContexts(extension->id(), reason);
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/renderer_initialization_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698