| 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/panels/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_types.h" | 8 #include "ash/shelf/shelf_types.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/wm/aura/wm_window_aura.h" | 11 #include "ash/wm/aura/wm_window_aura.h" |
| 12 #include "ash/wm/common/window_parenting_utils.h" | 12 #include "ash/wm/common/window_parenting_utils.h" |
| 13 #include "ash/wm/common/window_state.h" | 13 #include "ash/wm/common/window_state.h" |
| 14 #include "ash/wm/common/wm_root_window_controller.h" | 14 #include "ash/wm/common/wm_root_window_controller.h" |
| 15 #include "ash/wm/common/wm_window.h" | 15 #include "ash/wm/common/wm_window.h" |
| 16 #include "ash/wm/panels/panel_layout_manager.h" | 16 #include "ash/wm/panels/panel_layout_manager.h" |
| 17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/gfx/screen.h" | 19 #include "ui/display/screen.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 | 21 |
| 22 namespace ash { | 22 namespace ash { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const int kPanelSnapToLauncherDistance = 30; | 26 const int kPanelSnapToLauncherDistance = 30; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 PanelWindowResizer::~PanelWindowResizer() { | 30 PanelWindowResizer::~PanelWindowResizer() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 PanelWindowResizer* | 34 PanelWindowResizer* |
| 35 PanelWindowResizer::Create(WindowResizer* next_window_resizer, | 35 PanelWindowResizer::Create(WindowResizer* next_window_resizer, |
| 36 wm::WindowState* window_state) { | 36 wm::WindowState* window_state) { |
| 37 return new PanelWindowResizer(next_window_resizer, window_state); | 37 return new PanelWindowResizer(next_window_resizer, window_state); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 40 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| 41 last_location_ = GetTarget()->GetParent()->ConvertPointToScreen(location); | 41 last_location_ = GetTarget()->GetParent()->ConvertPointToScreen(location); |
| 42 if (!did_move_or_resize_) { | 42 if (!did_move_or_resize_) { |
| 43 did_move_or_resize_ = true; | 43 did_move_or_resize_ = true; |
| 44 StartedDragging(); | 44 StartedDragging(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Check if the destination has changed displays. | 47 // Check if the destination has changed displays. |
| 48 gfx::Screen* screen = gfx::Screen::GetScreen(); | 48 display::Screen* screen = display::Screen::GetScreen(); |
| 49 const gfx::Display dst_display = | 49 const display::Display dst_display = |
| 50 screen->GetDisplayNearestPoint(last_location_); | 50 screen->GetDisplayNearestPoint(last_location_); |
| 51 if (dst_display.id() != | 51 if (dst_display.id() != |
| 52 panel_container_->GetRootWindow()->GetDisplayNearestWindow().id()) { | 52 panel_container_->GetRootWindow()->GetDisplayNearestWindow().id()) { |
| 53 // The panel is being dragged to a new display. If the previous container is | 53 // The panel is being dragged to a new display. If the previous container is |
| 54 // the current parent of the panel it will be informed of the end of drag | 54 // the current parent of the panel it will be informed of the end of drag |
| 55 // when the panel is reparented, otherwise let the previous container know | 55 // when the panel is reparented, otherwise let the previous container know |
| 56 // the drag is complete. If we told the panel's parent that the drag was | 56 // the drag is complete. If we told the panel's parent that the drag was |
| 57 // complete it would begin positioning the panel. | 57 // complete it would begin positioning the panel. |
| 58 if (GetTarget()->GetParent() != panel_container_) | 58 if (GetTarget()->GetParent() != panel_container_) |
| 59 PanelLayoutManager::Get(panel_container_)->FinishDragging(); | 59 PanelLayoutManager::Get(panel_container_)->FinishDragging(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void PanelWindowResizer::UpdateLauncherPosition() { | 201 void PanelWindowResizer::UpdateLauncherPosition() { |
| 202 if (panel_container_) { | 202 if (panel_container_) { |
| 203 PanelLayoutManager::Get(panel_container_) | 203 PanelLayoutManager::Get(panel_container_) |
| 204 ->shelf() | 204 ->shelf() |
| 205 ->UpdateIconPositionForWindow( | 205 ->UpdateIconPositionForWindow( |
| 206 wm::WmWindowAura::GetAuraWindow(GetTarget())); | 206 wm::WmWindowAura::GetAuraWindow(GetTarget())); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace ash | 210 } // namespace ash |
| OLD | NEW |