| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CONTEXT_BASE_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Returns whether the permission has been granted, denied etc. | 83 // Returns whether the permission has been granted, denied etc. |
| 84 // |render_frame_host| may be nullptr if the call is coming from a context | 84 // |render_frame_host| may be nullptr if the call is coming from a context |
| 85 // other than a specific frame. | 85 // other than a specific frame. |
| 86 // TODO(meredithl): Ensure that the result accurately reflects whether the | 86 // TODO(meredithl): Ensure that the result accurately reflects whether the |
| 87 // origin is blacklisted for this permission. | 87 // origin is blacklisted for this permission. |
| 88 PermissionResult GetPermissionStatus( | 88 PermissionResult GetPermissionStatus( |
| 89 content::RenderFrameHost* render_frame_host, | 89 content::RenderFrameHost* render_frame_host, |
| 90 const GURL& requesting_origin, | 90 const GURL& requesting_origin, |
| 91 const GURL& embedding_origin) const; | 91 const GURL& embedding_origin) const; |
| 92 | 92 |
| 93 // Update |result| with any modifications based on the device state. For |
| 94 // example, if |result| is ALLOW but Chrome does not have the relevant |
| 95 // permission at the device level, but will prompt the user, return ASK. |
| 96 virtual PermissionResult UpdatePermissionStatusWithDeviceStatus( |
| 97 PermissionResult result, |
| 98 const GURL& requesting_origin, |
| 99 const GURL& embedding_origin) const; |
| 100 |
| 93 // Resets the permission to its default value. | 101 // Resets the permission to its default value. |
| 94 virtual void ResetPermission(const GURL& requesting_origin, | 102 virtual void ResetPermission(const GURL& requesting_origin, |
| 95 const GURL& embedding_origin); | 103 const GURL& embedding_origin); |
| 96 | 104 |
| 97 // Withdraw an existing permission request, no op if the permission request | 105 // Withdraw an existing permission request, no op if the permission request |
| 98 // was already cancelled by some other means. | 106 // was already cancelled by some other means. |
| 99 virtual void CancelPermissionRequest(content::WebContents* web_contents, | 107 virtual void CancelPermissionRequest(content::WebContents* web_contents, |
| 100 const PermissionRequestID& id); | 108 const PermissionRequestID& id); |
| 101 | 109 |
| 102 // Whether the kill switch has been enabled for this permission. | 110 // Whether the kill switch has been enabled for this permission. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 #endif | 201 #endif |
| 194 std::unordered_map<std::string, std::unique_ptr<PermissionRequest>> | 202 std::unordered_map<std::string, std::unique_ptr<PermissionRequest>> |
| 195 pending_requests_; | 203 pending_requests_; |
| 196 | 204 |
| 197 // Must be the last member, to ensure that it will be | 205 // Must be the last member, to ensure that it will be |
| 198 // destroyed first, which will invalidate weak pointers | 206 // destroyed first, which will invalidate weak pointers |
| 199 base::WeakPtrFactory<PermissionContextBase> weak_factory_; | 207 base::WeakPtrFactory<PermissionContextBase> weak_factory_; |
| 200 }; | 208 }; |
| 201 | 209 |
| 202 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ | 210 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ |
| OLD | NEW |