| 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 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 class Profile; | 12 class Profile; |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 enum class PermissionType; | 15 enum class PermissionType; |
| 16 } // namespace content | 16 } // namespace content |
| 17 | 17 |
| 18 // Enum for UMA purposes, make sure you update histograms.xml if you add new |
| 19 // permission actions. Never delete or reorder an entry; only add new entries |
| 20 // immediately before PERMISSION_NUM |
| 21 enum PermissionAction { |
| 22 GRANTED = 0, |
| 23 DENIED = 1, |
| 24 DISMISSED = 2, |
| 25 IGNORED = 3, |
| 26 REVOKED = 4, |
| 27 REENABLED = 5, |
| 28 REQUESTED = 6, |
| 29 |
| 30 // Always keep this at the end. |
| 31 PERMISSION_ACTION_NUM, |
| 32 }; |
| 33 |
| 18 // Provides a convenient way of logging UMA for permission related operations. | 34 // Provides a convenient way of logging UMA for permission related operations. |
| 19 class PermissionUmaUtil { | 35 class PermissionUmaUtil { |
| 20 public: | 36 public: |
| 21 static void PermissionRequested(content::PermissionType permission, | 37 static void PermissionRequested(content::PermissionType permission, |
| 22 const GURL& requesting_origin, | 38 const GURL& requesting_origin, |
| 23 const GURL& embedding_origin, | 39 const GURL& embedding_origin, |
| 24 Profile* profile); | 40 Profile* profile); |
| 25 static void PermissionGranted(content::PermissionType permission, | 41 static void PermissionGranted(content::PermissionType permission, |
| 26 const GURL& requesting_origin); | 42 const GURL& requesting_origin); |
| 27 static void PermissionDenied(content::PermissionType permission, | 43 static void PermissionDenied(content::PermissionType permission, |
| 28 const GURL& requesting_origin); | 44 const GURL& requesting_origin); |
| 29 static void PermissionDismissed(content::PermissionType permission, | 45 static void PermissionDismissed(content::PermissionType permission, |
| 30 const GURL& requesting_origin); | 46 const GURL& requesting_origin); |
| 31 static void PermissionIgnored(content::PermissionType permission, | 47 static void PermissionIgnored(content::PermissionType permission, |
| 32 const GURL& requesting_origin); | 48 const GURL& requesting_origin); |
| 33 static void PermissionRevoked(content::PermissionType permission, | 49 static void PermissionRevoked(content::PermissionType permission, |
| 34 const GURL& revoked_origin); | 50 const GURL& revoked_origin); |
| 35 | 51 |
| 36 private: | 52 private: |
| 37 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 53 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 38 }; | 54 }; |
| 39 | 55 |
| 40 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 56 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |