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

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

Issue 2211213002: Revert of [Extensions] Ensure ordering of extension [un]loaded, activated messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 6fc67f90f554ad14b5e55be9b7404c29e0cd6d5f..3c5b4bd5bcefceae2f400e9a6cc126b3f2b0b852 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -74,7 +74,6 @@
#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"
@@ -310,9 +309,6 @@
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");
@@ -1034,7 +1030,27 @@
base::Bind(&ExtensionService::OnExtensionRegisteredWithRequestContexts,
AsWeakPtr(), make_scoped_refptr(extension)));
- renderer_helper_->OnExtensionLoaded(*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));
+ }
+ }
+ }
// Tell subsystems that use the EXTENSION_LOADED notification about the new
// extension.
@@ -1106,7 +1122,15 @@
content::Source<Profile>(profile_),
content::Details<UnloadedExtensionInfo>(&details));
- renderer_helper_->OnExtensionUnloaded(extension->id());
+ 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()));
+ }
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