Chromium Code Reviews| Index: chrome/renderer/extensions/extension_dispatcher.cc |
| diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc |
| index 7ef396f4882a693d05e5f43db7f8612772f1071b..7f13849111100a6d76d454de2dda734e9b045d2f 100644 |
| --- a/chrome/renderer/extensions/extension_dispatcher.cc |
| +++ b/chrome/renderer/extensions/extension_dispatcher.cc |
| @@ -75,6 +75,7 @@ using WebKit::WebVector; |
| using WebKit::WebView; |
| using content::RenderThread; |
| using content::RenderView; |
| +using extensions::APIPermission; |
| using extensions::ApiDefinitionsNatives; |
| using extensions::AppWindowCustomBindings; |
| using extensions::ContextMenusCustomBindings; |
| @@ -597,7 +598,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); |
| @@ -608,6 +608,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() { |
| @@ -721,11 +725,16 @@ 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(APIPermission::kBrowserTag)) { |
|
Aaron Boodman
2012/07/02 20:52:35
1) No braces needed on 1-line if statements :)
2)
Mihai Parparita -not on Chrome
2012/07/02 22:05:14
Actually, isn't making this work in BLESSED_EXTENS
Aaron Boodman
2012/07/02 23:04:37
It depends on what you want. Looking at the code,
Mihai Parparita -not on Chrome
2012/07/02 23:23:45
Nope, that wasn't the plan. I had started this CL
|
| + module_system->Require("browserTag"); |
| + } |
| + } |
| + |
| context->set_module_system(module_system.Pass()); |
| int manifest_version = 1; |
| @@ -792,7 +801,7 @@ void ExtensionDispatcher::InitOriginPermissions(const Extension* extension) { |
| // TODO(jstritar): We should try to remove this special case. Also, these |
| // whitelist entries need to be updated when the kManagement permission |
| // changes. |
| - if (extension->HasAPIPermission(extensions::APIPermission::kManagement)) { |
| + if (extension->HasAPIPermission(APIPermission::kManagement)) { |
| WebSecurityPolicy::addOriginAccessWhitelistEntry( |
| extension->url(), |
| WebString::fromUTF8(chrome::kChromeUIScheme), |