| 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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| 11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
| 14 #include "ash/wm/coordinate_conversion.h" |
| 14 #include "ash/wm/panels/panel_layout_manager.h" | 15 #include "ash/wm/panels/panel_layout_manager.h" |
| 15 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
| 16 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
| 17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 18 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
| 19 #include "ui/aura/client/window_tree_client.h" | 20 #include "ui/aura/client/window_tree_client.h" |
| 20 #include "ui/aura/env.h" | 21 #include "ui/aura/env.h" |
| 21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_delegate.h" | 23 #include "ui/aura/window_delegate.h" |
| 23 #include "ui/aura/window_event_dispatcher.h" | 24 #include "ui/aura/window_event_dispatcher.h" |
| 24 #include "ui/base/hit_test.h" | 25 #include "ui/base/hit_test.h" |
| 25 #include "ui/base/ui_base_types.h" | 26 #include "ui/base/ui_base_types.h" |
| 26 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
| 27 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 28 #include "ui/wm/core/coordinate_conversion.h" | |
| 29 | 29 |
| 30 namespace ash { | 30 namespace ash { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 const int kPanelSnapToLauncherDistance = 30; | 33 const int kPanelSnapToLauncherDistance = 30; |
| 34 | 34 |
| 35 PanelLayoutManager* GetPanelLayoutManager(aura::Window* panel_container) { | 35 PanelLayoutManager* GetPanelLayoutManager(aura::Window* panel_container) { |
| 36 DCHECK(panel_container->id() == kShellWindowId_PanelContainer); | 36 DCHECK(panel_container->id() == kShellWindowId_PanelContainer); |
| 37 return static_cast<PanelLayoutManager*>(panel_container->layout_manager()); | 37 return static_cast<PanelLayoutManager*>(panel_container->layout_manager()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 PanelWindowResizer::~PanelWindowResizer() { | 42 PanelWindowResizer::~PanelWindowResizer() { |
| 43 } | 43 } |
| 44 | 44 |
| 45 // static | 45 // static |
| 46 PanelWindowResizer* | 46 PanelWindowResizer* |
| 47 PanelWindowResizer::Create(WindowResizer* next_window_resizer, | 47 PanelWindowResizer::Create(WindowResizer* next_window_resizer, |
| 48 wm::WindowState* window_state) { | 48 wm::WindowState* window_state) { |
| 49 return new PanelWindowResizer(next_window_resizer, window_state); | 49 return new PanelWindowResizer(next_window_resizer, window_state); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 52 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| 53 last_location_ = location; | 53 last_location_ = location; |
| 54 ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); | 54 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); |
| 55 if (!did_move_or_resize_) { | 55 if (!did_move_or_resize_) { |
| 56 did_move_or_resize_ = true; | 56 did_move_or_resize_ = true; |
| 57 StartedDragging(); | 57 StartedDragging(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Check if the destination has changed displays. | 60 // Check if the destination has changed displays. |
| 61 gfx::Screen* screen = Shell::GetScreen(); | 61 gfx::Screen* screen = Shell::GetScreen(); |
| 62 const gfx::Display dst_display = | 62 const gfx::Display dst_display = |
| 63 screen->GetDisplayNearestPoint(last_location_); | 63 screen->GetDisplayNearestPoint(last_location_); |
| 64 if (dst_display.id() != | 64 if (dst_display.id() != |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 void PanelWindowResizer::UpdateLauncherPosition() { | 217 void PanelWindowResizer::UpdateLauncherPosition() { |
| 218 if (panel_container_) { | 218 if (panel_container_) { |
| 219 GetPanelLayoutManager(panel_container_)->shelf()-> | 219 GetPanelLayoutManager(panel_container_)->shelf()-> |
| 220 UpdateIconPositionForWindow(GetTarget()); | 220 UpdateIconPositionForWindow(GetTarget()); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace aura | 224 } // namespace aura |
| OLD | NEW |