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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 796543002: Plugin Power Saver: Implement option in Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 3fe50be93c015538cd3949f6a85bcd635facabf1..56459be7ef439dd02956275305adf654d651fe54 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -684,20 +684,11 @@ 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-page plug-ins for 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(OS_WIN)
// In Windows we need to check if we can load NPAPI plugins.
// For example, if the render view is in the Ash desktop, we should not.
@@ -722,7 +713,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
NOTREACHED();
break;
}
- case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: {
+ case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed:
+ case ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: {
#if !defined(DISABLE_NACL) && defined(ENABLE_EXTENSIONS)
const bool is_nacl_plugin =
plugin.name == ASCIIToUTF16(nacl::kNaClPluginName);
@@ -794,8 +786,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
if (render_frame->ShouldThrottleContent(params, frame->document().url(),
&poster_url,
&cross_origin_main_content)) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnablePluginPowerSaver)) {
+ if (status_value ==
+ ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
power_saver_mode =
RenderFrame::POWER_SAVER_MODE_PERIPHERAL_THROTTLED;
show_poster = poster_url.is_valid();
@@ -813,8 +805,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
prerender::PrerenderHelper::IsPrerendering(render_frame);
if (is_prerendering || show_poster) {
placeholder = create_blocked_plugin(
- show_poster ? IDR_PLUGIN_POSTER_HTML
- : IDR_CLICK_TO_PLAY_PLUGIN_HTML,
+ show_poster ? IDR_PLUGIN_POSTER_HTML : IDR_BLOCKED_PLUGIN_HTML,
l10n_util::GetStringFUTF16(IDS_PLUGIN_LOAD, group_name),
poster_url);
placeholder->set_blocked_for_prerendering(is_prerendering);
@@ -892,16 +883,6 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
}
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());
groby-ooo-7-16 2014/12/11 19:22:03 Do we still need IDS_PLUGIN_LOAD?
tommycli 2014/12/12 00:45:23 Done. You are correct. This is now extraneous.
- 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,

Powered by Google App Engine
This is Rietveld 408576698