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

Unified Diff: chrome/browser/ui/permission_bubble/permission_prompt.h

Issue 2829023002: Fix cancelling permission requests on Android when the PermissionRequestManager is enabled (Closed)
Patch Set: comment Created 3 years, 8 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: chrome/browser/ui/permission_bubble/permission_prompt.h
diff --git a/chrome/browser/ui/permission_bubble/permission_prompt.h b/chrome/browser/ui/permission_bubble/permission_prompt.h
index db7cf2abb492b510f66b72ac728c35374eb8a230..d38b5d31c9c584da6246b1207fb253fae98b5d3d 100644
--- a/chrome/browser/ui/permission_bubble/permission_prompt.h
+++ b/chrome/browser/ui/permission_bubble/permission_prompt.h
@@ -48,19 +48,18 @@ class PermissionPrompt {
// Sets the delegate which will receive UI events forwarded from the prompt.
virtual void SetDelegate(Delegate* delegate) = 0;
- // Causes the request UI to show up with the given contents. This method may
- // be called with mostly-identical contents to the existing contents. This can
- // happen, for instance, if a new permission is requested and
- // CanAcceptRequestUpdate() is true.
- // Important: the view must not store any of the request objects it receives
- // in this call.
+ // Causes the request UI to show up with the given contents. This is only
+ // called when !IsVisible(), except when called after MaybeCancelRequest().
virtual void Show(const std::vector<PermissionRequest*>& requests,
const std::vector<bool>& accept_state) = 0;
- // Returns true if the view can accept a new Show() command to coalesce
- // requests. Currently the policy is that this should return true if the view
- // is being shown and the mouse is not over the view area (!IsMouseHovered).
- virtual bool CanAcceptRequestUpdate() = 0;
+ // Try to cancel (i.e. hide and don't run callbacks) the current request and
+ // return whether it was cancelled. Currently the policy is that this should
+ // fail if the view is being shown and the mouse is not over the view area
+ // (!IsMouseHovered). This invalidates request objects from the last Show()
+ // call, so if the cancel failed, Show() will be called with the cancelled
+ // requests replaced with dummy PermissionRequest objects.
+ virtual bool MaybeCancelRequest() = 0;
// Returns true if the prompt UI will manage hiding itself when the user
// resolves the prompt, on page navigation/destruction, and on tab switching.

Powered by Google App Engine
This is Rietveld 408576698