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