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" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #endif | 113 #endif |
114 } | 114 } |
115 | 115 |
116 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { | 116 bool PepperUMAHost::IsHistogramAllowed(const std::string& histogram) { |
117 if (is_plugin_in_process_ && | 117 if (is_plugin_in_process_ && |
118 base::StartsWith(histogram, "NaCl.", base::CompareCase::SENSITIVE)) { | 118 base::StartsWith(histogram, "NaCl.", base::CompareCase::SENSITIVE)) { |
119 return true; | 119 return true; |
120 } | 120 } |
121 | 121 |
122 if (IsPluginWhitelisted() && | 122 if (IsPluginWhitelisted() && |
123 ContainsKey(allowed_histogram_prefixes_, HashPrefix(histogram))) { | 123 base::ContainsKey(allowed_histogram_prefixes_, HashPrefix(histogram))) { |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 if (ContainsKey(allowed_plugin_base_names_, | 127 if (base::ContainsKey(allowed_plugin_base_names_, |
128 plugin_base_name_.MaybeAsASCII())) { | 128 plugin_base_name_.MaybeAsASCII())) { |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 LOG(ERROR) << "Host or histogram name is not allowed to use the UMA API."; | 132 LOG(ERROR) << "Host or histogram name is not allowed to use the UMA API."; |
133 return false; | 133 return false; |
134 } | 134 } |
135 | 135 |
136 #define RETURN_IF_BAD_ARGS(_min, _max, _buckets) \ | 136 #define RETURN_IF_BAD_ARGS(_min, _max, _buckets) \ |
137 do { \ | 137 do { \ |
138 if (_min >= _max || _buckets <= 1) \ | 138 if (_min >= _max || _buckets <= 1) \ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ppapi::host::HostMessageContext* context) { | 216 ppapi::host::HostMessageContext* context) { |
217 if (!IsPluginWhitelisted()) | 217 if (!IsPluginWhitelisted()) |
218 return PP_ERROR_NOACCESS; | 218 return PP_ERROR_NOACCESS; |
219 bool enabled = false; | 219 bool enabled = false; |
220 content::RenderThread::Get()->Send( | 220 content::RenderThread::Get()->Send( |
221 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); | 221 new ChromeViewHostMsg_IsCrashReportingEnabled(&enabled)); |
222 if (enabled) | 222 if (enabled) |
223 return PP_OK; | 223 return PP_OK; |
224 return PP_ERROR_FAILED; | 224 return PP_ERROR_FAILED; |
225 } | 225 } |
OLD | NEW |