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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 1862513003: Remove NPAPI from browser and utility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/content_settings_observer.h » ('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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/crash_logging.h" 10 #include "base/debug/crash_logging.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 ShouldUseJavaScriptSettingForPlugin(info) 670 ShouldUseJavaScriptSettingForPlugin(info)
671 ? CONTENT_SETTINGS_TYPE_JAVASCRIPT 671 ? CONTENT_SETTINGS_TYPE_JAVASCRIPT
672 : CONTENT_SETTINGS_TYPE_PLUGINS; 672 : CONTENT_SETTINGS_TYPE_PLUGINS;
673 673
674 if ((status == ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized || 674 if ((status == ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized ||
675 status == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) && 675 status == ChromeViewHostMsg_GetPluginInfo_Status::kBlocked) &&
676 observer->IsPluginTemporarilyAllowed(identifier)) { 676 observer->IsPluginTemporarilyAllowed(identifier)) {
677 status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; 677 status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed;
678 } 678 }
679 679
680 #if defined(OS_WIN)
681 // In Windows we need to check if we can load NPAPI plugins.
682 // For example, if the render view is in the Ash desktop, we should not.
683 // If user is on ALLOW or DETECT setting, loading needs to be blocked here.
684 if ((status == ChromeViewHostMsg_GetPluginInfo_Status::kAllowed ||
685 status ==
686 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) &&
687 info.type == content::WebPluginInfo::PLUGIN_TYPE_NPAPI) {
688 if (observer->AreNPAPIPluginsBlocked())
689 status = ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
690 }
691 #endif
692
693 auto create_blocked_plugin = [&render_frame, &frame, &params, &info, 680 auto create_blocked_plugin = [&render_frame, &frame, &params, &info,
694 &identifier, &group_name]( 681 &identifier, &group_name](
695 int template_id, const base::string16& message) { 682 int template_id, const base::string16& message) {
696 return ChromePluginPlaceholder::CreateBlockedPlugin( 683 return ChromePluginPlaceholder::CreateBlockedPlugin(
697 render_frame, frame, params, info, identifier, group_name, 684 render_frame, frame, params, info, identifier, group_name,
698 template_id, message, PowerSaverInfo()); 685 template_id, message, PowerSaverInfo());
699 }; 686 };
700 switch (status) { 687 switch (status) {
701 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: { 688 case ChromeViewHostMsg_GetPluginInfo_Status::kNotFound: {
702 NOTREACHED(); 689 NOTREACHED();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 // PluginPreroller manages its own lifetime. 785 // PluginPreroller manages its own lifetime.
799 new PluginPreroller( 786 new PluginPreroller(
800 render_frame, frame, params, info, identifier, group_name, 787 render_frame, frame, params, info, identifier, group_name,
801 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), 788 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name),
802 throttler.get()); 789 throttler.get());
803 } 790 }
804 791
805 return render_frame->CreatePlugin(frame, info, params, 792 return render_frame->CreatePlugin(frame, info, params,
806 std::move(throttler)); 793 std::move(throttler));
807 } 794 }
808 case ChromeViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported: {
809 RenderThread::Get()->RecordAction(
810 UserMetricsAction("Plugin_NPAPINotSupported"));
811 placeholder = create_blocked_plugin(
812 IDR_BLOCKED_PLUGIN_HTML,
813 l10n_util::GetStringUTF16(IDS_PLUGIN_NOT_SUPPORTED_METRO));
814 break;
815 }
816 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: { 795 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: {
817 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type, 796 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type,
818 url); 797 url);
819 placeholder = create_blocked_plugin( 798 placeholder = create_blocked_plugin(
820 IDR_DISABLED_PLUGIN_HTML, 799 IDR_DISABLED_PLUGIN_HTML,
821 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name)); 800 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name));
822 break; 801 break;
823 } 802 }
824 case ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked: { 803 case ChromeViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked: {
825 #if defined(ENABLE_PLUGIN_INSTALLATION) 804 #if defined(ENABLE_PLUGIN_INSTALLATION)
(...skipping 13 matching lines...) Expand all
839 placeholder = create_blocked_plugin( 818 placeholder = create_blocked_plugin(
840 IDR_BLOCKED_PLUGIN_HTML, 819 IDR_BLOCKED_PLUGIN_HTML,
841 l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED, group_name)); 820 l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED, group_name));
842 break; 821 break;
843 } 822 }
844 case ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized: { 823 case ChromeViewHostMsg_GetPluginInfo_Status::kUnauthorized: {
845 placeholder = create_blocked_plugin( 824 placeholder = create_blocked_plugin(
846 IDR_BLOCKED_PLUGIN_HTML, 825 IDR_BLOCKED_PLUGIN_HTML,
847 l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, group_name)); 826 l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, group_name));
848 placeholder->AllowLoading(); 827 placeholder->AllowLoading();
849 if (info.type != content::WebPluginInfo::PLUGIN_TYPE_NPAPI) { 828 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin(
850 render_frame->Send(new ChromeViewHostMsg_BlockedUnauthorizedPlugin( 829 render_frame->GetRoutingID(), group_name, identifier));
851 render_frame->GetRoutingID(),
852 group_name,
853 identifier));
854 }
855 observer->DidBlockContentType(content_type, group_name); 830 observer->DidBlockContentType(content_type, group_name);
856 break; 831 break;
857 } 832 }
858 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: { 833 case ChromeViewHostMsg_GetPluginInfo_Status::kBlocked: {
859 placeholder = create_blocked_plugin( 834 placeholder = create_blocked_plugin(
860 IDR_BLOCKED_PLUGIN_HTML, 835 IDR_BLOCKED_PLUGIN_HTML,
861 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); 836 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
862 placeholder->AllowLoading(); 837 placeholder->AllowLoading();
863 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); 838 RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked"));
864 observer->DidBlockContentType(content_type, group_name); 839 observer->DidBlockContentType(content_type, group_name);
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 // chrome.system.network.getNetworkInterfaces provides the same 1407 // chrome.system.network.getNetworkInterfaces provides the same
1433 // information. Also, the enforcement of sending and binding UDP is already done 1408 // information. Also, the enforcement of sending and binding UDP is already done
1434 // by chrome extension permission model. 1409 // by chrome extension permission model.
1435 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() { 1410 bool ChromeContentRendererClient::ShouldEnforceWebRTCRoutingPreferences() {
1436 #if defined(ENABLE_EXTENSIONS) 1411 #if defined(ENABLE_EXTENSIONS)
1437 return !IsStandaloneExtensionProcess(); 1412 return !IsStandaloneExtensionProcess();
1438 #else 1413 #else
1439 return true; 1414 return true;
1440 #endif 1415 #endif
1441 } 1416 }
OLDNEW
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/renderer/content_settings_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698