OLD | NEW |
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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/sha1.h" | 11 #include "base/sha1.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "chrome/common/chrome_content_client.h" | 14 #include "chrome/common/chrome_content_client.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
17 #include "chrome/renderer/chrome_content_renderer_client.h" | 17 #include "chrome/renderer/chrome_content_renderer_client.h" |
18 #include "content/public/renderer/pepper_plugin_instance.h" | 18 #include "content/public/renderer/pepper_plugin_instance.h" |
19 #include "content/public/renderer/render_thread.h" | 19 #include "content/public/renderer/render_thread.h" |
20 #include "content/public/renderer/renderer_ppapi_host.h" | 20 #include "content/public/renderer/renderer_ppapi_host.h" |
21 #include "ppapi/c/pp_errors.h" | 21 #include "ppapi/c/pp_errors.h" |
| 22 #include "ppapi/features/features.h" |
22 #include "ppapi/host/dispatch_host_message.h" | 23 #include "ppapi/host/dispatch_host_message.h" |
23 #include "ppapi/host/host_message_context.h" | 24 #include "ppapi/host/host_message_context.h" |
24 #include "ppapi/host/ppapi_host.h" | 25 #include "ppapi/host/ppapi_host.h" |
25 #include "ppapi/proxy/ppapi_messages.h" | 26 #include "ppapi/proxy/ppapi_messages.h" |
26 | 27 |
27 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 28 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
28 | 29 |
29 #if defined(ENABLE_EXTENSIONS) | 30 #if defined(ENABLE_EXTENSIONS) |
30 #include "extensions/common/constants.h" | 31 #include "extensions/common/constants.h" |
31 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
(...skipping 12 matching lines...) Expand all Loading... |
44 "01E9FFA9A8F3C18271FE91BEE46207F3B81755CC", // see http://crbug.com/521189 | 45 "01E9FFA9A8F3C18271FE91BEE46207F3B81755CC", // see http://crbug.com/521189 |
45 "97B23E01B2AA064E8332EE43A7A85C628AADC3F2", // see http://crbug.com/521189 | 46 "97B23E01B2AA064E8332EE43A7A85C628AADC3F2", // see http://crbug.com/521189 |
46 }; | 47 }; |
47 | 48 |
48 const char* const kWhitelistedHistogramPrefixes[] = { | 49 const char* const kWhitelistedHistogramPrefixes[] = { |
49 "22F67DA2061FFC4DC9A4974036348D9C38C22919", // see http://crbug.com/390221 | 50 "22F67DA2061FFC4DC9A4974036348D9C38C22919", // see http://crbug.com/390221 |
50 "3FEA4650221C5E6C39CF5C5C9F464FF74EAB6CE1", // see http://crbug.com/521189 | 51 "3FEA4650221C5E6C39CF5C5C9F464FF74EAB6CE1", // see http://crbug.com/521189 |
51 }; | 52 }; |
52 | 53 |
53 const char* const kWhitelistedPluginBaseNames[] = { | 54 const char* const kWhitelistedPluginBaseNames[] = { |
54 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS) | 55 #if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) |
55 kWidevineCdmAdapterFileName, // see http://crbug.com/368743 | 56 kWidevineCdmAdapterFileName, // see http://crbug.com/368743 |
56 // and http://crbug.com/410630 | 57 // and http://crbug.com/410630 |
57 #endif | 58 #endif |
58 ChromeContentClient::kPDFPluginPath, | 59 ChromeContentClient::kPDFPluginPath, |
59 }; | 60 }; |
60 | 61 |
61 std::string HashPrefix(const std::string& histogram) { | 62 std::string HashPrefix(const std::string& histogram) { |
62 const std::string id_hash = | 63 const std::string id_hash = |
63 base::SHA1HashString(histogram.substr(0, histogram.find('.'))); | 64 base::SHA1HashString(histogram.substr(0, histogram.find('.'))); |
64 DCHECK_EQ(id_hash.length(), base::kSHA1Length); | 65 DCHECK_EQ(id_hash.length(), base::kSHA1Length); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ppapi::host::HostMessageContext* context) { | 217 ppapi::host::HostMessageContext* context) { |
217 if (!IsPluginWhitelisted()) | 218 if (!IsPluginWhitelisted()) |
218 return PP_ERROR_NOACCESS; | 219 return PP_ERROR_NOACCESS; |
219 bool enabled = false; | 220 bool enabled = false; |
220 content::RenderThread::Get()->Send( | 221 content::RenderThread::Get()->Send( |
221 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); | 222 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); |
222 if (enabled) | 223 if (enabled) |
223 return PP_OK; | 224 return PP_OK; |
224 return PP_ERROR_FAILED; | 225 return PP_ERROR_FAILED; |
225 } | 226 } |
OLD | NEW |