Index: content/public/browser/permission_manager.h |
diff --git a/content/public/browser/permission_manager.h b/content/public/browser/permission_manager.h |
index 5a2e078718dab32004594a0166f442b26335da50..55ac893bb66950ad2b11de6fc61e6008d262686c 100644 |
--- a/content/public/browser/permission_manager.h |
+++ b/content/public/browser/permission_manager.h |
@@ -21,25 +21,25 @@ class CONTENT_EXPORT PermissionManager { |
public: |
virtual ~PermissionManager() = default; |
- // Requests a permission on behalf of a frame identified by render_frame_host. |
- // The |request_id| is an identifier that can later be used if the request is |
- // cancelled (see CancelPermissionRequest). |
+ // Requests a permission on behalf of a frame identified by |
+ // render_frame_host. |
// When the permission request is handled, whether it failed, timed out or |
// succeeded, the |callback| will be run. |
- virtual void RequestPermission( |
+ // Returns a request id which can be used to cancel the permission (see |
+ // CancelPermissionRequest). This can be kNoPendingRequestOrSubscription if |
+ // there is no further need to cancel the permission in which case |callback| |
+ // was invoked. |
+ virtual int RequestPermission( |
PermissionType permission, |
RenderFrameHost* render_frame_host, |
- int request_id, |
const GURL& requesting_origin, |
bool user_gesture, |
const base::Callback<void(PermissionStatus)>& callback) = 0; |
- // Cancels a previously requested permission. The given parameter must match |
- // the ones passed to the RequestPermission call. |
- virtual void CancelPermissionRequest(PermissionType permission, |
- RenderFrameHost* render_frame_host, |
- int request_id, |
- const GURL& requesting_origin) = 0; |
+ // Cancels a previous permission request specified by |request_id|. Cancelling |
+ // an already cancelled request or providing the |request_id| |
+ // kNoPendingRequestOrSubscription is a no-op. |
+ virtual void CancelPermissionRequest(int request_id) = 0; |
// Returns the permission status of a given requesting_origin/embedding_origin |
// tuple. This is not taking a RenderFrameHost because the call might happen |
@@ -63,7 +63,8 @@ class CONTENT_EXPORT PermissionManager { |
// Runs the given |callback| whenever the |permission| associated with the |
// pair { requesting_origin, embedding_origin } changes. |
- // Returns the subscription_id to be used to unsubscribe. |
+ // Returns the subscription_id to be used to unsubscribe. Can be |
+ // kNoPendingRequestOrSubscription if the subscribe was not successful. |
virtual int SubscribePermissionStatusChange( |
PermissionType permission, |
const GURL& requesting_origin, |
@@ -72,8 +73,14 @@ class CONTENT_EXPORT PermissionManager { |
// Unregisters from permission status change notifications. |
// The |subscription_id| must match the value returned by the |
- // SubscribePermissionStatusChange call. |
+ // SubscribePermissionStatusChange call. Unsubscribing |
+ // an already unsubscribed |subscription_id| or providing the |
+ // |subscription_id| kNoPendingRequestOrSubscription is a no-op. |
virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0; |
+ |
+ // Constant retured when registering and subscribing if |
+ // cancelling/unsubscribing at a later stage would have no effect. |
+ static const int kNoPendingRequestOrSubscription = -1; |
mlamouri (slow - plz ping)
2015/09/23 14:46:00
Good point, the exception was for enums. Though, I
Lalit Maganti
2015/09/23 15:24:31
Done.
|
}; |
} // namespace content |