| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/workspace_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/display_manager_test_api.h" | 14 #include "ash/test/display_manager_test_api.h" |
| 15 #include "ash/wm/aura/wm_window_aura.h" |
| 15 #include "ash/wm/common/window_positioning_utils.h" | 16 #include "ash/wm/common/window_positioning_utils.h" |
| 16 #include "ash/wm/common/wm_event.h" | 17 #include "ash/wm/common/wm_event.h" |
| 17 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
| 18 #include "ash/wm/window_state_aura.h" | 19 #include "ash/wm/window_state_aura.h" |
| 19 #include "ash/wm/window_util.h" | 20 #include "ash/wm/window_util.h" |
| 20 #include "ash/wm/workspace/phantom_window_controller.h" | 21 #include "ash/wm/workspace/phantom_window_controller.h" |
| 21 #include "ash/wm/workspace_controller.h" | 22 #include "ash/wm/workspace_controller.h" |
| 22 #include "base/command_line.h" | 23 #include "base/command_line.h" |
| 23 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 return result; | 140 return result; |
| 140 } | 141 } |
| 141 | 142 |
| 142 protected: | 143 protected: |
| 143 WindowResizer* CreateResizerForTest( | 144 WindowResizer* CreateResizerForTest( |
| 144 aura::Window* window, | 145 aura::Window* window, |
| 145 const gfx::Point& point_in_parent, | 146 const gfx::Point& point_in_parent, |
| 146 int window_component) { | 147 int window_component) { |
| 147 WindowResizer* resizer = CreateWindowResizer( | 148 WindowResizer* resizer = |
| 148 window, | 149 CreateWindowResizer(wm::WmWindowAura::Get(window), point_in_parent, |
| 149 point_in_parent, | 150 window_component, |
| 150 window_component, | 151 aura::client::WINDOW_MOVE_SOURCE_MOUSE) |
| 151 aura::client::WINDOW_MOVE_SOURCE_MOUSE).release(); | 152 .release(); |
| 152 workspace_resizer_ = WorkspaceWindowResizer::GetInstanceForTest(); | 153 workspace_resizer_ = WorkspaceWindowResizer::GetInstanceForTest(); |
| 153 return resizer; | 154 return resizer; |
| 154 } | 155 } |
| 155 WorkspaceWindowResizer* CreateWorkspaceResizerForTest( | 156 WorkspaceWindowResizer* CreateWorkspaceResizerForTest( |
| 156 aura::Window* window, | 157 aura::Window* window, |
| 157 const gfx::Point& point_in_parent, | 158 const gfx::Point& point_in_parent, |
| 158 int window_component, | 159 int window_component, |
| 159 aura::client::WindowMoveSource source, | 160 aura::client::WindowMoveSource source, |
| 160 const std::vector<aura::Window*>& attached_windows) { | 161 const std::vector<aura::Window*>& attached_windows) { |
| 161 wm::WindowState* window_state = wm::GetWindowState(window); | 162 wm::WindowState* window_state = wm::GetWindowState(window); |
| 162 window_state->CreateDragDetails(point_in_parent, window_component, source); | 163 window_state->CreateDragDetails(point_in_parent, window_component, source); |
| 163 return WorkspaceWindowResizer::Create(window_state, attached_windows); | 164 return WorkspaceWindowResizer::Create( |
| 165 window_state, wm::WmWindowAura::FromAuraWindows(attached_windows)); |
| 164 } | 166 } |
| 165 | 167 |
| 166 PhantomWindowController* snap_phantom_window_controller() const { | 168 PhantomWindowController* snap_phantom_window_controller() const { |
| 167 return workspace_resizer_->snap_phantom_window_controller_.get(); | 169 return workspace_resizer_->snap_phantom_window_controller_.get(); |
| 168 } | 170 } |
| 169 | 171 |
| 170 gfx::Point CalculateDragPoint(const WindowResizer& resizer, | 172 gfx::Point CalculateDragPoint(const WindowResizer& resizer, |
| 171 int delta_x, | 173 int delta_x, |
| 172 int delta_y) const { | 174 int delta_y) const { |
| 173 gfx::Point location = resizer.GetInitialLocation(); | 175 gfx::Point location = resizer.GetInitialLocation(); |
| (...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 // Drag even more to snap to the edge. | 1888 // Drag even more to snap to the edge. |
| 1887 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), | 1889 generator.GestureScrollSequence(gfx::Point(400, kRootHeight - 40), |
| 1888 gfx::Point(400, kRootHeight - 25), | 1890 gfx::Point(400, kRootHeight - 25), |
| 1889 base::TimeDelta::FromMilliseconds(10), | 1891 base::TimeDelta::FromMilliseconds(10), |
| 1890 5); | 1892 5); |
| 1891 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), | 1893 EXPECT_EQ(gfx::Rect(100, 100, 600, kRootHeight - 100).ToString(), |
| 1892 touch_resize_window_->bounds().ToString()); | 1894 touch_resize_window_->bounds().ToString()); |
| 1893 } | 1895 } |
| 1894 | 1896 |
| 1895 } // namespace ash | 1897 } // namespace ash |
| OLD | NEW |