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_uma_util.h" | 5 #include "chrome/browser/permissions/permission_uma_util.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 PERMISSION_ACTION_NUM); \ | 28 PERMISSION_ACTION_NUM); \ |
29 } else { \ | 29 } else { \ |
30 UMA_HISTOGRAM_ENUMERATION(permission_insecure, action, \ | 30 UMA_HISTOGRAM_ENUMERATION(permission_insecure, action, \ |
31 PERMISSION_ACTION_NUM); \ | 31 PERMISSION_ACTION_NUM); \ |
32 } | 32 } |
33 | 33 |
34 using content::PermissionType; | 34 using content::PermissionType; |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 // Enum for UMA purposes, make sure you update histograms.xml if you add new | |
39 // permission actions. Never delete or reorder an entry; only add new entries | |
40 // immediately before PERMISSION_NUM | |
41 enum PermissionAction { | |
42 GRANTED = 0, | |
43 DENIED = 1, | |
44 DISMISSED = 2, | |
45 IGNORED = 3, | |
46 REVOKED = 4, | |
47 REENABLED = 5, | |
48 REQUESTED = 6, | |
49 | |
50 // Always keep this at the end. | |
51 PERMISSION_ACTION_NUM, | |
52 }; | |
53 | |
54 // Deprecated. This method is used for the single-dimensional RAPPOR metrics | 38 // Deprecated. This method is used for the single-dimensional RAPPOR metrics |
55 // that are being replaced by the multi-dimensional ones. | 39 // that are being replaced by the multi-dimensional ones. |
56 const std::string GetRapporMetric(PermissionType permission, | 40 const std::string GetRapporMetric(PermissionType permission, |
57 PermissionAction action) { | 41 PermissionAction action) { |
58 std::string action_str; | 42 std::string action_str; |
59 switch (action) { | 43 switch (action) { |
60 case GRANTED: | 44 case GRANTED: |
61 action_str = "Granted"; | 45 action_str = "Granted"; |
62 break; | 46 break; |
63 case DENIED: | 47 case DENIED: |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 const GURL& revoked_origin) { | 267 const GURL& revoked_origin) { |
284 // TODO(tsergeant): Expand metrics definitions for revocation to include all | 268 // TODO(tsergeant): Expand metrics definitions for revocation to include all |
285 // permissions. | 269 // permissions. |
286 if (permission == PermissionType::NOTIFICATIONS || | 270 if (permission == PermissionType::NOTIFICATIONS || |
287 permission == PermissionType::GEOLOCATION || | 271 permission == PermissionType::GEOLOCATION || |
288 permission == PermissionType::AUDIO_CAPTURE || | 272 permission == PermissionType::AUDIO_CAPTURE || |
289 permission == PermissionType::VIDEO_CAPTURE) { | 273 permission == PermissionType::VIDEO_CAPTURE) { |
290 RecordPermissionAction(permission, REVOKED, revoked_origin); | 274 RecordPermissionAction(permission, REVOKED, revoked_origin); |
291 } | 275 } |
292 } | 276 } |
OLD | NEW |