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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 829113004: Plugin Power Saver: Add back 'Click to play' option as 4th for plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/common/render_messages.h ('k') | chrome/renderer/resources/click_to_play_plugin.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48f26e1980b4de763683f91c9614bb7b2db06e9b..c6e1d4a620ba3f4ae460589d0a0ecfff94475eab 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -687,11 +687,19 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
if ((status_value ==
ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized ||
+ status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay ||
status_value == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) &&
observer->IsPluginTemporarilyAllowed(identifier)) {
status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
}
+ // Allow full-screen plug-ins for left-click-to-play.
+ if (status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay &&
+ !frame->parent() && !frame->opener() &&
+ frame->document().isPluginDocument()) {
+ status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
+ }
+
#if defined(ENABLE_PLUGINS)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePluginPowerSaver)) {
@@ -888,6 +896,16 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
observer->DidBlockContentType(content_type, group_name);
break;
}
+ case ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay: {
+ placeholder = create_blocked_plugin(
+ IDR_CLICK_TO_PLAY_PLUGIN_HTML,
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_LOAD, group_name), GURL());
+ placeholder->set_allow_loading(true);
+ RenderThread::Get()->RecordAction(
+ UserMetricsAction("Plugin_ClickToPlay"));
+ observer->DidBlockContentType(content_type, group_name);
+ break;
+ }
case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: {
placeholder = create_blocked_plugin(
IDR_BLOCKED_PLUGIN_HTML,
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/resources/click_to_play_plugin.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698