OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UTIL_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/content_settings/core/common/content_settings.h" | 11 #include "components/content_settings/core/common/content_settings.h" |
12 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 enum class PermissionType; | 18 enum class PermissionType; |
19 } // namespace content | 19 } // namespace content |
20 | 20 |
21 enum class PermissionSourceUI; | 21 enum class PermissionSourceUI; |
22 | 22 |
| 23 // This enum backs a UMA histogram, so it must be treated as append-only. |
| 24 enum PermissionAction { |
| 25 GRANTED = 0, |
| 26 DENIED = 1, |
| 27 DISMISSED = 2, |
| 28 IGNORED = 3, |
| 29 REVOKED = 4, |
| 30 REENABLED = 5, |
| 31 REQUESTED = 6, |
| 32 |
| 33 // Always keep this at the end. |
| 34 PERMISSION_ACTION_NUM, |
| 35 }; |
| 36 |
23 struct PermissionTypeHash { | 37 struct PermissionTypeHash { |
24 std::size_t operator()(const content::PermissionType& type) const; | 38 std::size_t operator()(const content::PermissionType& type) const; |
25 }; | 39 }; |
26 | 40 |
27 // A utility class for permissions. | 41 // A utility class for permissions. |
28 class PermissionUtil { | 42 class PermissionUtil { |
29 public: | 43 public: |
30 // Returns the permission string for the given PermissionType. | 44 // Returns the permission string for the given PermissionType. |
31 static std::string GetPermissionString(content::PermissionType permission); | 45 static std::string GetPermissionString(content::PermissionType permission); |
32 | 46 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ContentSettingsType content_type_; | 79 ContentSettingsType content_type_; |
66 PermissionSourceUI source_ui_; | 80 PermissionSourceUI source_ui_; |
67 bool is_initially_allowed_; | 81 bool is_initially_allowed_; |
68 }; | 82 }; |
69 | 83 |
70 private: | 84 private: |
71 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 85 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
72 }; | 86 }; |
73 | 87 |
74 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 88 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
OLD | NEW |