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

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: Created 3 years, 7 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
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(is_main_frame_plugin_document
828 is_main_frame_plugin_document 829 ? LOADED_FULL_PAGE_PDF_WITH_PDFIUM
829 ? PluginUMAReporter::LOADED_FULL_PAGE_PDF_WITH_PDFIUM 830 : LOADED_EMBEDDED_PDF_WITH_PDFIUM);
830 : PluginUMAReporter::LOADED_EMBEDDED_PDF_WITH_PDFIUM);
831 } 831 }
832 832
833 // Delay loading plugins if prerendering. 833 // Delay loading plugins if prerendering.
834 // TODO(mmenke): In the case of prerendering, feed into 834 // TODO(mmenke): In the case of prerendering, feed into
835 // ChromeContentRendererClient::CreatePlugin instead, to 835 // ChromeContentRendererClient::CreatePlugin instead, to
836 // reduce the chance of future regressions. 836 // reduce the chance of future regressions.
837 bool is_prerendering = 837 bool is_prerendering =
838 prerender::PrerenderHelper::IsPrerendering(render_frame); 838 prerender::PrerenderHelper::IsPrerendering(render_frame);
839 839
840 bool power_saver_setting_on = 840 bool power_saver_setting_on =
(...skipping 23 matching lines...) Expand all
864 break; 864 break;
865 } 865 }
866 866
867 // Same-origin and whitelisted-origin plugins skip the placeholder. 867 // Same-origin and whitelisted-origin plugins skip the placeholder.
868 return render_frame->CreatePlugin(info, params, nullptr); 868 return render_frame->CreatePlugin(info, params, nullptr);
869 } 869 }
870 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: { 870 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: {
871 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type, 871 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type,
872 url); 872 url);
873 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) { 873 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) {
874 PluginUMAReporter::ReportPDFLoadStatus( 874 ReportPDFLoadStatus(
875 PluginUMAReporter:: 875 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF);
876 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF);
877 } 876 }
878 877
879 placeholder = create_blocked_plugin( 878 placeholder = create_blocked_plugin(
880 IDR_DISABLED_PLUGIN_HTML, 879 IDR_DISABLED_PLUGIN_HTML,
881 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name)); 880 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name));
882 break; 881 break;
883 } 882 }
884 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: { 883 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: {
885 placeholder = create_blocked_plugin( 884 placeholder = create_blocked_plugin(
886 IDR_PREFER_HTML_PLUGIN_HTML, 885 IDR_PREFER_HTML_PLUGIN_HTML,
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1570
1572 RecordYouTubeRewriteUMA(result); 1571 RecordYouTubeRewriteUMA(result);
1573 return corrected_url.ReplaceComponents(r); 1572 return corrected_url.ReplaceComponents(r);
1574 } 1573 }
1575 1574
1576 std::unique_ptr<base::TaskScheduler::InitParams> 1575 std::unique_ptr<base::TaskScheduler::InitParams>
1577 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1576 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1578 return task_scheduler_util:: 1577 return task_scheduler_util::
1579 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1578 GetRendererTaskSchedulerInitParamsFromCommandLine();
1580 } 1579 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698