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

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

Issue 2901563003: PDF: Add UMA to track embedded PDF triggered drive-by downloads. (Closed)
Patch Set: fix Created 3 years, 6 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/pdf_uma.cc ('k') | chrome/renderer/plugins/plugin_uma.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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 #if BUILDFLAG(ENABLE_EXTENSIONS) 139 #if BUILDFLAG(ENABLE_EXTENSIONS)
140 #include "chrome/common/extensions/chrome_extensions_client.h" 140 #include "chrome/common/extensions/chrome_extensions_client.h"
141 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" 141 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h"
142 #include "extensions/common/extension_urls.h" 142 #include "extensions/common/extension_urls.h"
143 #include "extensions/common/switches.h" 143 #include "extensions/common/switches.h"
144 #include "extensions/renderer/dispatcher.h" 144 #include "extensions/renderer/dispatcher.h"
145 #include "extensions/renderer/renderer_extension_registry.h" 145 #include "extensions/renderer/renderer_extension_registry.h"
146 #endif 146 #endif
147 147
148 #if BUILDFLAG(ENABLE_PLUGINS) 148 #if BUILDFLAG(ENABLE_PLUGINS)
149 #include "chrome/common/pdf_uma.h"
149 #include "chrome/common/plugin_utils.h" 150 #include "chrome/common/plugin_utils.h"
150 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 151 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
151 #include "chrome/renderer/plugins/power_saver_info.h" 152 #include "chrome/renderer/plugins/power_saver_info.h"
152 #else 153 #else
153 #include "components/plugins/renderer/plugin_placeholder.h" 154 #include "components/plugins/renderer/plugin_placeholder.h"
154 #endif 155 #endif
155 156
156 #if BUILDFLAG(ENABLE_PRINTING) 157 #if BUILDFLAG(ENABLE_PRINTING)
157 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" 158 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h"
158 #include "components/printing/renderer/print_web_view_helper.h" 159 #include "components/printing/renderer/print_web_view_helper.h"
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 818
818 // Report PDF load metrics. Since the PDF plugin is comprised of an 819 // Report PDF load metrics. Since the PDF plugin is comprised of an
819 // extension that loads a second plugin, avoid double counting by 820 // extension that loads a second plugin, avoid double counting by
820 // ignoring the creation of the second plugin. 821 // ignoring the creation of the second plugin.
821 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName) && 822 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName) &&
822 GURL(frame->GetDocument().Url()).host_piece() != 823 GURL(frame->GetDocument().Url()).host_piece() !=
823 extension_misc::kPdfExtensionId) { 824 extension_misc::kPdfExtensionId) {
824 bool is_main_frame_plugin_document = 825 bool is_main_frame_plugin_document =
825 render_frame->IsMainFrame() && 826 render_frame->IsMainFrame() &&
826 render_frame->GetWebFrame()->GetDocument().IsPluginDocument(); 827 render_frame->GetWebFrame()->GetDocument().IsPluginDocument();
827 PluginUMAReporter::ReportPDFLoadStatus( 828 ReportPDFLoadStatus(
828 is_main_frame_plugin_document 829 is_main_frame_plugin_document
829 ? PluginUMAReporter::LOADED_FULL_PAGE_PDF_WITH_PDFIUM 830 ? PDFLoadStatus::kLoadedFullPagePdfWithPdfium
830 : PluginUMAReporter::LOADED_EMBEDDED_PDF_WITH_PDFIUM); 831 : PDFLoadStatus::kLoadedEmbeddedPdfWithPdfium);
831 } 832 }
832 833
833 // Delay loading plugins if prerendering. 834 // Delay loading plugins if prerendering.
834 // TODO(mmenke): In the case of prerendering, feed into 835 // TODO(mmenke): In the case of prerendering, feed into
835 // ChromeContentRendererClient::CreatePlugin instead, to 836 // ChromeContentRendererClient::CreatePlugin instead, to
836 // reduce the chance of future regressions. 837 // reduce the chance of future regressions.
837 bool is_prerendering = 838 bool is_prerendering =
838 prerender::PrerenderHelper::IsPrerendering(render_frame); 839 prerender::PrerenderHelper::IsPrerendering(render_frame);
839 840
840 bool power_saver_setting_on = 841 bool power_saver_setting_on =
(...skipping 23 matching lines...) Expand all
864 break; 865 break;
865 } 866 }
866 867
867 // Same-origin and whitelisted-origin plugins skip the placeholder. 868 // Same-origin and whitelisted-origin plugins skip the placeholder.
868 return render_frame->CreatePlugin(info, params, nullptr); 869 return render_frame->CreatePlugin(info, params, nullptr);
869 } 870 }
870 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: { 871 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: {
871 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type, 872 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type,
872 url); 873 url);
873 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) { 874 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) {
874 PluginUMAReporter::ReportPDFLoadStatus( 875 ReportPDFLoadStatus(
875 PluginUMAReporter:: 876 PDFLoadStatus::kShowedDisabledPluginPlaceholderForEmbeddedPdf);
876 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF);
877 } 877 }
878 878
879 placeholder = create_blocked_plugin( 879 placeholder = create_blocked_plugin(
880 IDR_DISABLED_PLUGIN_HTML, 880 IDR_DISABLED_PLUGIN_HTML,
881 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name)); 881 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name));
882 break; 882 break;
883 } 883 }
884 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: { 884 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: {
885 placeholder = create_blocked_plugin( 885 placeholder = create_blocked_plugin(
886 IDR_PREFER_HTML_PLUGIN_HTML, 886 IDR_PREFER_HTML_PLUGIN_HTML,
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1571
1572 RecordYouTubeRewriteUMA(result); 1572 RecordYouTubeRewriteUMA(result);
1573 return corrected_url.ReplaceComponents(r); 1573 return corrected_url.ReplaceComponents(r);
1574 } 1574 }
1575 1575
1576 std::unique_ptr<base::TaskScheduler::InitParams> 1576 std::unique_ptr<base::TaskScheduler::InitParams>
1577 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1577 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1578 return task_scheduler_util:: 1578 return task_scheduler_util::
1579 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1579 GetRendererTaskSchedulerInitParamsFromCommandLine();
1580 } 1580 }
OLDNEW
« no previous file with comments | « chrome/common/pdf_uma.cc ('k') | chrome/renderer/plugins/plugin_uma.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698