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

Unified Diff: chrome/browser/plugins/plugin_info_message_filter.cc

Issue 24576003: <webview>: Change how plugin load works inside guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 3 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
« no previous file with comments | « chrome/browser/guestview/webview/webview_permission_types.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_info_message_filter.cc
diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
index 0b349c04a364c1a4bc1601d6e0f57845141d0536..a44691075c6bc77f40e53f1becf1835aec6bddc7 100644
--- a/chrome/browser/plugins/plugin_info_message_filter.cc
+++ b/chrome/browser/plugins/plugin_info_message_filter.cc
@@ -11,6 +11,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/content_settings/content_settings_utils.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/extensions/extension_renderer_state.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "chrome/browser/plugins/plugin_metadata.h"
@@ -223,6 +224,17 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
return;
}
#endif
+ if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) {
+ CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ // NPAPI plugins are not supported inside <webview> guests.
+ ExtensionRendererState::WebViewInfo info;
+ if (ExtensionRendererState::GetInstance()->GetWebViewInfo(
+ render_process_id_, params.render_view_id, &info)) {
+ status->value =
+ ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
+ return;
+ }
+ }
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
bool uses_default_content_setting = true;
@@ -274,6 +286,19 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus(
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay;
else if (plugin_setting == CONTENT_SETTING_BLOCK)
status->value = ChromeViewHostMsg_GetPluginInfo_Status::kBlocked;
+
+ if (status->value == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed) {
+ // Allow an embedder of <webview> to block a plugin from being loaded inside
+ // the guest. In order to do this, set the status to 'Unauthorized' here,
+ // and update the status as appropriate depending on the response from the
+ // embedder.
+ ExtensionRendererState::WebViewInfo info;
+ if (ExtensionRendererState::GetInstance()->GetWebViewInfo(
+ render_process_id_, params.render_view_id, &info)) {
+ status->value =
+ ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized;
+ }
+ }
}
bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
« no previous file with comments | « chrome/browser/guestview/webview/webview_permission_types.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698