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 "extensions/features/features.h" |
21 #include "ppapi/c/pp_errors.h" | 22 #include "ppapi/c/pp_errors.h" |
22 #include "ppapi/features/features.h" | 23 #include "ppapi/features/features.h" |
23 #include "ppapi/host/dispatch_host_message.h" | 24 #include "ppapi/host/dispatch_host_message.h" |
24 #include "ppapi/host/host_message_context.h" | 25 #include "ppapi/host/host_message_context.h" |
25 #include "ppapi/host/ppapi_host.h" | 26 #include "ppapi/host/ppapi_host.h" |
26 #include "ppapi/proxy/ppapi_messages.h" | 27 #include "ppapi/proxy/ppapi_messages.h" |
27 | 28 |
28 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 29 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
29 | 30 |
30 #if defined(ENABLE_EXTENSIONS) | 31 #if BUILDFLAG(ENABLE_EXTENSIONS) |
31 #include "extensions/common/constants.h" | 32 #include "extensions/common/constants.h" |
32 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
33 #endif // defined(ENABLE_EXTENSIONS) | 34 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
37 const char* const kPredefinedAllowedUMAOrigins[] = { | 38 const char* const kPredefinedAllowedUMAOrigins[] = { |
38 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/317833 | 39 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/317833 |
39 "4EB74897CB187C7633357C2FE832E0AD6A44883A", // see http://crbug.com/317833 | 40 "4EB74897CB187C7633357C2FE832E0AD6A44883A", // see http://crbug.com/317833 |
40 "9E527CDA9D7C50844E8A5DB964A54A640AE48F98", // see http://crbug.com/521189 | 41 "9E527CDA9D7C50844E8A5DB964A54A640AE48F98", // see http://crbug.com/521189 |
41 "DF52618D0B040D8A054D8348D2E84DDEEE5974E7", // see http://crbug.com/521189 | 42 "DF52618D0B040D8A054D8348D2E84DDEEE5974E7", // see http://crbug.com/521189 |
42 "269D721F163E587BC53C6F83553BF9CE2BB143CD", // see http://crbug.com/521189 | 43 "269D721F163E587BC53C6F83553BF9CE2BB143CD", // see http://crbug.com/521189 |
43 "6B55A5329E3F1F30F6032BDB20B2EB4378DBF767", // see http://crbug.com/521189 | 44 "6B55A5329E3F1F30F6032BDB20B2EB4378DBF767", // see http://crbug.com/521189 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 OnHistogramCustomCounts) | 100 OnHistogramCustomCounts) |
100 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration, | 101 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration, |
101 OnHistogramEnumeration) | 102 OnHistogramEnumeration) |
102 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 103 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
103 PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled) | 104 PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled) |
104 PPAPI_END_MESSAGE_MAP() | 105 PPAPI_END_MESSAGE_MAP() |
105 return PP_ERROR_FAILED; | 106 return PP_ERROR_FAILED; |
106 } | 107 } |
107 | 108 |
108 bool PepperUMAHost::IsPluginWhitelisted() { | 109 bool PepperUMAHost::IsPluginWhitelisted() { |
109 #if defined(ENABLE_EXTENSIONS) | 110 #if BUILDFLAG(ENABLE_EXTENSIONS) |
110 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( | 111 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( |
111 document_url_, allowed_origins_); | 112 document_url_, allowed_origins_); |
112 #else | 113 #else |
113 return false; | 114 return false; |
114 #endif | 115 #endif |
115 } | 116 } |
116 | 117 |
117 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { | 118 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { |
118 if (is_plugin_in_process_ && | 119 if (is_plugin_in_process_ && |
119 base::StartsWith(histogram, "NaCl.", base::CompareCase::SENSITIVE)) { | 120 base::StartsWith(histogram, "NaCl.", base::CompareCase::SENSITIVE)) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 ppapi::host::HostMessageContext* context) { | 218 ppapi::host::HostMessageContext* context) { |
218 if (!IsPluginWhitelisted()) | 219 if (!IsPluginWhitelisted()) |
219 return PP_ERROR_NOACCESS; | 220 return PP_ERROR_NOACCESS; |
220 bool enabled = false; | 221 bool enabled = false; |
221 content::RenderThread::Get()->Send( | 222 content::RenderThread::Get()->Send( |
222 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); | 223 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); |
223 if (enabled) | 224 if (enabled) |
224 return PP_OK; | 225 return PP_OK; |
225 return PP_ERROR_FAILED; | 226 return PP_ERROR_FAILED; |
226 } | 227 } |
OLD | NEW |