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 27 matching lines...) Expand all Loading... |
38 struct PermissionTypeHash { | 38 struct PermissionTypeHash { |
39 std::size_t operator()(const content::PermissionType& type) const; | 39 std::size_t operator()(const content::PermissionType& type) const; |
40 }; | 40 }; |
41 | 41 |
42 // A utility class for permissions. | 42 // A utility class for permissions. |
43 class PermissionUtil { | 43 class PermissionUtil { |
44 public: | 44 public: |
45 // Returns the permission string for the given PermissionType. | 45 // Returns the permission string for the given PermissionType. |
46 static std::string GetPermissionString(content::PermissionType permission); | 46 static std::string GetPermissionString(content::PermissionType permission); |
47 | 47 |
| 48 // Return the stringified version of the PermissionType enum that Safe |
| 49 // Browsing uses for the API Blacklist. |
| 50 static std::string ConvertPermissionTypeToSafeBrowsingName( |
| 51 const content::PermissionType& permission_type); |
| 52 |
48 // Returns the request type corresponding to a permission type. | 53 // Returns the request type corresponding to a permission type. |
49 static PermissionRequestType GetRequestType(content::PermissionType type); | 54 static PermissionRequestType GetRequestType(content::PermissionType type); |
50 | 55 |
51 // Returns the gesture type corresponding to whether a permission request is | 56 // Returns the gesture type corresponding to whether a permission request is |
52 // made with or without a user gesture. | 57 // made with or without a user gesture. |
53 static PermissionRequestGestureType GetGestureType(bool user_gesture); | 58 static PermissionRequestGestureType GetGestureType(bool user_gesture); |
54 | 59 |
55 // Limited conversion of ContentSettingsType to PermissionType. Intended for | 60 // Limited conversion of ContentSettingsType to PermissionType. Intended for |
56 // recording Permission UMA metrics from areas of the codebase which have not | 61 // recording Permission UMA metrics from areas of the codebase which have not |
57 // yet been converted to PermissionType. Returns true if the conversion was | 62 // yet been converted to PermissionType. Returns true if the conversion was |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ContentSettingsType content_type_; | 94 ContentSettingsType content_type_; |
90 PermissionSourceUI source_ui_; | 95 PermissionSourceUI source_ui_; |
91 bool is_initially_allowed_; | 96 bool is_initially_allowed_; |
92 }; | 97 }; |
93 | 98 |
94 private: | 99 private: |
95 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 100 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
96 }; | 101 }; |
97 | 102 |
98 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 103 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
OLD | NEW |