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

Side by Side Diff: chrome/renderer/pepper/pepper_uma_host.cc

Issue 901863002: Revert of Fix the histograms whitelist for the OOP PDF plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/pepper/pepper_uma_host.h" 5 #include "chrome/renderer/pepper/pepper_uma_host.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/common/chrome_content_client.h"
11 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
13 #include "chrome/renderer/chrome_content_renderer_client.h" 12 #include "chrome/renderer/chrome_content_renderer_client.h"
14 #include "content/public/renderer/pepper_plugin_instance.h" 13 #include "content/public/renderer/pepper_plugin_instance.h"
15 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
16 #include "content/public/renderer/renderer_ppapi_host.h" 15 #include "content/public/renderer/renderer_ppapi_host.h"
17 #include "ppapi/c/pp_errors.h" 16 #include "ppapi/c/pp_errors.h"
18 #include "ppapi/host/dispatch_host_message.h" 17 #include "ppapi/host/dispatch_host_message.h"
19 #include "ppapi/host/host_message_context.h" 18 #include "ppapi/host/host_message_context.h"
20 #include "ppapi/host/ppapi_host.h" 19 #include "ppapi/host/ppapi_host.h"
21 #include "ppapi/proxy/ppapi_messages.h" 20 #include "ppapi/proxy/ppapi_messages.h"
22 21
23 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 22 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
24 23
25 #if defined(ENABLE_EXTENSIONS) 24 #if defined(ENABLE_EXTENSIONS)
26 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
27 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
28 #endif // defined(ENABLE_EXTENSIONS) 27 #endif // defined(ENABLE_EXTENSIONS)
29 28
30 namespace { 29 namespace {
31 30
32 const char* const kPredefinedAllowedUMAOrigins[] = { 31 const char* const kPredefinedAllowedUMAOrigins[] = {
33 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/317833 32 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/317833
34 "4EB74897CB187C7633357C2FE832E0AD6A44883A", // see http://crbug.com/317833 33 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see http://crbug.com/317833
35 }; 34 };
36 35
37 const char* const kWhitelistedHistogramPrefixes[] = { 36 const char* const kWhitelistedHistogramPrefixes[] = {
38 "22F67DA2061FFC4DC9A4974036348D9C38C22919", // see http://crbug.com/390221 37 "22F67DA2061FFC4DC9A4974036348D9C38C22919" // see http://crbug.com/390221
39 }; 38 };
40 39
41 const char* const kWhitelistedPluginBaseNames[] = { 40 const char* const kWhitelistedPluginBaseNames[] = {
42 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) 41 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
43 kWidevineCdmAdapterFileName, // see http://crbug.com/368743 42 kWidevineCdmAdapterFileName, // see http://crbug.com/368743
44 // and http://crbug.com/410630 43 // and http://crbug.com/410630
45 #endif 44 #endif
46 ChromeContentClient::kPDFPluginPath, 45 "libpdf.so" // see http://crbug.com/405305
47 }; 46 };
48 47
49 std::string HashPrefix(const std::string& histogram) { 48 std::string HashPrefix(const std::string& histogram) {
50 const std::string id_hash = 49 const std::string id_hash =
51 base::SHA1HashString(histogram.substr(0, histogram.find('.'))); 50 base::SHA1HashString(histogram.substr(0, histogram.find('.')));
52 DCHECK_EQ(id_hash.length(), base::kSHA1Length); 51 DCHECK_EQ(id_hash.length(), base::kSHA1Length);
53 return base::HexEncode(id_hash.c_str(), id_hash.length()); 52 return base::HexEncode(id_hash.c_str(), id_hash.length());
54 } 53 }
55 54
56 } // namespace 55 } // namespace
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return false; 99 return false;
101 #endif 100 #endif
102 } 101 }
103 102
104 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { 103 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) {
105 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) { 104 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) {
106 return true; 105 return true;
107 } 106 }
108 107
109 if (IsPluginWhitelisted() && 108 if (IsPluginWhitelisted() &&
110 ContainsKey(allowed_histogram_prefixes_, HashPrefix(histogram))) { 109 allowed_histogram_prefixes_.find(HashPrefix(histogram)) !=
110 allowed_histogram_prefixes_.end()) {
111 return true; 111 return true;
112 } 112 }
113 113
114 if (ContainsKey(allowed_plugin_base_names_, 114 if (allowed_plugin_base_names_.find(plugin_base_name_.MaybeAsASCII()) !=
115 plugin_base_name_.MaybeAsASCII())) { 115 allowed_plugin_base_names_.end()) {
116 return true; 116 return true;
117 } 117 }
118 118
119 LOG(ERROR) << "Host or histogram name is not allowed to use the UMA API."; 119 LOG(ERROR) << "Host or histogram name is not allowed to use the UMA API.";
120 return false; 120 return false;
121 } 121 }
122 122
123 #define RETURN_IF_BAD_ARGS(_min, _max, _buckets) \ 123 #define RETURN_IF_BAD_ARGS(_min, _max, _buckets) \
124 do { \ 124 do { \
125 if (_min >= _max || _buckets <= 1) \ 125 if (_min >= _max || _buckets <= 1) \
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ppapi::host::HostMessageContext* context) { 203 ppapi::host::HostMessageContext* context) {
204 if (!IsPluginWhitelisted()) 204 if (!IsPluginWhitelisted())
205 return PP_ERROR_NOACCESS; 205 return PP_ERROR_NOACCESS;
206 bool enabled = false; 206 bool enabled = false;
207 content::RenderThread::Get()->Send( 207 content::RenderThread::Get()->Send(
208 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); 208 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled));
209 if (enabled) 209 if (enabled)
210 return PP_OK; 210 return PP_OK;
211 return PP_ERROR_FAILED; 211 return PP_ERROR_FAILED;
212 } 212 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698