Commit e81aba4d authored by vasilii@chromium.org's avatar vasilii@chromium.org

Password bubble: Don't focus by default.

This is the duplicate of https://codereview.chromium.org/373043003. The bubble turned to be unresponsive on Windows. This CL has a workaround. The original problem is in infrastructure. It's to be fixed in  BubbleDelegateView.
set_use_focusless(true) has adverse effect on Windows.
1) The bubble can't be the active window (which is not desired behavior).
2) The bubble doesn't get WM_LBUTTONDOWN event. Therefore, all the buttons get stuck.
We call set_use_focusless(false) after the bubble is shown. Thus, it can get focus and mouse events properly.

BUG=383821

Review URL: https://codereview.chromium.org/396973002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283548 0039d316-1c4b-4281-b951-d872f2087c98
parent 57946f21
......@@ -433,6 +433,11 @@ void ManagePasswordsBubbleView::BlacklistedView::ButtonPressed(
ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ =
NULL;
// static
const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() {
return ManagePasswordsBubbleView::manage_passwords_bubble_;
}
// static
void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
DisplayReason reason) {
......@@ -467,6 +472,12 @@ void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
}
manage_passwords_bubble_->GetWidget()->Show();
manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
// set_use_focusless(true) has adverse effect on Windows.
// 1) The bubble can't be the active window (which is not desired behavior).
// 2) The bubble doesn't get WM_LBUTTONDOWN event. Therefore, all the buttons
// get stuck.
// TODO(vasilii): remove this line once the bug in infrastructure is resolved.
manage_passwords_bubble_->set_use_focusless(false);
}
// static
......@@ -494,7 +505,8 @@ ManagePasswordsBubbleView::ManagePasswordsBubbleView(
never_save_passwords_(false) {
// Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
set_notify_enter_exit_on_child(true);
// Don't focus by default.
set_use_focusless(true);
if (anchor_view)
anchor_view->SetActive(true);
}
......
......@@ -138,6 +138,9 @@ class ManagePasswordsBubbleView : public ManagePasswordsBubble,
// Whether the bubble is currently showing.
static bool IsShowing();
// Returns a pointer to the bubble.
static const ManagePasswordsBubbleView* Bubble();
private:
ManagePasswordsBubbleView(content::WebContents* web_contents,
ManagePasswordsIconView* anchor_view,
......
......@@ -80,6 +80,12 @@ IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest,
// Open with pending password: automagical!
SetupPendingPassword();
// Bubble should not be focused by default.
EXPECT_FALSE(
ManagePasswordsBubbleView::Bubble()->GetFocusManager()->GetFocusedView());
// Bubble can be active if user clicks it.
EXPECT_TRUE(ManagePasswordsBubbleView::Bubble()->CanActivate());
scoped_ptr<base::HistogramSamples> samples(
GetSamples(kDisplayDispositionMetric));
EXPECT_EQ(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment