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/browser/permissions/permission_context_uma_util.h" | 5 #include "chrome/browser/permissions/permission_context_uma_util.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/permissions/permission_manager.h" | 10 #include "chrome/browser/permissions/permission_manager.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 action_str = "Dismissed"; | 64 action_str = "Dismissed"; |
65 break; | 65 break; |
66 case IGNORED: | 66 case IGNORED: |
67 action_str = "Ignored"; | 67 action_str = "Ignored"; |
68 break; | 68 break; |
69 default: | 69 default: |
70 NOTREACHED(); | 70 NOTREACHED(); |
71 break; | 71 break; |
72 } | 72 } |
73 | 73 |
74 // Do not record the deprecated RAPPOR metrics for media permissions. | |
75 if (permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || | |
76 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) | |
77 return ""; | |
78 | |
74 std::string permission_str = | 79 std::string permission_str = |
75 PermissionContextUmaUtil::GetPermissionString(permission); | 80 PermissionContextUmaUtil::GetPermissionString(permission); |
76 if (permission_str.empty()) | 81 if (permission_str.empty()) |
77 return ""; | 82 return ""; |
78 return base::StringPrintf("ContentSettings.PermissionActions_%s.%s.Url", | 83 return base::StringPrintf("ContentSettings.PermissionActions_%s.%s.Url", |
79 permission_str.c_str(), action_str.c_str()); | 84 permission_str.c_str(), action_str.c_str()); |
80 } | 85 } |
81 | 86 |
82 void RecordPermissionAction(ContentSettingsType permission, | 87 void RecordPermissionAction(ContentSettingsType permission, |
83 PermissionAction action, | 88 PermissionAction action, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 action); | 132 action); |
128 break; | 133 break; |
129 #endif | 134 #endif |
130 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 135 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
131 PERMISSION_ACTION_UMA( | 136 PERMISSION_ACTION_UMA( |
132 secure_origin, "ContentSettings.PermissionActions_DurableStorage", | 137 secure_origin, "ContentSettings.PermissionActions_DurableStorage", |
133 "ContentSettings.PermissionActionsSecureOrigin_DurableStorage", | 138 "ContentSettings.PermissionActionsSecureOrigin_DurableStorage", |
134 "ContentSettings.PermissionActionsInsecureOrigin_DurableStorage", | 139 "ContentSettings.PermissionActionsInsecureOrigin_DurableStorage", |
135 action); | 140 action); |
136 break; | 141 break; |
142 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | |
143 // Media permissions are disabled on insecure origins, so there's no | |
144 // need to record metrics for secure/insecue. | |
145 UMA_HISTOGRAM_ENUMERATION("Permissions.Action_AudioCapture", action, | |
146 PERMISSION_ACTION_NUM); | |
147 break; | |
148 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | |
149 UMA_HISTOGRAM_ENUMERATION("Permissions.Action_VideoCapture", action, | |
150 PERMISSION_ACTION_NUM); | |
151 break; | |
137 default: | 152 default: |
138 NOTREACHED() << "PERMISSION " << permission << " not accounted for"; | 153 NOTREACHED() << "PERMISSION " << permission << " not accounted for"; |
139 } | 154 } |
140 | 155 |
141 // There are two sets of semi-redundant RAPPOR metrics being reported: | 156 // There are two sets of semi-redundant RAPPOR metrics being reported: |
142 // The soon-to-be-deprecated single dimensional ones, and the new | 157 // The soon-to-be-deprecated single dimensional ones, and the new |
143 // multi-dimensional ones. | 158 // multi-dimensional ones. |
144 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); | 159 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); |
145 const std::string rappor_metric = GetRapporMetric(permission, action); | 160 const std::string rappor_metric = GetRapporMetric(permission, action); |
146 if (!rappor_metric.empty()) | 161 if (!rappor_metric.empty()) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 return "MidiSysEx"; | 336 return "MidiSysEx"; |
322 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 337 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
323 return "PushMessaging"; | 338 return "PushMessaging"; |
324 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 339 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
325 return "DurableStorage"; | 340 return "DurableStorage"; |
326 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 341 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
327 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 342 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
328 return "ProtectedMediaIdentifier"; | 343 return "ProtectedMediaIdentifier"; |
329 #endif | 344 #endif |
330 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 345 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
331 return "MediaStreamMic"; | 346 return "AudioCapture"; |
332 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 347 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
333 return "MediaStreamCamera"; | 348 return "VideoCapture"; |
tsergeant
2015/10/20 06:38:43
Kendra, does it affect you if I change these value
kcarattini
2015/10/21 02:56:55
I'll update my cl to match. Thanks.
| |
334 default: | 349 default: |
335 NOTREACHED(); | 350 NOTREACHED(); |
336 return ""; | 351 return ""; |
337 } | 352 } |
338 } | 353 } |
OLD | NEW |