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

Unified Diff: chrome/browser/permissions/permission_request_manager.cc

Issue 2829023002: Fix cancelling permission requests on Android when the PermissionRequestManager is enabled (Closed)
Patch Set: rebase Created 3 years, 7 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/permissions/permission_request_manager.cc
diff --git a/chrome/browser/permissions/permission_request_manager.cc b/chrome/browser/permissions/permission_request_manager.cc
index 51fe1baeb4634a09154be5a89f38abc737956e32..8b6d9760e1d839fd0060f2c5bb561fef02081b4c 100644
--- a/chrome/browser/permissions/permission_request_manager.cc
+++ b/chrome/browser/permissions/permission_request_manager.cc
@@ -179,26 +179,17 @@ void PermissionRequestManager::CancelRequest(PermissionRequest* request) {
continue;
// We can simply erase the current entry in the request table if we aren't
- // showing the dialog, or if we are showing it and it can accept the update.
- bool can_erase = !view_ || view_->CanAcceptRequestUpdate();
- if (can_erase) {
- RequestFinishedIncludingDuplicates(*requests_iter);
+ // showing the dialog, or if we are showing it and it can be cancelled.
+ if (!view_ || view_->MaybeCancelRequest()) {
requests_.erase(requests_iter);
accept_states_.erase(accepts_iter);
-
- if (view_) {
- view_->Hide();
- // Will redraw the bubble if it is being shown.
+ if (view_)
DequeueRequestsAndShowBubble();
- }
- return;
+ } else {
+ // The prompt is still being shown so replace the request with a dummy.
+ *requests_iter = new CancelledRequest(*requests_iter);
}
-
- // Cancel the existing request and replace it with a dummy.
- PermissionRequest* cancelled_request =
- new CancelledRequest(*requests_iter);
- RequestFinishedIncludingDuplicates(*requests_iter);
- *requests_iter = cancelled_request;
+ RequestFinishedIncludingDuplicates(request);
return;
}

Powered by Google App Engine
This is Rietveld 408576698