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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 action_str = "Dismissed"; | 65 action_str = "Dismissed"; |
66 break; | 66 break; |
67 case IGNORED: | 67 case IGNORED: |
68 action_str = "Ignored"; | 68 action_str = "Ignored"; |
69 break; | 69 break; |
70 default: | 70 default: |
71 NOTREACHED(); | 71 NOTREACHED(); |
72 break; | 72 break; |
73 } | 73 } |
74 | 74 |
75 // Do not record the deprecated RAPPOR metrics for media permissions. | |
76 if (permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || | |
77 permission == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) | |
78 return ""; | |
Steven Holte
2015/10/22 00:22:11
Did these get added to GetPermissionString in anot
kcarattini
2015/10/26 01:42:08
I believe this cl is based off https://codereview.
tsergeant
2015/10/26 03:21:19
Yup!
| |
79 | |
75 std::string permission_str = | 80 std::string permission_str = |
76 PermissionUtil::GetPermissionString(permission); | 81 PermissionUtil::GetPermissionString(permission); |
77 if (permission_str.empty()) | 82 if (permission_str.empty()) |
78 return ""; | 83 return ""; |
79 return base::StringPrintf("ContentSettings.PermissionActions_%s.%s.Url", | 84 return base::StringPrintf("ContentSettings.PermissionActions_%s.%s.Url", |
80 permission_str.c_str(), action_str.c_str()); | 85 permission_str.c_str(), action_str.c_str()); |
81 } | 86 } |
82 | 87 |
83 void RecordPermissionAction(ContentSettingsType permission, | 88 void RecordPermissionAction(ContentSettingsType permission, |
84 PermissionAction action, | 89 PermissionAction action, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 action); | 133 action); |
129 break; | 134 break; |
130 #endif | 135 #endif |
131 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 136 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
132 PERMISSION_ACTION_UMA( | 137 PERMISSION_ACTION_UMA( |
133 secure_origin, "ContentSettings.PermissionActions_DurableStorage", | 138 secure_origin, "ContentSettings.PermissionActions_DurableStorage", |
134 "ContentSettings.PermissionActionsSecureOrigin_DurableStorage", | 139 "ContentSettings.PermissionActionsSecureOrigin_DurableStorage", |
135 "ContentSettings.PermissionActionsInsecureOrigin_DurableStorage", | 140 "ContentSettings.PermissionActionsInsecureOrigin_DurableStorage", |
136 action); | 141 action); |
137 break; | 142 break; |
143 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | |
144 // Media permissions are disabled on insecure origins, so there's no | |
145 // need to record metrics for secure/insecue. | |
146 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.AudioCapture", action, | |
147 PERMISSION_ACTION_NUM); | |
148 break; | |
149 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | |
150 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.VideoCapture", action, | |
151 PERMISSION_ACTION_NUM); | |
152 break; | |
138 default: | 153 default: |
139 NOTREACHED() << "PERMISSION " << permission << " not accounted for"; | 154 NOTREACHED() << "PERMISSION " << permission << " not accounted for"; |
140 } | 155 } |
141 | 156 |
142 // There are two sets of semi-redundant RAPPOR metrics being reported: | 157 // There are two sets of semi-redundant RAPPOR metrics being reported: |
143 // The soon-to-be-deprecated single dimensional ones, and the new | 158 // The soon-to-be-deprecated single dimensional ones, and the new |
144 // multi-dimensional ones. | 159 // multi-dimensional ones. |
145 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); | 160 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); |
146 const std::string rappor_metric = GetRapporMetric(permission, action); | 161 const std::string rappor_metric = GetRapporMetric(permission, action); |
147 if (!rappor_metric.empty()) | 162 if (!rappor_metric.empty()) |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 | 315 |
301 void PermissionContextUmaUtil::PermissionDismissed( | 316 void PermissionContextUmaUtil::PermissionDismissed( |
302 ContentSettingsType permission, const GURL& requesting_origin) { | 317 ContentSettingsType permission, const GURL& requesting_origin) { |
303 RecordPermissionAction(permission, DISMISSED, requesting_origin); | 318 RecordPermissionAction(permission, DISMISSED, requesting_origin); |
304 } | 319 } |
305 | 320 |
306 void PermissionContextUmaUtil::PermissionIgnored( | 321 void PermissionContextUmaUtil::PermissionIgnored( |
307 ContentSettingsType permission, const GURL& requesting_origin) { | 322 ContentSettingsType permission, const GURL& requesting_origin) { |
308 RecordPermissionAction(permission, IGNORED, requesting_origin); | 323 RecordPermissionAction(permission, IGNORED, requesting_origin); |
309 } | 324 } |
OLD | NEW |