| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/wm/drag_window_resizer.h" | 22 #include "ash/wm/drag_window_resizer.h" |
| 23 #include "ash/wm/panels/panel_window_resizer.h" | 23 #include "ash/wm/panels/panel_window_resizer.h" |
| 24 #include "ash/wm/window_state.h" | 24 #include "ash/wm/window_state.h" |
| 25 #include "ash/wm/window_util.h" | 25 #include "ash/wm/window_util.h" |
| 26 #include "ash/wm/workspace/phantom_window_controller.h" | 26 #include "ash/wm/workspace/phantom_window_controller.h" |
| 27 #include "ash/wm/workspace/snap_sizer.h" | 27 #include "ash/wm/workspace/snap_sizer.h" |
| 28 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 29 #include "base/memory/weak_ptr.h" | 29 #include "base/memory/weak_ptr.h" |
| 30 #include "ui/aura/client/aura_constants.h" | 30 #include "ui/aura/client/aura_constants.h" |
| 31 #include "ui/aura/client/screen_position_client.h" | 31 #include "ui/aura/client/screen_position_client.h" |
| 32 #include "ui/aura/client/window_types.h" | |
| 33 #include "ui/aura/root_window.h" | 32 #include "ui/aura/root_window.h" |
| 34 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
| 35 #include "ui/aura/window_delegate.h" | 34 #include "ui/aura/window_delegate.h" |
| 36 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 37 #include "ui/compositor/layer.h" | 36 #include "ui/compositor/layer.h" |
| 38 #include "ui/gfx/screen.h" | 37 #include "ui/gfx/screen.h" |
| 39 #include "ui/gfx/transform.h" | 38 #include "ui/gfx/transform.h" |
| 39 #include "ui/wm/public/window_types.h" |
| 40 | 40 |
| 41 namespace ash { | 41 namespace ash { |
| 42 | 42 |
| 43 scoped_ptr<WindowResizer> CreateWindowResizer( | 43 scoped_ptr<WindowResizer> CreateWindowResizer( |
| 44 aura::Window* window, | 44 aura::Window* window, |
| 45 const gfx::Point& point_in_parent, | 45 const gfx::Point& point_in_parent, |
| 46 int window_component, | 46 int window_component, |
| 47 aura::client::WindowMoveSource source) { | 47 aura::client::WindowMoveSource source) { |
| 48 DCHECK(window); | 48 DCHECK(window); |
| 49 wm::WindowState* window_state = wm::GetWindowState(window); | 49 wm::WindowState* window_state = wm::GetWindowState(window); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 source, | 84 source, |
| 85 std::vector<aura::Window*>()); | 85 std::vector<aura::Window*>()); |
| 86 } else if (window_state->IsNormalShowState()) { | 86 } else if (window_state->IsNormalShowState()) { |
| 87 window_resizer = DefaultWindowResizer::Create( | 87 window_resizer = DefaultWindowResizer::Create( |
| 88 window, point_in_parent, window_component, source); | 88 window, point_in_parent, window_component, source); |
| 89 } | 89 } |
| 90 if (window_resizer) { | 90 if (window_resizer) { |
| 91 window_resizer = internal::DragWindowResizer::Create( | 91 window_resizer = internal::DragWindowResizer::Create( |
| 92 window_resizer, window, point_in_parent, window_component, source); | 92 window_resizer, window, point_in_parent, window_component, source); |
| 93 } | 93 } |
| 94 if (window_resizer && window->type() == aura::client::WINDOW_TYPE_PANEL) { | 94 if (window_resizer && window->type() == ui::wm::WINDOW_TYPE_PANEL) { |
| 95 window_resizer = PanelWindowResizer::Create( | 95 window_resizer = PanelWindowResizer::Create( |
| 96 window_resizer, window, point_in_parent, window_component, source); | 96 window_resizer, window, point_in_parent, window_component, source); |
| 97 } | 97 } |
| 98 if (switches::UseDockedWindows() && | 98 if (switches::UseDockedWindows() && |
| 99 window_resizer && window->parent() && | 99 window_resizer && window->parent() && |
| 100 !window->transient_parent() && | 100 !window->transient_parent() && |
| 101 (window->parent()->id() == internal::kShellWindowId_DefaultContainer || | 101 (window->parent()->id() == internal::kShellWindowId_DefaultContainer || |
| 102 window->parent()->id() == internal::kShellWindowId_DockedContainer || | 102 window->parent()->id() == internal::kShellWindowId_DockedContainer || |
| 103 window->parent()->id() == internal::kShellWindowId_PanelContainer)) { | 103 window->parent()->id() == internal::kShellWindowId_PanelContainer)) { |
| 104 window_resizer = internal::DockedWindowResizer::Create( | 104 window_resizer = internal::DockedWindowResizer::Create( |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) | 436 if (!did_move_or_resize_ || details_.window_component != HTCAPTION) |
| 437 return; | 437 return; |
| 438 | 438 |
| 439 bool snapped = false; | 439 bool snapped = false; |
| 440 // When the window is not in the normal show state, we do not snap the window. | 440 // When the window is not in the normal show state, we do not snap the window. |
| 441 // This happens when the user minimizes or maximizes the window by keyboard | 441 // This happens when the user minimizes or maximizes the window by keyboard |
| 442 // shortcut while dragging it. If the window is the result of dragging a tab | 442 // shortcut while dragging it. If the window is the result of dragging a tab |
| 443 // out of a maximized window, it's already in the normal show state when this | 443 // out of a maximized window, it's already in the normal show state when this |
| 444 // is called, so it does not matter. | 444 // is called, so it does not matter. |
| 445 if (window_state()->IsNormalShowState() && | 445 if (window_state()->IsNormalShowState() && |
| 446 (window()->type() != aura::client::WINDOW_TYPE_PANEL || | 446 (window()->type() != ui::wm::WINDOW_TYPE_PANEL || |
| 447 !window_state()->panel_attached() || | 447 !window_state()->panel_attached() || |
| 448 dock_layout_->is_dragged_window_docked()) && | 448 dock_layout_->is_dragged_window_docked()) && |
| 449 (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) { | 449 (snap_type_ == SNAP_LEFT || snap_type_ == SNAP_RIGHT)) { |
| 450 if (!window_state()->HasRestoreBounds()) { | 450 if (!window_state()->HasRestoreBounds()) { |
| 451 gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen( | 451 gfx::Rect initial_bounds = ScreenAsh::ConvertRectToScreen( |
| 452 window()->parent(), details_.initial_bounds_in_parent); | 452 window()->parent(), details_.initial_bounds_in_parent); |
| 453 window_state()->SetRestoreBoundsInScreen( | 453 window_state()->SetRestoreBoundsInScreen( |
| 454 details_.restore_bounds.IsEmpty() ? | 454 details_.restore_bounds.IsEmpty() ? |
| 455 initial_bounds : | 455 initial_bounds : |
| 456 details_.restore_bounds); | 456 details_.restore_bounds); |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 } else { | 1042 } else { |
| 1043 if (dock_layout_->is_dragged_window_docked()) { | 1043 if (dock_layout_->is_dragged_window_docked()) { |
| 1044 dock_layout_->UndockDraggedWindow(); | 1044 dock_layout_->UndockDraggedWindow(); |
| 1045 window_state()->set_bounds_changed_by_user(true); | 1045 window_state()->set_bounds_changed_by_user(true); |
| 1046 } | 1046 } |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 } // namespace internal | 1050 } // namespace internal |
| 1051 } // namespace ash | 1051 } // namespace ash |
| OLD | NEW |