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" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 DISMISSED = 2, | 28 DISMISSED = 2, |
29 IGNORED = 3, | 29 IGNORED = 3, |
30 REVOKED = 4, | 30 REVOKED = 4, |
31 REENABLED = 5, | 31 REENABLED = 5, |
32 REQUESTED = 6, | 32 REQUESTED = 6, |
33 | 33 |
34 // Always keep this at the end. | 34 // Always keep this at the end. |
35 PERMISSION_ACTION_NUM, | 35 PERMISSION_ACTION_NUM, |
36 }; | 36 }; |
37 | 37 |
38 // Identifies the source or reason for a permission status being returned. This | |
39 // enum backs an UMA histogram and must be treated as append-only. | |
40 enum class PermissionStatusSource { | |
41 // The reason for the status is not specified. | |
42 UNSPECIFIED, | |
43 | |
44 // The status is the result of being blocked due to the user dismissing a | |
45 // permission prompt multiple times. | |
46 MULTIPLE_DISMISSALS, | |
47 | |
48 // The status is the result of being blocked because the permission is on the | |
49 // safe browsing blacklist. | |
50 SAFE_BROWSING_BLACKLIST, | |
51 | |
52 // The status is the result of being blocked by the permissions kill switch. | |
53 KILL_SWITCH, | |
54 | |
55 // Must be kept last. | |
56 NUM | |
raymes
2017/02/22 23:13:50
nit: I don't think this is needed anymore.
dominickn
2017/02/22 23:38:55
Done.
| |
57 }; | |
58 | |
59 struct PermissionResult { | |
60 PermissionResult(ContentSetting content_setting, | |
61 PermissionStatusSource source); | |
62 ~PermissionResult(); | |
63 | |
64 ContentSetting content_setting; | |
65 PermissionStatusSource source; | |
66 }; | |
raymes
2017/02/22 23:13:50
I think it would be good to move these into their
dominickn
2017/02/22 23:38:54
Acknowledged.
| |
67 | |
68 struct PermissionTypeHash { | |
69 std::size_t operator()(const content::PermissionType& type) const; | |
70 }; | |
raymes
2017/02/22 23:13:50
Is this needed?
dominickn
2017/02/22 23:38:55
Odd, looks like whatever used it has been removed.
| |
71 | |
38 // A utility class for permissions. | 72 // A utility class for permissions. |
39 class PermissionUtil { | 73 class PermissionUtil { |
40 public: | 74 public: |
41 // Returns the permission string for the given permission. | 75 // Returns the permission string for the given permission. |
42 static std::string GetPermissionString(ContentSettingsType); | 76 static std::string GetPermissionString(ContentSettingsType); |
43 // TODO(timloh): Remove this content::PermissionType overload when we add MIDI | 77 // TODO(timloh): Remove this content::PermissionType overload when we add MIDI |
44 // to ContentSettingsType. | 78 // to ContentSettingsType. |
45 static std::string GetPermissionString(content::PermissionType); | 79 static std::string GetPermissionString(content::PermissionType); |
46 | 80 |
47 // Return the stringified version of the ContentSettingsType enum that | 81 // Return the stringified version of the ContentSettingsType enum that |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
92 ContentSettingsType content_type_; | 126 ContentSettingsType content_type_; |
93 PermissionSourceUI source_ui_; | 127 PermissionSourceUI source_ui_; |
94 bool is_initially_allowed_; | 128 bool is_initially_allowed_; |
95 }; | 129 }; |
96 | 130 |
97 private: | 131 private: |
98 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 132 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
99 }; | 133 }; |
100 | 134 |
101 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 135 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
OLD | NEW |