Commit 86d67a63 authored by skuhne@chromium.org's avatar skuhne@chromium.org

Fixing focussing issue when bubble opens


BUG=141493
TEST=unit test


Review URL: https://chromiumcodereview.appspot.com/10825343

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151707 0039d316-1c4b-4281-b951-d872f2087c98
parent de5a036b
......@@ -12,6 +12,7 @@
#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
#include "ui/aura/aura_switches.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
#include "ui/views/controls/button/image_button.h"
......@@ -371,5 +372,30 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftByButton) {
EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
}
// Test that the activation focus does not change when the bubble gets shown.
TEST_F(CustomFrameViewAshTest, MaximizeKeepFocus) {
views::Widget* widget = CreateWidget();
aura::Window* window = widget->GetNativeWindow();
CustomFrameViewAsh* frame = custom_frame_view_ash(widget);
CustomFrameViewAsh::TestApi test(frame);
ash::FrameMaximizeButton* maximize_button = test.maximize_button();
maximize_button->set_bubble_appearance_delay_ms(0);
gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint();
gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100);
aura::test::EventGenerator generator(window->GetRootWindow(), off_pos);
EXPECT_FALSE(maximize_button->maximizer());
EXPECT_TRUE(ash::wm::IsWindowNormal(window));
aura::Window* active = window->GetFocusManager()->GetFocusedWindow();
// Move the mouse cursor over the button to bring up the maximizer bubble.
generator.MoveMouseTo(button_pos);
EXPECT_TRUE(maximize_button->maximizer());
// Check that the focused window is still the same.
EXPECT_EQ(active, window->GetFocusManager()->GetFocusedWindow());
}
} // namespace internal
} // namespace ash
......@@ -223,6 +223,7 @@ class MaximizeBubbleController::Bubble : public views::BubbleDelegateView,
// Overridden from views::BubbleDelegateView.
virtual gfx::Rect GetAnchorRect() OVERRIDE;
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
virtual bool CanActivate() const OVERRIDE { return false; }
// Overridden from views::WidgetDelegateView.
virtual bool HasHitTestMask() const OVERRIDE;
......@@ -410,6 +411,7 @@ MaximizeBubbleController::Bubble::Bubble(
// Note that the returned widget has an observer which points to our
// functions.
bubble_widget_ = views::BubbleDelegateView::CreateBubble(this);
bubble_widget_->set_focus_on_creation(false);
SetAlignment(views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE);
bubble_widget_->non_client_view()->frame_view()->set_background(NULL);
......
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