| 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 "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_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 OnHistogramCustomCounts) | 77 OnHistogramCustomCounts) |
| 78 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration, | 78 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_UMA_HistogramEnumeration, |
| 79 OnHistogramEnumeration) | 79 OnHistogramEnumeration) |
| 80 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 80 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
| 81 PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled) | 81 PpapiHostMsg_UMA_IsCrashReportingEnabled, OnIsCrashReportingEnabled) |
| 82 PPAPI_END_MESSAGE_MAP() | 82 PPAPI_END_MESSAGE_MAP() |
| 83 return PP_ERROR_FAILED; | 83 return PP_ERROR_FAILED; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool PepperUMAHost::IsPluginWhitelisted() { | 86 bool PepperUMAHost::IsPluginWhitelisted() { |
| 87 #if defined(ENABLE_EXTENSIONS) |
| 87 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( | 88 return ChromeContentRendererClient::IsExtensionOrSharedModuleWhitelisted( |
| 88 document_url_, allowed_origins_); | 89 document_url_, allowed_origins_); |
| 90 #else |
| 91 return false; |
| 92 #endif |
| 89 } | 93 } |
| 90 | 94 |
| 91 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { | 95 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { |
| 92 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) { | 96 if (is_plugin_in_process_ && histogram.find("NaCl.") == 0) { |
| 93 return true; | 97 return true; |
| 94 } | 98 } |
| 95 | 99 |
| 96 if (IsPluginWhitelisted() && | 100 if (IsPluginWhitelisted() && |
| 97 allowed_histogram_prefixes_.find(HashPrefix(histogram)) != | 101 allowed_histogram_prefixes_.find(HashPrefix(histogram)) != |
| 98 allowed_histogram_prefixes_.end()) { | 102 allowed_histogram_prefixes_.end()) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 ppapi::host::HostMessageContext* context) { | 195 ppapi::host::HostMessageContext* context) { |
| 192 if (!IsPluginWhitelisted()) | 196 if (!IsPluginWhitelisted()) |
| 193 return PP_ERROR_NOACCESS; | 197 return PP_ERROR_NOACCESS; |
| 194 bool enabled = false; | 198 bool enabled = false; |
| 195 content::RenderThread::Get()->Send( | 199 content::RenderThread::Get()->Send( |
| 196 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); | 200 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); |
| 197 if (enabled) | 201 if (enabled) |
| 198 return PP_OK; | 202 return PP_OK; |
| 199 return PP_ERROR_FAILED; | 203 return PP_ERROR_FAILED; |
| 200 } | 204 } |
| OLD | NEW |