| 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 | 13 |
| 14 class GURL; | 14 class GURL; |
| 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 struct PermissionTypeHash { |
| 22 std::size_t operator()(const content::PermissionType& type) const; |
| 23 }; |
| 24 |
| 21 // A utility class for permissions. | 25 // A utility class for permissions. |
| 22 class PermissionUtil { | 26 class PermissionUtil { |
| 23 public: | 27 public: |
| 24 // Returns the permission string for the given PermissionType. | 28 // Returns the permission string for the given PermissionType. |
| 25 static std::string GetPermissionString(content::PermissionType permission); | 29 static std::string GetPermissionString(content::PermissionType permission); |
| 26 | 30 |
| 27 // Limited conversion of ContentSettingsType to PermissionType. Intended for | 31 // Limited conversion of ContentSettingsType to PermissionType. Intended for |
| 28 // recording Permission UMA metrics from areas of the codebase which have not | 32 // recording Permission UMA metrics from areas of the codebase which have not |
| 29 // yet been converted to PermissionType. Returns true if the conversion was | 33 // yet been converted to PermissionType. Returns true if the conversion was |
| 30 // performed. | 34 // performed. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 48 const GURL& secondary_url, | 52 const GURL& secondary_url, |
| 49 ContentSettingsType content_type, | 53 ContentSettingsType content_type, |
| 50 std::string resource_identifier, | 54 std::string resource_identifier, |
| 51 ContentSetting setting); | 55 ContentSetting setting); |
| 52 | 56 |
| 53 private: | 57 private: |
| 54 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); | 58 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUtil); |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ | 61 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_ |
| OLD | NEW |