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

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

Issue 2403763003: [Mac] Address buggy permission bubble behaviour on dismissal via ESC. (Closed)
Patch Set: Override [cancel] instead of [dealloc] Created 4 years, 2 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 19d67cfc7acbf04645a87a951b6d16143be8b04e..ff56b127627c7b79f158a3494d9ec8d754660010 100644
--- a/chrome/browser/permissions/permission_request_manager.cc
+++ b/chrome/browser/permissions/permission_request_manager.cc
@@ -223,6 +223,12 @@ void PermissionRequestManager::CancelRequest(PermissionRequest* request) {
NOTREACHED(); // Callers should not cancel requests that are not pending.
}
+void PermissionRequestManager::DismissBubble() {
hcarmona 2016/10/10 18:08:19 |Closing| calls |FinalizeBubble| which hides the b
dominickn 2016/10/10 22:55:48 This would work, and I did think of doing that. Th
hcarmona 2016/10/11 14:45:33 Casting to PermissionPrompt::Delegate will let you
+ if (IsBubbleVisible())
+ Closing();
+ HideBubble();
+}
+
void PermissionRequestManager::HideBubble() {
// Disengage from the existing view if there is one.
if (!view_)
@@ -395,8 +401,18 @@ void PermissionRequestManager::TriggerShowBubble() {
}
void PermissionRequestManager::FinalizeBubble() {
- if (view_)
+ if (view_) {
view_->Hide();
+#if !defined(OS_ANDROID)
+ } else if (web_contents() && !web_contents()->IsBeingDestroyed()) {
+ // Ensure that the view exists. It may have been deleted by HideBubble,
hcarmona 2016/10/10 18:08:19 Good description. However, since your change is fi
dominickn 2016/10/10 22:55:47 Done.
+ // creating a race condition where if AddRequest is called before
+ // DisplayPendingRequests, no prompt will be displayed. See
+ // crbug.com/653498.
+ view_ = view_factory_.Run(web_contents());
+ view_->SetDelegate(this);
+#endif
+ }
std::vector<PermissionRequest*>::iterator requests_iter;
for (requests_iter = requests_.begin();

Powered by Google App Engine
This is Rietveld 408576698