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

Unified Diff: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc

Issue 2925773002: Permission prompts shouldn't cause browser to be focused (Closed)
Patch Set: upd Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
index 5fc2333873b28c601d5060b02d6c02505ed8d1d2..37470e6fc4eee68dcc66fd23528d462423857677 100644
--- a/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
+++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_impl.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
+#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views.h"
@@ -278,7 +279,15 @@ void PermissionPromptImpl::Show() {
bubble_delegate_->set_anchor_view_insets(gfx::Insets(
GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
- views::BubbleDialogDelegateView::CreateBubble(bubble_delegate_)->Show();
+ views::Widget* widget =
+ views::BubbleDialogDelegateView::CreateBubble(bubble_delegate_);
+ // If a browser window (or popup) other than the bubble parent has focus,
+ // don't take focus.
+ if (browser_->window()->IsActive())
+ widget->Show();
+ else
+ widget->ShowInactive();
+
bubble_delegate_->SizeToContents();
bubble_delegate_->UpdateAnchor(GetAnchorView(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698