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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 ContentSettingsObserver* observer = 680 ContentSettingsObserver* observer =
681 ContentSettingsObserver::Get(render_frame); 681 ContentSettingsObserver::Get(render_frame);
682 682
683 const ContentSettingsType content_type = 683 const ContentSettingsType content_type =
684 ShouldUseJavaScriptSettingForPlugin(plugin) ? 684 ShouldUseJavaScriptSettingForPlugin(plugin) ?
685 CONTENT_SETTINGS_TYPE_JAVASCRIPT : 685 CONTENT_SETTINGS_TYPE_JAVASCRIPT :
686 CONTENT_SETTINGS_TYPE_PLUGINS; 686 CONTENT_SETTINGS_TYPE_PLUGINS;
687 687
688 if ((status_value == 688 if ((status_value ==
689 ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized || 689 ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized ||
690 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay ||
690 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) && 691 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) &&
691 observer->IsPluginTemporarilyAllowed(identifier)) { 692 observer->IsPluginTemporarilyAllowed(identifier)) {
692 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; 693 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
693 } 694 }
694 695
696 // Allow full-screen plug-ins for left-click-to-play.
697 if (status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay &&
698 !frame->parent() && !frame->opener() &&
699 frame->document().isPluginDocument()) {
700 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
701 }
702
695 #if defined(ENABLE_PLUGINS) 703 #if defined(ENABLE_PLUGINS)
696 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 704 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
697 switches::kEnablePluginPowerSaver)) { 705 switches::kEnablePluginPowerSaver)) {
698 status_value = 706 status_value =
699 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; 707 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
700 } 708 }
701 #endif 709 #endif
702 710
703 #if defined(OS_WIN) 711 #if defined(OS_WIN)
704 // In Windows we need to check if we can load NPAPI plugins. 712 // In Windows we need to check if we can load NPAPI plugins.
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 placeholder->set_allow_loading(true); 889 placeholder->set_allow_loading(true);
882 if (plugin.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) { 890 if (plugin.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) {
883 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin( 891 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin(
884 render_frame->GetRoutingID(), 892 render_frame->GetRoutingID(),
885 group_name, 893 group_name,
886 identifier)); 894 identifier));
887 } 895 }
888 observer->DidBlockContentType(content_type, group_name); 896 observer->DidBlockContentType(content_type, group_name);
889 break; 897 break;
890 } 898 }
899 case ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay: {
900 placeholder = create_blocked_plugin(
901 IDR_CLICK_TO_PLAY_PLUGIN_HTML,
902 l10n_util::GetStringFUTF16(IDS_PLUGIN_LOAD, group_name), GURL());
903 placeholder->set_allow_loading(true);
904 RenderThread::Get()->RecordAction(
905 UserMetricsAction("Plugin_ClickToPlay"));
906 observer->DidBlockContentType(content_type, group_name);
907 break;
908 }
891 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: { 909 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: {
892 placeholder = create_blocked_plugin( 910 placeholder = create_blocked_plugin(
893 IDR_BLOCKED_PLUGIN_HTML, 911 IDR_BLOCKED_PLUGIN_HTML,
894 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), GURL()); 912 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), GURL());
895 placeholder->set_allow_loading(true); 913 placeholder->set_allow_loading(true);
896 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); 914 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
897 observer->DidBlockContentType(content_type, group_name); 915 observer->DidBlockContentType(content_type, group_name);
898 break; 916 break;
899 } 917 }
900 case ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: { 918 case ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: {
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 if (mime_type == content::kBrowserPluginMimeType) { 1594 if (mime_type == content::kBrowserPluginMimeType) {
1577 return new extensions::ExtensionsGuestViewContainer(render_frame); 1595 return new extensions::ExtensionsGuestViewContainer(render_frame);
1578 } else { 1596 } else {
1579 return new extensions::MimeHandlerViewContainer( 1597 return new extensions::MimeHandlerViewContainer(
1580 render_frame, mime_type, original_url); 1598 render_frame, mime_type, original_url);
1581 } 1599 }
1582 #else 1600 #else
1583 return NULL; 1601 return NULL;
1584 #endif 1602 #endif
1585 } 1603 }
OLDNEW
« 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