| 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 14 matching lines...) Expand all Loading... |
| 25 PERMISSION_ACTION_NUM); \ | 25 PERMISSION_ACTION_NUM); \ |
| 26 } else { \ | 26 } else { \ |
| 27 UMA_HISTOGRAM_ENUMERATION(permission_insecure, action, \ | 27 UMA_HISTOGRAM_ENUMERATION(permission_insecure, action, \ |
| 28 PERMISSION_ACTION_NUM); \ | 28 PERMISSION_ACTION_NUM); \ |
| 29 } | 29 } |
| 30 | 30 |
| 31 using content::PermissionType; | 31 using content::PermissionType; |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 // Enum for UMA purposes, make sure you update histograms.xml if you add new | |
| 36 // permission actions. Never delete or reorder an entry; only add new entries | |
| 37 // immediately before PERMISSION_NUM | |
| 38 enum PermissionAction { | |
| 39 GRANTED = 0, | |
| 40 DENIED = 1, | |
| 41 DISMISSED = 2, | |
| 42 IGNORED = 3, | |
| 43 REVOKED = 4, | |
| 44 REENABLED = 5, | |
| 45 REQUESTED = 6, | |
| 46 | |
| 47 // Always keep this at the end. | |
| 48 PERMISSION_ACTION_NUM, | |
| 49 }; | |
| 50 | |
| 51 // The returned strings must match the RAPPOR metrics in rappor.xml, | 35 // The returned strings must match the RAPPOR metrics in rappor.xml, |
| 52 // e.g. Permissions.Action.Geolocation etc.. | 36 // e.g. Permissions.Action.Geolocation etc.. |
| 53 const std::string GetPermissionString(ContentSettingsType permission) { | 37 const std::string GetPermissionString(ContentSettingsType permission) { |
| 54 switch (permission) { | 38 switch (permission) { |
| 55 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 39 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 56 return "Geolocation"; | 40 return "Geolocation"; |
| 57 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 41 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 58 return "Notifications"; | 42 return "Notifications"; |
| 59 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 43 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 60 return "MidiSysEx"; | 44 return "MidiSysEx"; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 305 |
| 322 void PermissionContextUmaUtil::PermissionDismissed( | 306 void PermissionContextUmaUtil::PermissionDismissed( |
| 323 ContentSettingsType permission, const GURL& requesting_origin) { | 307 ContentSettingsType permission, const GURL& requesting_origin) { |
| 324 RecordPermissionAction(permission, DISMISSED, requesting_origin); | 308 RecordPermissionAction(permission, DISMISSED, requesting_origin); |
| 325 } | 309 } |
| 326 | 310 |
| 327 void PermissionContextUmaUtil::PermissionIgnored( | 311 void PermissionContextUmaUtil::PermissionIgnored( |
| 328 ContentSettingsType permission, const GURL& requesting_origin) { | 312 ContentSettingsType permission, const GURL& requesting_origin) { |
| 329 RecordPermissionAction(permission, IGNORED, requesting_origin); | 313 RecordPermissionAction(permission, IGNORED, requesting_origin); |
| 330 } | 314 } |
| OLD | NEW |