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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // implement proper transition from one resizer to another during or at the | 62 // implement proper transition from one resizer to another during or at the |
63 // end of the drag. This also causes http://crbug.com/247085. | 63 // end of the drag. This also causes http://crbug.com/247085. |
64 // It seems the only thing the panel or dock resizer needs to do is notify the | 64 // It seems the only thing the panel or dock resizer needs to do is notify the |
65 // layout manager when a docked window is being dragged. We should have a | 65 // layout manager when a docked window is being dragged. We should have a |
66 // better way of doing this, perhaps by having a way of observing drags or | 66 // better way of doing this, perhaps by having a way of observing drags or |
67 // having a generic drag window wrapper which informs a layout manager that a | 67 // having a generic drag window wrapper which informs a layout manager that a |
68 // drag has started or stopped. | 68 // drag has started or stopped. |
69 // It may be possible to refactor and eliminate chaining. | 69 // It may be possible to refactor and eliminate chaining. |
70 WindowResizer* window_resizer = NULL; | 70 WindowResizer* window_resizer = NULL; |
71 | 71 |
72 if (!window_state->IsNormalShowState()) | 72 if (!window_state->IsNormalOrSnapped()) |
73 return scoped_ptr<WindowResizer>(); | 73 return scoped_ptr<WindowResizer>(); |
74 | 74 |
75 int bounds_change = WindowResizer::GetBoundsChangeForWindowComponent( | 75 int bounds_change = WindowResizer::GetBoundsChangeForWindowComponent( |
76 window_component); | 76 window_component); |
77 if (bounds_change == WindowResizer::kBoundsChangeDirection_None) | 77 if (bounds_change == WindowResizer::kBoundsChangeDirection_None) |
78 return scoped_ptr<WindowResizer>(); | 78 return scoped_ptr<WindowResizer>(); |
79 | 79 |
80 window_state->CreateDragDetails(window, point_in_parent, window_component, | 80 window_state->CreateDragDetails(window, point_in_parent, window_component, |
81 source); | 81 source); |
82 if (window->parent() && | 82 if (window->parent() && |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 iter != root_windows.end(); ++iter) { | 738 iter != root_windows.end(); ++iter) { |
739 const aura::Window* root_window = *iter; | 739 const aura::Window* root_window = *iter; |
740 // Test all children from the desktop in each root window. | 740 // Test all children from the desktop in each root window. |
741 const aura::Window::Windows& children = Shell::GetContainer( | 741 const aura::Window::Windows& children = Shell::GetContainer( |
742 root_window, kShellWindowId_DefaultContainer)->children(); | 742 root_window, kShellWindowId_DefaultContainer)->children(); |
743 for (aura::Window::Windows::const_reverse_iterator i = children.rbegin(); | 743 for (aura::Window::Windows::const_reverse_iterator i = children.rbegin(); |
744 i != children.rend() && !matcher.AreEdgesObscured(); ++i) { | 744 i != children.rend() && !matcher.AreEdgesObscured(); ++i) { |
745 wm::WindowState* other_state = wm::GetWindowState(*i); | 745 wm::WindowState* other_state = wm::GetWindowState(*i); |
746 if (other_state->window() == GetTarget() || | 746 if (other_state->window() == GetTarget() || |
747 !other_state->window()->IsVisible() || | 747 !other_state->window()->IsVisible() || |
748 !other_state->IsNormalShowState() || | 748 !other_state->IsNormalOrSnapped() || |
749 !other_state->CanResize()) { | 749 !other_state->CanResize()) { |
750 continue; | 750 continue; |
751 } | 751 } |
752 if (matcher.ShouldAttach( | 752 if (matcher.ShouldAttach( |
753 other_state->window()->GetBoundsInScreen(), &magnetism_edge_)) { | 753 other_state->window()->GetBoundsInScreen(), &magnetism_edge_)) { |
754 magnetism_window_ = other_state->window(); | 754 magnetism_window_ = other_state->window(); |
755 window_tracker_.Add(magnetism_window_); | 755 window_tracker_.Add(magnetism_window_); |
756 return true; | 756 return true; |
757 } | 757 } |
758 } | 758 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 1032 gfx::Rect snapped_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
1033 GetTarget()); | 1033 GetTarget()); |
1034 if (snapped_type == wm::SHOW_TYPE_RIGHT_SNAPPED) | 1034 if (snapped_type == wm::SHOW_TYPE_RIGHT_SNAPPED) |
1035 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); | 1035 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); |
1036 snapped_bounds.set_width(bounds_in_parent.width()); | 1036 snapped_bounds.set_width(bounds_in_parent.width()); |
1037 return bounds_in_parent == snapped_bounds; | 1037 return bounds_in_parent == snapped_bounds; |
1038 } | 1038 } |
1039 | 1039 |
1040 } // namespace internal | 1040 } // namespace internal |
1041 } // namespace ash | 1041 } // namespace ash |
OLD | NEW |