Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1264)

Unified Diff: content/public/browser/permission_manager.h

Issue 1342833002: permissions: handle request ids for permissions in permission manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a2de15eff95e43848a4164ef9cb6e2e3ff6ae9f3 100644
--- a/content/public/browser/permission_manager.h
+++ b/content/public/browser/permission_manager.h
@@ -21,15 +21,17 @@ 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 kNoPendingOperation 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;
@@ -63,7 +65,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
+ // kNoPendingOperation if the subscribe was not successful.
virtual int SubscribePermissionStatusChange(
PermissionType permission,
const GURL& requesting_origin,
@@ -72,8 +75,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| kNoPendingOperation 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 kNoPendingOperation = -1;
jochen (gone - plz use gerrit) 2015/09/28 17:27:06 static should come before after typedefs/enums and
Lalit Maganti 2015/09/28 17:59:29 Done.
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698