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 CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ |
6 #define CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "content/public/common/permission_status.mojom.h" | 9 #include "content/public/common/permission_status.mojom.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 // CancelPermissionRequest). This can be kNoPendingOperation if | 33 // CancelPermissionRequest). This can be kNoPendingOperation if |
34 // there is no further need to cancel the permission in which case |callback| | 34 // there is no further need to cancel the permission in which case |callback| |
35 // was invoked. | 35 // was invoked. |
36 virtual int RequestPermission( | 36 virtual int RequestPermission( |
37 PermissionType permission, | 37 PermissionType permission, |
38 RenderFrameHost* render_frame_host, | 38 RenderFrameHost* render_frame_host, |
39 const GURL& requesting_origin, | 39 const GURL& requesting_origin, |
40 bool user_gesture, | 40 bool user_gesture, |
41 const base::Callback<void(PermissionStatus)>& callback) = 0; | 41 const base::Callback<void(PermissionStatus)>& callback) = 0; |
42 | 42 |
43 // Cancels a previously requested permission. The given parameter must match | 43 // Requests multiple permissions on behalf of a frame identified by |
44 // the ones passed to the RequestPermission call. | 44 // render_frame_host. |
45 virtual void CancelPermissionRequest(PermissionType permission, | 45 // When the permission request is handled, whether it failed, timed out or |
46 RenderFrameHost* render_frame_host, | 46 // succeeded, the |callback| will be run. The order of statuses in the |
47 int request_id, | 47 // returned vector will correspond to the order of requested permission |
48 const GURL& requesting_origin) = 0; | 48 // types. |
| 49 // Returns a request id which can be used to cancel the request (see |
| 50 // CancelPermissionRequest). This can be kNoPendingOperation if |
| 51 // there is no further need to cancel the permission in which case |callback| |
| 52 // was invoked. |
| 53 virtual int RequestPermissions( |
| 54 const std::vector<PermissionType>& permission, |
| 55 RenderFrameHost* render_frame_host, |
| 56 const GURL& requesting_origin, |
| 57 bool user_gesture, |
| 58 const base::Callback<void( |
| 59 const std::vector<PermissionStatus>&)>& callback) = 0; |
| 60 |
| 61 // Cancels a previous permission request specified by |request_id|. Cancelling |
| 62 // an already cancelled request or providing the |request_id| |
| 63 // kNoPendingOperation is a no-op. |
| 64 virtual void CancelPermissionRequest(int request_id) = 0; |
49 | 65 |
50 // Returns the permission status of a given requesting_origin/embedding_origin | 66 // Returns the permission status of a given requesting_origin/embedding_origin |
51 // tuple. This is not taking a RenderFrameHost because the call might happen | 67 // tuple. This is not taking a RenderFrameHost because the call might happen |
52 // outside of a frame context. | 68 // outside of a frame context. |
53 virtual PermissionStatus GetPermissionStatus( | 69 virtual PermissionStatus GetPermissionStatus( |
54 PermissionType permission, | 70 PermissionType permission, |
55 const GURL& requesting_origin, | 71 const GURL& requesting_origin, |
56 const GURL& embedding_origin) = 0; | 72 const GURL& embedding_origin) = 0; |
57 | 73 |
58 // Sets the permission back to its default for the requesting_origin/ | 74 // Sets the permission back to its default for the requesting_origin/ |
(...skipping 22 matching lines...) Expand all Loading... |
81 // The |subscription_id| must match the value returned by the | 97 // The |subscription_id| must match the value returned by the |
82 // SubscribePermissionStatusChange call. Unsubscribing | 98 // SubscribePermissionStatusChange call. Unsubscribing |
83 // an already unsubscribed |subscription_id| or providing the | 99 // an already unsubscribed |subscription_id| or providing the |
84 // |subscription_id| kNoPendingOperation is a no-op. | 100 // |subscription_id| kNoPendingOperation is a no-op. |
85 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0; | 101 virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0; |
86 }; | 102 }; |
87 | 103 |
88 } // namespace content | 104 } // namespace content |
89 | 105 |
90 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ | 106 #endif // CONTENT_PUBLIC_BROWSER_PERMISSION_MANAGER_H_ |
OLD | NEW |