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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 12463015: Enable <adview> tag for packaged apps. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Merge fix. Created 7 years, 9 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/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index b7814592f2b28dab52ffb6676546c2535c18f6f7..921ad37d596d48d417f3eda60f56ebe55724d270 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -131,6 +131,7 @@ using WebKit::WebVector;
namespace {
const char kWebViewTagName[] = "WEBVIEW";
+const char kAdViewTagName[] = "ADVIEW";
// Explicitly register all extension ManifestHandlers needed to parse
// fields used in the renderer.
@@ -398,9 +399,16 @@ bool ChromeContentRendererClient::OverrideCreatePlugin(
WebDocument document = frame->document();
const Extension* extension =
GetExtension(document.securityOrigin());
- if (extension && extension->HasAPIPermission(
- extensions::APIPermission::kWebView))
- return false;
+ if (extension) {
+ const extensions::APIPermission::ID perms[] = {
+ extensions::APIPermission::kWebView,
+ extensions::APIPermission::kAdView
+ };
+ for (size_t i = 0; i < arraysize(perms); ++i) {
+ if (extension->HasAPIPermission(perms[i]))
+ return false;
+ }
+ }
}
ChromeViewHostMsg_GetPluginInfo_Output output;
@@ -1115,22 +1123,23 @@ bool ChromeContentRendererClient::AllowBrowserPlugin(
return true;
// If this |BrowserPlugin| <object> in the |container| is not inside a
- // <webview> shadowHost, we disable instantiating this plugin. This is to
- // discourage and prevent developers from accidentally attaching <object>
- // directly in apps.
+ // <webview>/<adview> shadowHost, we disable instantiating this plugin. This
+ // is to discourage and prevent developers from accidentally attaching
+ // <object> directly in apps.
//
// Note that this check below does *not* ensure any security, it is still
// possible to bypass this check.
// TODO(lazyboy): http://crbug.com/178663, Ensure we properly disallow
- // instantiating BrowserPlugin outside of the <webview> shim.
+ // instantiating BrowserPlugin outside of the <webview>/<adview> shim.
if (container->element().isNull())
return false;
if (container->element().shadowHost().isNull())
return false;
- return container->element().shadowHost().tagName().equals(
- WebString::fromUTF8(kWebViewTagName));
+ WebString tag_name = container->element().shadowHost().tagName();
+ return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) ||
+ tag_name.equals(WebString::fromUTF8(kAdViewTagName));
}
} // namespace chrome
« no previous file with comments | « chrome/common/extensions/permissions/permission_set_unittest.cc ('k') | chrome/renderer/extensions/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698