| OLD | NEW |
| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 ContentSettingsObserver* observer = | 695 ContentSettingsObserver* observer = |
| 696 ContentSettingsObserver::Get(render_frame); | 696 ContentSettingsObserver::Get(render_frame); |
| 697 | 697 |
| 698 const ContentSettingsType content_type = | 698 const ContentSettingsType content_type = |
| 699 ShouldUseJavaScriptSettingForPlugin(info) | 699 ShouldUseJavaScriptSettingForPlugin(info) |
| 700 ? CONTENT_SETTINGS_TYPE_JAVASCRIPT | 700 ? CONTENT_SETTINGS_TYPE_JAVASCRIPT |
| 701 : CONTENT_SETTINGS_TYPE_PLUGINS; | 701 : CONTENT_SETTINGS_TYPE_PLUGINS; |
| 702 | 702 |
| 703 if ((status_value == | 703 if ((status_value == |
| 704 ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized || | 704 ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized || |
| 705 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay || | |
| 706 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) && | 705 status_value == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) && |
| 707 observer->IsPluginTemporarilyAllowed(identifier)) { | 706 observer->IsPluginTemporarilyAllowed(identifier)) { |
| 708 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; | 707 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; |
| 709 } | 708 } |
| 710 | 709 |
| 711 // Allow full-screen plug-ins for left-click-to-play. | |
| 712 if (status_value == ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay && | |
| 713 !frame->parent() && !frame->opener() && | |
| 714 frame->document().isPluginDocument()) { | |
| 715 status_value = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; | |
| 716 } | |
| 717 | |
| 718 #if defined(ENABLE_PLUGINS) | 710 #if defined(ENABLE_PLUGINS) |
| 719 if (status_value == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed && | 711 if (status_value == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed && |
| 720 base::CommandLine::ForCurrentProcess()->HasSwitch( | 712 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 721 switches::kEnablePluginPowerSaver)) { | 713 switches::kEnablePluginPowerSaver)) { |
| 722 status_value = | 714 status_value = |
| 723 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; | 715 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; |
| 724 } | 716 } |
| 725 #endif | 717 #endif |
| 726 | 718 |
| 727 #if defined(OS_WIN) | 719 #if defined(OS_WIN) |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 placeholder->set_allow_loading(true); | 901 placeholder->set_allow_loading(true); |
| 910 if (info.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) { | 902 if (info.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) { |
| 911 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin( | 903 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin( |
| 912 render_frame->GetRoutingID(), | 904 render_frame->GetRoutingID(), |
| 913 group_name, | 905 group_name, |
| 914 identifier)); | 906 identifier)); |
| 915 } | 907 } |
| 916 observer->DidBlockContentType(content_type, group_name); | 908 observer->DidBlockContentType(content_type, group_name); |
| 917 break; | 909 break; |
| 918 } | 910 } |
| 919 case ChromeViewHostMsg_GetPluginInfo_Status::kClickToPlay: { | |
| 920 placeholder = create_blocked_plugin( | |
| 921 IDR_CLICK_TO_PLAY_PLUGIN_HTML, | |
| 922 l10n_util::GetStringFUTF16(IDS_PLUGIN_LOAD, group_name)); | |
| 923 placeholder->set_allow_loading(true); | |
| 924 RenderThread::Get()->RecordAction( | |
| 925 UserMetricsAction("Plugin_ClickToPlay")); | |
| 926 observer->DidBlockContentType(content_type, group_name); | |
| 927 break; | |
| 928 } | |
| 929 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: { | 911 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: { |
| 930 placeholder = create_blocked_plugin( | 912 placeholder = create_blocked_plugin( |
| 931 IDR_BLOCKED_PLUGIN_HTML, | 913 IDR_BLOCKED_PLUGIN_HTML, |
| 932 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); | 914 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); |
| 933 placeholder->set_allow_loading(true); | 915 placeholder->set_allow_loading(true); |
| 934 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); | 916 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); |
| 935 observer->DidBlockContentType(content_type, group_name); | 917 observer->DidBlockContentType(content_type, group_name); |
| 936 break; | 918 break; |
| 937 } | 919 } |
| 938 case ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: { | 920 case ChromeViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: { |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 if (mime_type == content::kBrowserPluginMimeType) { | 1580 if (mime_type == content::kBrowserPluginMimeType) { |
| 1599 return new extensions::ExtensionsGuestViewContainer(render_frame); | 1581 return new extensions::ExtensionsGuestViewContainer(render_frame); |
| 1600 } else { | 1582 } else { |
| 1601 return new extensions::MimeHandlerViewContainer( | 1583 return new extensions::MimeHandlerViewContainer( |
| 1602 render_frame, mime_type, original_url); | 1584 render_frame, mime_type, original_url); |
| 1603 } | 1585 } |
| 1604 #else | 1586 #else |
| 1605 return NULL; | 1587 return NULL; |
| 1606 #endif | 1588 #endif |
| 1607 } | 1589 } |
| OLD | NEW |