Chromium Code Reviews| Index: chrome/renderer/chrome_content_renderer_client.cc |
| diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc |
| index e561f09f70605dc8a067a5d5e3036656800cc280..98b140cc3efe4f142d7b7770cd48f05f265c2139 100644 |
| --- a/chrome/renderer/chrome_content_renderer_client.cc |
| +++ b/chrome/renderer/chrome_content_renderer_client.cc |
| @@ -22,6 +22,7 @@ |
| #include "base/values.h" |
| #include "build/build_config.h" |
| #include "chrome/common/channel_info.h" |
| +#include "chrome/common/chrome_content_client.h" |
|
Lei Zhang
2017/05/03 23:50:34
Remove existing entry from line 158 then?
tommycli
2017/05/04 00:08:30
Done.
|
| #include "chrome/common/chrome_features.h" |
| #include "chrome/common/chrome_isolated_world_ids.h" |
| #include "chrome/common/chrome_paths.h" |
| @@ -120,6 +121,7 @@ |
| #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| #include "third_party/WebKit/public/web/WebPluginParams.h" |
| #include "third_party/WebKit/public/web/WebSecurityPolicy.h" |
| +#include "third_party/WebKit/public/web/WebView.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/layout.h" |
| #include "ui/base/resource/resource_bundle.h" |
| @@ -812,6 +814,20 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( |
| } |
| #endif // !defined(DISABLE_NACL) && BUILDFLAG(ENABLE_EXTENSIONS) |
| + // Report PDF load metrics. Since the PDF plugin is comprised of an |
| + // extension that loads another plugin, make sure we don't double count. |
|
Lei Zhang
2017/05/03 23:50:34
extension that loads a second plugin, avoid double
tommycli
2017/05/04 00:08:30
Done.
|
| + if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName) && |
| + GURL(frame->GetDocument().Url()).host_piece() != |
| + extension_misc::kPdfExtensionId) { |
| + bool is_main_frame_plugin_document = |
| + frame->View()->MainFrame()->IsWebLocalFrame() && |
|
Lei Zhang
2017/05/03 23:50:34
I think the following does the same, without havin
tommycli
2017/05/04 00:08:31
Done.
|
| + frame->View()->MainFrame()->GetDocument().IsPluginDocument(); |
| + PluginUMAReporter::ReportPDFLoadStatus( |
| + is_main_frame_plugin_document |
| + ? PluginUMAReporter::LOADED_FULL_PAGE_PDF_WITH_PDFIUM |
| + : PluginUMAReporter::LOADED_EMBEDDED_PDF_WITH_PDFIUM); |
| + } |
| + |
| // Delay loading plugins if prerendering. |
| // TODO(mmenke): In the case of prerendering, feed into |
| // ChromeContentRendererClient::CreatePlugin instead, to |
| @@ -852,6 +868,12 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( |
| case ChromeViewHostMsg_GetPluginInfo_Status::kDisabled: { |
| PluginUMAReporter::GetInstance()->ReportPluginDisabled(orig_mime_type, |
| url); |
| + if (info.name == ASCIIToUTF16(ChromeContentClient::kPDFPluginName)) { |
| + PluginUMAReporter::ReportPDFLoadStatus( |
| + PluginUMAReporter:: |
| + SHOWED_DISABLED_PLUGIN_PLACEHOLDER_FOR_EMBEDDED_PDF); |
| + } |
| + |
| placeholder = create_blocked_plugin( |
| IDR_DISABLED_PLUGIN_HTML, |
| l10n_util::GetStringFUTF16(IDS_PLUGIN_DISABLED, group_name)); |