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

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: commnets 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..af968b82cc2d44e5c75338c30f9c24ec067f838c 100644
--- a/extensions/browser/extension_web_contents_observer.cc
+++ b/extensions/browser/extension_web_contents_observer.cc
@@ -90,34 +90,15 @@ 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.
+ //
+ // This will often be a rendant IPC, because activating extensions happens at
+ // the process level, not at the view level. However, without some mild
+ // refactoring this isn't trivial to do, and this way is simpler.
+ //
+ // Plus, we can delete the concept of activating an extension once site
+ // isolation is turned on.
+ render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id()));
}
void ExtensionWebContentsObserver::RenderFrameCreated(

Powered by Google App Engine
This is Rietveld 408576698