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

Issue 2403763003: [Mac] Address buggy permission bubble behaviour on dismissal via ESC. (Closed)

Created:
4 years, 2 months ago by dominickn
Modified:
4 years, 1 month ago
CC:
chromium-reviews, mlamouri+watch-permissions_chromium.org, tapted, chrome-apps-syd-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Mac] Address buggy permission bubble behaviour on dismissal via ESC. On Mac, triggering a permission prompt, dismissing it by pressing ESC *twice*, then refreshing the page and triggering the prompt again results in no prompt being displayed until the tab is switched away and back. Pressing ESC *once* works as expected. This happens because pressing the ESC key with the browser window focused results in the PermissionRequestManager hiding all permission bubbles, which has the side-effect of destroying the prompt UI surface. The next prompt triggered then has no surface to be displayed on, delaying its display until DisplayPendingRequests is called and the surface is recreated (e.g. when switching tabs). This CL fixes the problem by making the PermissionRequestManager dismiss any open permission bubble, rather than hide them. This does not destroy the prompt UI surface. Additionally, pressing ESC on Mac does not properly dismiss a permission prompt, i.e. the PermissionDecided callback is *not* run when a bubble is dismissed with the keyboard, and the site is not informed of the denied permission. This CL also addresses that issue by overriding PermissionBubbleController::cancel to call PermissionRequestManager::Closing(), and adding a new method called by the Mac BrowserWindowController that also calls Closing(). This ensures that old requests are always cleared when the bubble is hidden (otherwise they will remain in the queue). BUG=385088, 653497, 653498 TEST=Visit a page which displays a permission bubble. Dismiss the bubble by pressing ESC. Ensure that the permission denied callback is run. Press ESC a second time. Refresh the page and ensure the permission prompt can be seen. TEST=Visit a page which displays a permission bubble. Click on the page (not on the bubble) to change focus. Press ESC and ensure the bubble is dismissed. Ensure that the permission denied callback is run. Refresh the page and ensure the permission prompt can be seen. Committed: https://crrev.com/3fe468bfc1f6180bacebb8fcc0cbf9effc9394ab Cr-Commit-Position: refs/heads/master@{#431096}

Patch Set 1 #

Patch Set 2 : Move DCHECKs to fix tests #

Patch Set 3 : Fix more tests #

Patch Set 4 : Override [cancel] instead of [dealloc] #

Total comments: 14

Patch Set 5 : Address comments #

Total comments: 5

Patch Set 6 : Comments #

Total comments: 5

Patch Set 7 : Use Closing #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -11 lines) Patch
M chrome/browser/permissions/permission_request_manager.h View 1 2 3 4 5 6 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/ui/cocoa/browser_window_controller.mm View 1 2 3 4 5 6 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.mm View 1 2 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm View 1 2 3 4 5 6 2 chunks +10 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/website_settings/permission_prompt_impl.cc View 1 2 3 4 5 6 3 chunks +7 lines, -4 lines 0 comments Download

Messages

Total messages: 73 (46 generated)
dominickn
Hi felt, groby! felt: PTAL at permissions/ and website_settings. groby: PTAL at cocoa. This CL ...
4 years, 2 months ago (2016-10-10 12:01:48 UTC) #29
groby-ooo-7-16
On 2016/10/10 12:01:48, dominickn wrote: > Hi felt, groby! > > felt: PTAL at permissions/ ...
4 years, 2 months ago (2016-10-10 14:37:55 UTC) #32
hcarmona
https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc#newcode226 chrome/browser/permissions/permission_request_manager.cc:226: void PermissionRequestManager::DismissBubble() { |Closing| calls |FinalizeBubble| which hides the ...
4 years, 2 months ago (2016-10-10 18:08:19 UTC) #33
felt
wow this is quite an interesting bug!
4 years, 2 months ago (2016-10-10 18:18:59 UTC) #34
felt
https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h File chrome/browser/permissions/permission_request_manager.h (right): https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h#newcode80 chrome/browser/permissions/permission_request_manager.h:80: void HideBubble(); Do we *ever* want this behavior? Should ...
4 years, 2 months ago (2016-10-10 18:21:00 UTC) #35
hcarmona
https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h File chrome/browser/permissions/permission_request_manager.h (right): https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h#newcode80 chrome/browser/permissions/permission_request_manager.h:80: void HideBubble(); On 2016/10/10 18:21:00, felt wrote: > Do ...
4 years, 2 months ago (2016-10-10 18:28:51 UTC) #36
groby-ooo-7-16
On 2016/10/10 18:28:51, Hector Carmona wrote: > https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h > File chrome/browser/permissions/permission_request_manager.h (right): > > https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.h#newcode80 ...
4 years, 2 months ago (2016-10-10 18:58:10 UTC) #37
dominickn
Thanks everyone! https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc#newcode226 chrome/browser/permissions/permission_request_manager.cc:226: void PermissionRequestManager::DismissBubble() { On 2016/10/10 18:08:19, Hector ...
4 years, 2 months ago (2016-10-10 22:55:48 UTC) #40
hcarmona
https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/80001/chrome/browser/permissions/permission_request_manager.cc#newcode226 chrome/browser/permissions/permission_request_manager.cc:226: void PermissionRequestManager::DismissBubble() { On 2016/10/10 22:55:48, dominickn wrote: > ...
4 years, 2 months ago (2016-10-11 14:45:33 UTC) #43
dominickn
felt, groby: Ping. :) I've thought a little about tests for this. Currently, it doesn't ...
4 years, 2 months ago (2016-10-17 05:34:34 UTC) #44
dominickn
-felt for raymes. groby: ping, this has been sitting around for quite a while now.... ...
4 years, 1 month ago (2016-10-25 04:48:06 UTC) #46
groby-ooo-7-16
On 2016/10/25 04:48:06, dominickn wrote: > -felt for raymes. > > groby: ping, this has ...
4 years, 1 month ago (2016-10-25 19:23:35 UTC) #47
raymes
https://codereview.chromium.org/2403763003/diff/100001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/100001/chrome/browser/permissions/permission_request_manager.cc#newcode229 chrome/browser/permissions/permission_request_manager.cc:229: HideBubble(); Could we just remove HideBubble here and then ...
4 years, 1 month ago (2016-10-26 04:59:11 UTC) #48
dominickn
groby: I wrote about tests a few comments ago. In discussion with raymes@, we couldn't ...
4 years, 1 month ago (2016-10-26 05:54:23 UTC) #49
raymes
lgtm It's unclear to me why on Mac we manually need to handle the dismissPermissionBubble ...
4 years, 1 month ago (2016-10-27 01:42:57 UTC) #50
raymes
A few thoughts after I hit the button that would avoid needing to add that ...
4 years, 1 month ago (2016-10-27 01:47:52 UTC) #51
dominickn
https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc#newcode227 chrome/browser/permissions/permission_request_manager.cc:227: if (IsBubbleVisible()) On 2016/10/27 01:47:52, raymes wrote: > Do ...
4 years, 1 month ago (2016-10-27 02:09:02 UTC) #52
raymes
https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc File chrome/browser/permissions/permission_request_manager.cc (right): https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc#newcode227 chrome/browser/permissions/permission_request_manager.cc:227: if (IsBubbleVisible()) On 2016/10/27 02:09:02, dominickn wrote: > On ...
4 years, 1 month ago (2016-10-27 02:26:39 UTC) #56
dominickn
On 2016/10/27 02:26:39, raymes wrote: > https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc > File chrome/browser/permissions/permission_request_manager.cc (right): > > https://codereview.chromium.org/2403763003/diff/120001/chrome/browser/permissions/permission_request_manager.cc#newcode227 > ...
4 years, 1 month ago (2016-10-27 02:37:59 UTC) #57
raymes
Thanks Dom. lgtm
4 years, 1 month ago (2016-10-27 04:27:15 UTC) #60
hcarmona
LGTM, in case you are waiting to hear from me. (I'm not OWNER, so you ...
4 years, 1 month ago (2016-10-28 14:42:15 UTC) #61
dominickn
groby: Ping. What are your thoughts on my explanations regarding the tests?
4 years, 1 month ago (2016-11-02 06:20:36 UTC) #62
groby-ooo-7-16
I think it makes sense to move the tests into a separate project, but we ...
4 years, 1 month ago (2016-11-09 23:06:42 UTC) #63
dominickn
On 2016/11/09 23:06:42, groby wrote: > I think it makes sense to move the tests ...
4 years, 1 month ago (2016-11-09 23:42:32 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2403763003/140001
4 years, 1 month ago (2016-11-10 00:16:24 UTC) #70
commit-bot: I haz the power
Committed patchset #7 (id:140001)
4 years, 1 month ago (2016-11-10 00:28:48 UTC) #71
commit-bot: I haz the power
4 years, 1 month ago (2016-11-10 00:38:17 UTC) #73
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/3fe468bfc1f6180bacebb8fcc0cbf9effc9394ab
Cr-Commit-Position: refs/heads/master@{#431096}

Powered by Google App Engine
This is Rietveld 408576698