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

Unified Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 10598006: Browser tag shim (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 8 years, 6 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/renderer/extensions/extension_dispatcher.cc
diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc
index 35fe9afea67695a4877e0a9390d6019d3b430b1d..340d8e0bc568e743fba975e0e0f98b991a5aa515 100644
--- a/chrome/renderer/extensions/extension_dispatcher.cc
+++ b/chrome/renderer/extensions/extension_dispatcher.cc
@@ -595,7 +595,6 @@ void ExtensionDispatcher::PopulateSourceMap() {
source_map_.RegisterSource("pageAction", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("pageCapture",
IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS);
- source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS);
source_map_.RegisterSource("runtime", IDR_RUNTIME_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("storage", IDR_STORAGE_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("tabs", IDR_TABS_CUSTOM_BINDINGS_JS);
@@ -606,6 +605,10 @@ void ExtensionDispatcher::PopulateSourceMap() {
source_map_.RegisterSource("webRequestInternal",
IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS);
+
+ // Platform app sources that are not API-specific..
+ source_map_.RegisterSource("browserTag", IDR_BROWSER_TAG_JS);
+ source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS);
}
void ExtensionDispatcher::PopulateLazyBindingsMap() {
@@ -719,11 +722,17 @@ void ExtensionDispatcher::DidCreateScriptContext(
}
}
- // Inject custom JS into the platform app context to block certain features
- // of the document and window.
- if (IsWithinPlatformApp(frame))
+ if (IsWithinPlatformApp(frame)) {
+ // Inject custom JS into the platform app context to block certain features
+ // of the document and window.
module_system->Require("platformApp");
+ if (extension &&
+ extension->HasAPIPermission(ExtensionAPIPermission::kBrowserTag)) {
+ module_system->Require("browserTag");
+ }
+ }
+
context->set_module_system(module_system.Pass());
int manifest_version = 1;

Powered by Google App Engine
This is Rietveld 408576698