| 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 22 matching lines...) Expand all Loading... |
| 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 // A utility class for permissions. | 38 // A utility class for permissions. |
| 39 class PermissionUtil { | 39 class PermissionUtil { |
| 40 public: | 40 public: |
| 41 // Returns the permission string for the given permission. | 41 // Returns the permission string for the given permission. |
| 42 static std::string GetPermissionString(ContentSettingsType); | 42 static std::string GetPermissionString(ContentSettingsType); |
| 43 // TODO(timloh): Remove this content::PermissionType overload when we add MIDI | |
| 44 // to ContentSettingsType. | |
| 45 static std::string GetPermissionString(content::PermissionType); | |
| 46 | 43 |
| 47 // Return the stringified version of the ContentSettingsType enum that | 44 // Return the stringified version of the ContentSettingsType enum that |
| 48 // Safe Browsing uses for the API Blacklist. | 45 // Safe Browsing uses for the API Blacklist. |
| 49 static std::string ConvertContentSettingsTypeToSafeBrowsingName( | 46 static std::string ConvertContentSettingsTypeToSafeBrowsingName( |
| 50 ContentSettingsType permission); | 47 ContentSettingsType permission); |
| 51 | 48 |
| 52 // Returns the request type corresponding to a permission type. | 49 // Returns the request type corresponding to a permission type. |
| 53 static PermissionRequestType GetRequestType(ContentSettingsType permission); | 50 static PermissionRequestType GetRequestType(ContentSettingsType permission); |
| 54 | 51 |
| 55 // Returns the gesture type corresponding to whether a permission request is | 52 // Returns the gesture type corresponding to whether a permission request is |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ContentSettingsType content_type_; | 89 ContentSettingsType content_type_; |
| 93 PermissionSourceUI source_ui_; | 90 PermissionSourceUI source_ui_; |
| 94 bool is_initially_allowed_; | 91 bool is_initially_allowed_; |
| 95 }; | 92 }; |
| 96 | 93 |
| 97 private: | 94 private: |
| 98 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 95 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
| 99 }; | 96 }; |
| 100 | 97 |
| 101 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 98 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
| OLD | NEW |