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

Unified Diff: chrome/renderer/pepper/pepper_uma_host.cc

Issue 281853003: Whitelist libwidevinecdmadapter.so for pepper UMA reporting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/pepper/pepper_uma_host.cc
diff --git a/chrome/renderer/pepper/pepper_uma_host.cc b/chrome/renderer/pepper/pepper_uma_host.cc
index ebb95c7b626e22aa96cb468e243f339965794ba9..0e1d6724f4fd3c2143da0eca1e4375a91c6c6ef8 100644
--- a/chrome/renderer/pepper/pepper_uma_host.cc
+++ b/chrome/renderer/pepper/pepper_uma_host.cc
@@ -10,6 +10,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
+#include "content/public/renderer/pepper_plugin_instance.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "extensions/common/constants.h"
@@ -31,6 +32,10 @@ const char* const kWhitelistedHistogramPrefixes[] = {
"CD190EA2B764EDF0BB97552A638D32072F3CFD41", // see http://crbug.com/317833
};
+const char* const kWhitelistedPluginFileNames[] = {
+ "libwidevinecdmadapter.so", // see http://crbug.com/368743
ddorwin 2014/05/14 02:41:54 Could/should we just add a histogram prefix?
elijahtaylor1 2014/05/14 17:17:21 I'm assuming this is chromeos only or something?
xhwang 2014/05/14 17:41:28 This is the name on linux and cros, and I only car
ddorwin 2014/05/14 19:41:19 Should we ifdef it to make this clear? Other platf
xhwang 2014/05/14 19:56:32 Yeah, arraysize doesn't work with empty array. I'l
+};
+
std::string HashPrefix(const std::string& histogram) {
const std::string id_hash =
base::SHA1HashString(histogram.substr(0, histogram.find('.')));
@@ -46,10 +51,17 @@ PepperUMAHost::PepperUMAHost(content::RendererPpapiHost* host,
: ResourceHost(host->GetPpapiHost(), instance, resource),
document_url_(host->GetDocumentURL(instance)),
is_plugin_in_process_(host->IsRunningInProcess()) {
+ if (host->GetPluginInstance(instance)) {
+ plugin_file_name_ =
+ host->GetPluginInstance(instance)->GetModulePath().BaseName();
+ }
+
for (size_t i = 0; i < arraysize(kPredefinedAllowedUMAOrigins); ++i)
allowed_origins_.insert(kPredefinedAllowedUMAOrigins[i]);
for (size_t i = 0; i < arraysize(kWhitelistedHistogramPrefixes); ++i)
allowed_histogram_prefixes_.insert(kWhitelistedHistogramPrefixes[i]);
+ for (size_t i = 0; i < arraysize(kWhitelistedPluginFileNames); ++i)
+ allowed_plugin_file_names_.insert(kWhitelistedPluginFileNames[i]);
}
PepperUMAHost::~PepperUMAHost() {}
@@ -86,6 +98,11 @@ bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) {
return true;
}
+ if (allowed_plugin_file_names_.find(plugin_file_name_.MaybeAsASCII()) !=
+ allowed_plugin_file_names_.end()) {
+ return true;
+ }
+
LOG(ERROR) << "Host or histogram name is not allowed to use the UMA API.";
return false;
}
« chrome/renderer/pepper/pepper_uma_host.h ('K') | « chrome/renderer/pepper/pepper_uma_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698