| 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/common/window_resizer.h" | 5 #include "ash/wm/common/window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/wm/common/dock/docked_window_layout_manager.h" | 7 #include "ash/wm/common/dock/docked_window_layout_manager.h" |
| 8 #include "ash/wm/common/root_window_finder.h" | 8 #include "ash/wm/common/root_window_finder.h" |
| 9 #include "ash/wm/common/window_positioning_utils.h" | 9 #include "ash/wm/common/window_positioning_utils.h" |
| 10 #include "ash/wm/common/window_state.h" | 10 #include "ash/wm/common/window_state.h" |
| 11 #include "ash/wm/common/wm_window.h" | 11 #include "ash/wm/common/wm_window.h" |
| 12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
| 13 #include "ui/base/ui_base_types.h" | 13 #include "ui/base/ui_base_types.h" |
| 14 #include "ui/gfx/display.h" | 14 #include "ui/display/display.h" |
| 15 #include "ui/display/screen.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/screen.h" | |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Returns true for resize components along the right edge, where a drag in | 22 // Returns true for resize components along the right edge, where a drag in |
| 23 // positive x will make the window larger. | 23 // positive x will make the window larger. |
| 24 bool IsRightEdge(int window_component) { | 24 bool IsRightEdge(int window_component) { |
| 25 return window_component == HTTOPRIGHT || window_component == HTRIGHT || | 25 return window_component == HTTOPRIGHT || window_component == HTRIGHT || |
| 26 window_component == HTBOTTOMRIGHT || window_component == HTGROWBOX; | 26 window_component == HTBOTTOMRIGHT || window_component == HTGROWBOX; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 // Make sure that |new_bounds| doesn't leave any of the displays. Note that | 185 // Make sure that |new_bounds| doesn't leave any of the displays. Note that |
| 186 // the |work_area| above isn't good for this check since it is the work area | 186 // the |work_area| above isn't good for this check since it is the work area |
| 187 // for the current display but the window can move to a different one. | 187 // for the current display but the window can move to a different one. |
| 188 wm::WmWindow* parent = GetTarget()->GetParent(); | 188 wm::WmWindow* parent = GetTarget()->GetParent(); |
| 189 gfx::Point passed_location_in_screen( | 189 gfx::Point passed_location_in_screen( |
| 190 parent->ConvertPointToScreen(passed_location)); | 190 parent->ConvertPointToScreen(passed_location)); |
| 191 gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size()); | 191 gfx::Rect near_passed_location(passed_location_in_screen, gfx::Size()); |
| 192 // Use a pointer location (matching the logic in DragWindowResizer) to | 192 // Use a pointer location (matching the logic in DragWindowResizer) to |
| 193 // calculate the target display after the drag. | 193 // calculate the target display after the drag. |
| 194 const gfx::Display& display = | 194 const display::Display& display = |
| 195 gfx::Screen::GetScreen()->GetDisplayMatching(near_passed_location); | 195 display::Screen::GetScreen()->GetDisplayMatching(near_passed_location); |
| 196 DockedWindowLayoutManager* dock_layout = DockedWindowLayoutManager::Get( | 196 DockedWindowLayoutManager* dock_layout = DockedWindowLayoutManager::Get( |
| 197 wm::GetRootWindowMatching(near_passed_location)); | 197 wm::GetRootWindowMatching(near_passed_location)); |
| 198 | 198 |
| 199 gfx::Rect screen_work_area = display.work_area(); | 199 gfx::Rect screen_work_area = display.work_area(); |
| 200 screen_work_area.Union(dock_layout->docked_bounds()); | 200 screen_work_area.Union(dock_layout->docked_bounds()); |
| 201 screen_work_area.Inset(wm::kMinimumOnScreenArea, 0); | 201 screen_work_area.Inset(wm::kMinimumOnScreenArea, 0); |
| 202 gfx::Rect new_bounds_in_screen = parent->ConvertRectToScreen(new_bounds); | 202 gfx::Rect new_bounds_in_screen = parent->ConvertRectToScreen(new_bounds); |
| 203 if (!screen_work_area.Intersects(new_bounds_in_screen)) { | 203 if (!screen_work_area.Intersects(new_bounds_in_screen)) { |
| 204 // Make sure that the x origin does not leave the current display. | 204 // Make sure that the x origin does not leave the current display. |
| 205 new_bounds_in_screen.set_x(std::max( | 205 new_bounds_in_screen.set_x(std::max( |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 if (height > max_height) { | 320 if (height > max_height) { |
| 321 height = max_height; | 321 height = max_height; |
| 322 *delta_y = -y_multiplier * | 322 *delta_y = -y_multiplier * |
| 323 (details().initial_bounds_in_parent.height() - max_height); | 323 (details().initial_bounds_in_parent.height() - max_height); |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 return height; | 326 return height; |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace ash | 329 } // namespace ash |
| OLD | NEW |