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

Unified Diff: extensions/browser/extension_web_contents_observer.cc

Issue 1142993002: Don't send unnecessary ExtensionMsg_Loaded IPCs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a test Created 5 years, 7 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: extensions/browser/extension_web_contents_observer.cc
diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc
index 04335a527b8531cb9c7e3aac456528117b7be9ad..dec1e531dc262180f6f26e3b08823fa5a864c69d 100644
--- a/extensions/browser/extension_web_contents_observer.cc
+++ b/extensions/browser/extension_web_contents_observer.cc
@@ -90,34 +90,18 @@ void ExtensionWebContentsObserver::RenderViewCreated(
}
}
- switch (type) {
- case Manifest::TYPE_EXTENSION:
- case Manifest::TYPE_USER_SCRIPT:
- case Manifest::TYPE_HOSTED_APP:
- case Manifest::TYPE_LEGACY_PACKAGED_APP:
- case Manifest::TYPE_PLATFORM_APP:
- // Always send a Loaded message before ActivateExtension so that
- // ExtensionDispatcher knows what Extension is active, not just its ID.
- // This is important for classifying the Extension's JavaScript context
- // correctly (see ExtensionDispatcher::ClassifyJavaScriptContext).
- // We also have to include the tab-specific permissions here, since it's
- // an extension process.
- render_view_host->Send(
- new ExtensionMsg_Loaded(std::vector<ExtensionMsg_Loaded_Params>(
- 1, ExtensionMsg_Loaded_Params(
- extension, true /* include tab permissions */))));
- render_view_host->Send(
- new ExtensionMsg_ActivateExtension(extension->id()));
- break;
-
- case Manifest::TYPE_UNKNOWN:
- case Manifest::TYPE_THEME:
- case Manifest::TYPE_SHARED_MODULE:
- break;
-
- case Manifest::NUM_LOAD_TYPES:
- NOTREACHED();
- }
+ // Tells the new view that it's hosted in an extension process. It would be
+ // better to do this at process creation time (RendererStartupHelper), but
+ // the information that it's an *extension* process isn't plumbed in.
+ //
+ // Note that because this code is run per *view* we may end up sending
Devlin 2015/06/03 20:53:37 I think more important is that the Dispatcher is k
not at google - send to devlin 2015/06/03 21:53:03 The comment is about the fact that extension activ
+ // multiple redundant ExtensionMsg_ActivateExtension messages. For example,
+ // opening a popup will load both the background page and the popup, 2 views.
+ //
+ // All of the above said, the concept of activating an extension should be
+ // moot when site isolation is able to guarantee that no extension iframe can
+ // live in an untrusted process.
+ render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id()));
}
void ExtensionWebContentsObserver::RenderFrameCreated(

Powered by Google App Engine
This is Rietveld 408576698