OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/drag_details.h" | 5 #include "ash/wm/drag_details.h" |
6 | 6 |
7 #include "ash/public/cpp/window_properties.h" | 7 #include "ash/public/cpp/window_properties.h" |
8 #include "ash/wm/window_resizer.h" | 8 #include "ash/wm/window_resizer.h" |
9 #include "ash/wm_window.h" | |
10 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
11 #include "ui/base/hit_test.h" | 10 #include "ui/base/hit_test.h" |
12 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
13 | 12 |
14 namespace ash { | 13 namespace ash { |
15 | 14 |
16 namespace { | 15 namespace { |
17 | 16 |
18 int GetSizeChangeDirectionForWindowComponent(int window_component) { | 17 int GetSizeChangeDirectionForWindowComponent(int window_component) { |
19 int size_change_direction = WindowResizer::kBoundsChangeDirection_None; | 18 int size_change_direction = WindowResizer::kBoundsChangeDirection_None; |
(...skipping 17 matching lines...) Expand all Loading... |
37 size_change_direction |= WindowResizer::kBoundsChangeDirection_Horizontal; | 36 size_change_direction |= WindowResizer::kBoundsChangeDirection_Horizontal; |
38 break; | 37 break; |
39 default: | 38 default: |
40 break; | 39 break; |
41 } | 40 } |
42 return size_change_direction; | 41 return size_change_direction; |
43 } | 42 } |
44 | 43 |
45 } // namespace | 44 } // namespace |
46 | 45 |
47 DragDetails::DragDetails(WmWindow* window, | 46 DragDetails::DragDetails(aura::Window* window, |
48 const gfx::Point& location, | 47 const gfx::Point& location, |
49 int window_component, | 48 int window_component, |
50 aura::client::WindowMoveSource source) | 49 aura::client::WindowMoveSource source) |
51 : initial_state_type(window->GetWindowState()->GetStateType()), | 50 : initial_state_type(wm::GetWindowState(window)->GetStateType()), |
52 initial_bounds_in_parent(window->GetBounds()), | 51 initial_bounds_in_parent(window->bounds()), |
53 initial_location_in_parent(location), | 52 initial_location_in_parent(location), |
54 // When drag starts, we might be in the middle of a window opacity | 53 // When drag starts, we might be in the middle of a window opacity |
55 // animation, on drag completion we must set the opacity to the target | 54 // animation, on drag completion we must set the opacity to the target |
56 // opacity rather than the current opacity (crbug.com/687003). | 55 // opacity rather than the current opacity (crbug.com/687003). |
57 initial_opacity(window->GetLayer()->GetTargetOpacity()), | 56 initial_opacity(window->layer()->GetTargetOpacity()), |
58 window_component(window_component), | 57 window_component(window_component), |
59 bounds_change( | 58 bounds_change( |
60 WindowResizer::GetBoundsChangeForWindowComponent(window_component)), | 59 WindowResizer::GetBoundsChangeForWindowComponent(window_component)), |
61 position_change_direction( | 60 position_change_direction( |
62 WindowResizer::GetPositionChangeDirectionForWindowComponent( | 61 WindowResizer::GetPositionChangeDirectionForWindowComponent( |
63 window_component)), | 62 window_component)), |
64 size_change_direction( | 63 size_change_direction( |
65 GetSizeChangeDirectionForWindowComponent(window_component)), | 64 GetSizeChangeDirectionForWindowComponent(window_component)), |
66 is_resizable(bounds_change != WindowResizer::kBoundsChangeDirection_None), | 65 is_resizable(bounds_change != WindowResizer::kBoundsChangeDirection_None), |
67 source(source), | 66 source(source), |
68 should_attach_to_shelf( | 67 should_attach_to_shelf(window->type() == ui::wm::WINDOW_TYPE_PANEL && |
69 window->GetType() == ui::wm::WINDOW_TYPE_PANEL && | 68 window->GetProperty(kPanelAttachedKey)) { |
70 window->aura_window()->GetProperty(kPanelAttachedKey)) { | 69 wm::WindowState* window_state = wm::GetWindowState(window); |
71 wm::WindowState* window_state = window->GetWindowState(); | |
72 if (window_state->IsNormalOrSnapped() && window_state->HasRestoreBounds() && | 70 if (window_state->IsNormalOrSnapped() && window_state->HasRestoreBounds() && |
73 window_component == HTCAPTION) { | 71 window_component == HTCAPTION) { |
74 restore_bounds = window_state->GetRestoreBoundsInScreen(); | 72 restore_bounds = window_state->GetRestoreBoundsInScreen(); |
75 } | 73 } |
76 } | 74 } |
77 | 75 |
78 DragDetails::~DragDetails() {} | 76 DragDetails::~DragDetails() {} |
79 | 77 |
80 } // namespace ash | 78 } // namespace ash |
OLD | NEW |