Index: chrome/plugin/chrome_content_plugin_client.cc |
diff --git a/chrome/plugin/chrome_content_plugin_client.cc b/chrome/plugin/chrome_content_plugin_client.cc |
index c6712ab1502ce6003537ef020cc091626fde878f..291bc71cb8f34ed69a489a79658f81f725479224 100644 |
--- a/chrome/plugin/chrome_content_plugin_client.cc |
+++ b/chrome/plugin/chrome_content_plugin_client.cc |
@@ -4,6 +4,12 @@ |
#include "chrome/plugin/chrome_content_plugin_client.h" |
+#include <sstream> |
+ |
+#include "base/metrics/histogram.h" |
+#include "chrome/common/chrome_constants.h" |
+#include "third_party/widevine/cdm/widevine_cdm_common.h" |
+ |
#if defined(ENABLE_REMOTING) |
#include "base/files/file_path.h" |
#include "base/path_service.h" |
@@ -14,8 +20,8 @@ |
#include "base/native_library.h" |
#elif defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS) |
#include "crypto/nss_util.h" |
-#endif |
-#endif |
+#endif // defined(OS_WIN) |
+#endif // defined(ENABLE_REMOTING) |
#if defined(OS_MACOSX) |
#include "base/mac/mac_util.h" |
@@ -23,7 +29,7 @@ |
#include "base/strings/sys_string_conversions.h" |
#include "grit/chromium_strings.h" |
#include "ui/base/l10n/l10n_util.h" |
-#endif |
+#endif // defined(OS_MACOSX) |
namespace chrome { |
@@ -67,4 +73,36 @@ void ChromeContentPluginClient::PluginProcessStarted( |
#endif |
} |
+static void ReportPluginLoadUMA(const std::string& plugin_name, |
+ bool is_broker, |
+ int result) { |
+ DCHECK_LT(result, content::ContentPluginClient::LOAD_RESULT_MAX); |
+ |
+ std::ostringstream histogram_name; |
+ histogram_name << "Plugin." << (is_broker ? "Broker" : "Plugin") |
+ << "LoadResult." << plugin_name; |
+ |
+ // Note: This leaks memory, which is expected behavior. |
+ base::HistogramBase* histogram = |
+ base::LinearHistogram::FactoryGet( |
+ histogram_name.str(), |
+ 1, |
+ content::ContentPluginClient::LOAD_RESULT_MAX, |
+ content::ContentPluginClient::LOAD_RESULT_MAX + 1, |
+ base::HistogramBase::kUmaTargetedHistogramFlag); |
+ |
+ histogram->Add(result); |
+} |
+ |
+void ChromeContentPluginClient::PluginLoaded(const base::FilePath& plugin_path, |
+ bool is_broker, |
+ PluginLoadResult result) { |
+ base::FilePath::StringType plugin_name = plugin_path.BaseName().value(); |
+ if (plugin_name == kPepperFlashPluginFilename) { |
+ ReportPluginLoadUMA("PepperFlash", is_broker, result); |
+ } else if (plugin_name == kWidevineCdmPluginFileName) { |
+ ReportPluginLoadUMA("WidevineCDM", is_broker, result); |
+ } |
+} |
+ |
} // namespace chrome |