| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/wm/drag_details.h" | |
| 6 | |
| 7 #include "ash/wm/common/wm_window.h" | |
| 8 #include "ash/wm/window_resizer.h" | |
| 9 #include "ui/aura/window.h" | |
| 10 #include "ui/base/hit_test.h" | |
| 11 | |
| 12 namespace ash { | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 int GetSizeChangeDirectionForWindowComponent(int window_component) { | |
| 17 int size_change_direction = WindowResizer::kBoundsChangeDirection_None; | |
| 18 switch (window_component) { | |
| 19 case HTTOPLEFT: | |
| 20 case HTTOPRIGHT: | |
| 21 case HTBOTTOMLEFT: | |
| 22 case HTBOTTOMRIGHT: | |
| 23 case HTGROWBOX: | |
| 24 case HTCAPTION: | |
| 25 size_change_direction |= | |
| 26 WindowResizer::kBoundsChangeDirection_Horizontal | | |
| 27 WindowResizer::kBoundsChangeDirection_Vertical; | |
| 28 break; | |
| 29 case HTTOP: | |
| 30 case HTBOTTOM: | |
| 31 size_change_direction |= WindowResizer::kBoundsChangeDirection_Vertical; | |
| 32 break; | |
| 33 case HTRIGHT: | |
| 34 case HTLEFT: | |
| 35 size_change_direction |= WindowResizer::kBoundsChangeDirection_Horizontal; | |
| 36 break; | |
| 37 default: | |
| 38 break; | |
| 39 } | |
| 40 return size_change_direction; | |
| 41 } | |
| 42 | |
| 43 } // namespace | |
| 44 | |
| 45 DragDetails::DragDetails(wm::WmWindow* window, | |
| 46 const gfx::Point& location, | |
| 47 int window_component, | |
| 48 aura::client::WindowMoveSource source) | |
| 49 : initial_state_type(window->GetWindowState()->GetStateType()), | |
| 50 initial_bounds_in_parent(window->GetBounds()), | |
| 51 initial_location_in_parent(location), | |
| 52 initial_opacity(window->GetLayer()->opacity()), | |
| 53 window_component(window_component), | |
| 54 bounds_change( | |
| 55 WindowResizer::GetBoundsChangeForWindowComponent(window_component)), | |
| 56 position_change_direction( | |
| 57 WindowResizer::GetPositionChangeDirectionForWindowComponent( | |
| 58 window_component)), | |
| 59 size_change_direction( | |
| 60 GetSizeChangeDirectionForWindowComponent(window_component)), | |
| 61 is_resizable(bounds_change != WindowResizer::kBoundsChangeDirection_None), | |
| 62 source(source), | |
| 63 should_attach_to_shelf(window->GetType() == ui::wm::WINDOW_TYPE_PANEL && | |
| 64 window->GetWindowState()->panel_attached()) { | |
| 65 wm::WindowState* window_state = window->GetWindowState(); | |
| 66 if ((window_state->IsNormalOrSnapped() || window_state->IsDocked()) && | |
| 67 window_state->HasRestoreBounds() && | |
| 68 window_component == HTCAPTION) { | |
| 69 restore_bounds = window_state->GetRestoreBoundsInScreen(); | |
| 70 } | |
| 71 } | |
| 72 | |
| 73 DragDetails::~DragDetails() { | |
| 74 } | |
| 75 | |
| 76 } // namespace ash | |
| OLD | NEW |