Commit 34e9bb5f authored by mgiuca@chromium.org's avatar mgiuca@chromium.org

Linux: App windows with frame: none now have resize handles.

ChromeNativeAppWindowViews now installs the EasyResizeWindowTargeter
into the content window, not its root window. The root window does not
have a delegate, which means it doesn't handle events on Linux.

BUG=357049
COLLABORATOR=sadrul@chromium.org
TEST=Open Text chrome app. All edges and corners should be draggable to
resize the app.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262965 0039d316-1c4b-4281-b951-d872f2087c98
parent 9389175a
...@@ -332,11 +332,14 @@ void ChromeNativeAppWindowViews::InitializePanelWindow( ...@@ -332,11 +332,14 @@ void ChromeNativeAppWindowViews::InitializePanelWindow(
} }
void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const { void ChromeNativeAppWindowViews::InstallEasyResizeTargeterOnContainer() const {
aura::Window* root_window = widget()->GetNativeWindow()->GetRootWindow(); aura::Window* window = widget()->GetNativeWindow();
gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize, gfx::Insets inset(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
kResizeInsideBoundsSize, kResizeInsideBoundsSize); kResizeInsideBoundsSize, kResizeInsideBoundsSize);
root_window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( // Add the EasyResizeWindowTargeter on the window, not its root window. The
new wm::EasyResizeWindowTargeter(root_window, inset, inset))); // root window does not have a delegate, which is needed to handle the event
// in Linux.
window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
new wm::EasyResizeWindowTargeter(window, inset, inset)));
} }
apps::AppWindowFrameView* apps::AppWindowFrameView*
...@@ -671,7 +674,7 @@ void ChromeNativeAppWindowViews::InitializeWindow( ...@@ -671,7 +674,7 @@ void ChromeNativeAppWindowViews::InitializeWindow(
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY, extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
NULL)); NULL));
#if defined(OS_WIN) #if !defined(OS_CHROMEOS)
if ((IsFrameless() || has_frame_color_) && if ((IsFrameless() || has_frame_color_) &&
chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) != chrome::GetHostDesktopTypeForNativeWindow(widget()->GetNativeWindow()) !=
chrome::HOST_DESKTOP_TYPE_ASH) { chrome::HOST_DESKTOP_TYPE_ASH) {
......
...@@ -187,9 +187,22 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) { ...@@ -187,9 +187,22 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
// The EasyResizeTargeter specifies an inset of 5px within the window. // The EasyResizeTargeter specifies an inset of 5px within the window.
app_window_views()->InstallEasyResizeTargeterOnContainer(); app_window_views()->InstallEasyResizeTargeterOnContainer();
{
// Ensure that the window has an event targeter (there should be an
// EasyResizeWindowTargeter installed).
EXPECT_TRUE(static_cast<ui::EventTarget*>(window)->GetEventTargeter());
}
{ {
// An event in the center of the window should always have // An event in the center of the window should always have
// |window| as its target. // |window| as its target.
// TODO(mgiuca): This isn't really testing anything (note that it has the
// same expectation as the border case below). In the real environment, the
// target will actually be the RenderWidgetHostViewAura's window that is the
// child of the child of |window|, whereas in the border case it *will* be
// |window|. However, since this test environment does not have a
// RenderWidgetHostViewAura, we cannot differentiate the two cases. Fix
// the test environment so that the test can assert that non-border events
// bubble down to a child of |window|.
ui::MouseEvent move(ui::ET_MOUSE_MOVED, ui::MouseEvent move(ui::ET_MOUSE_MOVED,
gfx::Point(80, 80), gfx::Point(80, 80), gfx::Point(80, 80), gfx::Point(80, 80),
ui::EF_NONE, ui::EF_NONE); ui::EF_NONE, ui::EF_NONE);
...@@ -201,13 +214,13 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) { ...@@ -201,13 +214,13 @@ TEST_F(ShapedAppWindowTargeterTest, ResizeInsetsWithinBounds) {
{ {
// With an EasyResizeTargeter on the container, an event // With an EasyResizeTargeter on the container, an event
// inside the window and within 5px of an edge should have // inside the window and within 5px of an edge should have
// root_window() as its target. // |window| as its target.
ui::MouseEvent move(ui::ET_MOUSE_MOVED, ui::MouseEvent move(ui::ET_MOUSE_MOVED,
gfx::Point(32, 37), gfx::Point(32, 37), gfx::Point(32, 37), gfx::Point(32, 37),
ui::EF_NONE, ui::EF_NONE); ui::EF_NONE, ui::EF_NONE);
ui::EventDispatchDetails details = ui::EventDispatchDetails details =
event_processor()->OnEventFromSource(&move); event_processor()->OnEventFromSource(&move);
ASSERT_FALSE(details.dispatcher_destroyed); ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(root_window(), move.target()); EXPECT_EQ(window, move.target());
} }
} }
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