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

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

Issue 2852193002: PDF: Add UMA to track successful / failed PDF loads (Closed)
Patch Set: change to count 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
« no previous file with comments | « no previous file | 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/crash_logging.h" 12 #include "base/debug/crash_logging.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
17 #include "base/metrics/user_metrics_action.h" 17 #include "base/metrics/user_metrics_action.h"
18 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "chrome/common/channel_info.h" 24 #include "chrome/common/channel_info.h"
25 #include "chrome/common/chrome_content_client.h"
25 #include "chrome/common/chrome_features.h" 26 #include "chrome/common/chrome_features.h"
26 #include "chrome/common/chrome_isolated_world_ids.h" 27 #include "chrome/common/chrome_isolated_world_ids.h"
27 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/crash_keys.h" 30 #include "chrome/common/crash_keys.h"
30 #include "chrome/common/features.h" 31 #include "chrome/common/features.h"
31 #include "chrome/common/pause_tabs_field_trial.h" 32 #include "chrome/common/pause_tabs_field_trial.h"
32 #include "chrome/common/pepper_permission_util.h" 33 #include "chrome/common/pepper_permission_util.h"
33 #include "chrome/common/prerender_types.h" 34 #include "chrome/common/prerender_types.h"
34 #include "chrome/common/render_messages.h" 35 #include "chrome/common/render_messages.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 147
147 #if BUILDFLAG(ENABLE_PLUGINS) 148 #if BUILDFLAG(ENABLE_PLUGINS)
148 #include "chrome/common/plugin_utils.h" 149 #include "chrome/common/plugin_utils.h"
149 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h" 150 #include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
150 #include "chrome/renderer/plugins/power_saver_info.h" 151 #include "chrome/renderer/plugins/power_saver_info.h"
151 #else 152 #else
152 #include "components/plugins/renderer/plugin_placeholder.h" 153 #include "components/plugins/renderer/plugin_placeholder.h"
153 #endif 154 #endif
154 155
155 #if BUILDFLAG(ENABLE_PRINTING) 156 #if BUILDFLAG(ENABLE_PRINTING)
156 #include "chrome/common/chrome_content_client.h"
157 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h" 157 #include "chrome/renderer/printing/chrome_print_web_view_helper_delegate.h"
158 #include "components/printing/renderer/print_web_view_helper.h" 158 #include "components/printing/renderer/print_web_view_helper.h"
159 #include "printing/print_settings.h" 159 #include "printing/print_settings.h"
160 #endif 160 #endif
161 161
162 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) 162 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
163 #include "chrome/renderer/pepper/chrome_pdf_print_client.h" 163 #include "chrome/renderer/pepper/chrome_pdf_print_client.h"
164 #endif 164 #endif
165 165
166 #if BUILDFLAG(ENABLE_SPELLCHECK) 166 #if BUILDFLAG(ENABLE_SPELLCHECK)
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 #if defined(OS_CHROMEOS) 808 #if defined(OS_CHROMEOS)
809 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); 809 l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED));
810 #else 810 #else
811 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); 811 l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
812 #endif 812 #endif
813 break; 813 break;
814 } 814 }
815 } 815 }
816 #endif // !defined(DISABLE_NACL) && BUILDFLAG(ENABLE_EXTENSIONS) 816 #endif // !defined(DISABLE_NACL) && BUILDFLAG(ENABLE_EXTENSIONS)
817 817
818 // Report PDF load metrics. Since the PDF plugin is comprised of an
819 // extension that loads a second plugin, avoid double counting by
820 // ignoring the creation of the second plugin.
821 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName) &&
822 GURL(frame->GetDocument().Url()).host_piece() !=
823 extension_misc::kPdfExtensionId) {
824 bool is_main_frame_plugin_document =
825 render_frame->IsMainFrame() &&
826 render_frame->GetWebFrame()->GetDocument().IsPluginDocument();
827 PluginUMAReporter::ReportPDFLoadStatus(
828 is_main_frame_plugin_document
829 ? PluginUMAReporter::LOADED_FULL_PAGE_PDF_WITH_PDFIUM
830 : PluginUMAReporter::LOADED_EMBEDDED_PDF_WITH_PDFIUM);
831 }
832
818 // Delay loading plugins if prerendering. 833 // Delay loading plugins if prerendering.
819 // TODO(mmenke): In the case of prerendering, feed into 834 // TODO(mmenke): In the case of prerendering, feed into
820 // ChromeContentRendererClient::CreatePlugin instead, to 835 // ChromeContentRendererClient::CreatePlugin instead, to
821 // reduce the chance of future regressions. 836 // reduce the chance of future regressions.
822 bool is_prerendering = 837 bool is_prerendering =
823 prerender::PrerenderHelper::IsPrerendering(render_frame); 838 prerender::PrerenderHelper::IsPrerendering(render_frame);
824 839
825 bool power_saver_setting_on = 840 bool power_saver_setting_on =
826 status == 841 status ==
827 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; 842 ChromeViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
(...skipping 20 matching lines...) Expand all
848 placeholder->AllowLoading(); 863 placeholder->AllowLoading();
849 break; 864 break;
850 } 865 }
851 866
852 // Same-origin and whitelisted-origin plugins skip the placeholder. 867 // Same-origin and whitelisted-origin plugins skip the placeholder.
853 return render_frame->CreatePlugin(info, params, nullptr); 868 return render_frame->CreatePlugin(info, params, nullptr);
854 } 869 }
855 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: { 870 case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: {
856 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type, 871 PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type,
857 url); 872 url);
873 if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) {
874 PluginUMAReporter::ReportPDFLoadStatus(
875 PluginUMAReporter::
876 SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF);
877 }
878
858 placeholder = create_blocked_plugin( 879 placeholder = create_blocked_plugin(
859 IDR_DISABLED_PLUGIN_HTML, 880 IDR_DISABLED_PLUGIN_HTML,
860 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name)); 881 l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name));
861 break; 882 break;
862 } 883 }
863 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: { 884 case ChromeViewHostMsg_GetPluginInfo_Status::kFlashHiddenPreferHtml: {
864 placeholder = create_blocked_plugin( 885 placeholder = create_blocked_plugin(
865 IDR_PREFER_HTML_PLUGIN_HTML, 886 IDR_PREFER_HTML_PLUGIN_HTML,
866 l10n_util::GetStringFUTF16(IDS_PLUGIN_PREFER_HTML_BY_DEFAULT, 887 l10n_util::GetStringFUTF16(IDS_PLUGIN_PREFER_HTML_BY_DEFAULT,
867 group_name)); 888 group_name));
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 1575
1555 RecordYouTubeRewriteUMA(result); 1576 RecordYouTubeRewriteUMA(result);
1556 return corrected_url.ReplaceComponents(r); 1577 return corrected_url.ReplaceComponents(r);
1557 } 1578 }
1558 1579
1559 std::unique_ptr<base::TaskScheduler::InitParams> 1580 std::unique_ptr<base::TaskScheduler::InitParams>
1560 ChromeContentRendererClient::GetTaskSchedulerInitParams() { 1581 ChromeContentRendererClient::GetTaskSchedulerInitParams() {
1561 return task_scheduler_util:: 1582 return task_scheduler_util::
1562 GetRendererTaskSchedulerInitParamsFromCommandLine(); 1583 GetRendererTaskSchedulerInitParamsFromCommandLine();
1563 } 1584 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/plugins/plugin_uma.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698