| 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/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/root_window_controller.h" | |
| 10 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 11 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| 12 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 14 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
| 15 #include "ash/wm/coordinate_conversion.h" | 14 #include "ash/wm/coordinate_conversion.h" |
| 16 #include "ash/wm/panels/panel_layout_manager.h" | 15 #include "ash/wm/panels/panel_layout_manager.h" |
| 17 #include "ash/wm/property_util.h" | 16 #include "ash/wm/property_util.h" |
| 18 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
| 19 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 50 PanelWindowResizer::Create(WindowResizer* next_window_resizer, | 49 PanelWindowResizer::Create(WindowResizer* next_window_resizer, |
| 51 aura::Window* window, | 50 aura::Window* window, |
| 52 const gfx::Point& location, | 51 const gfx::Point& location, |
| 53 int window_component) { | 52 int window_component) { |
| 54 Details details(window, location, window_component); | 53 Details details(window, location, window_component); |
| 55 return details.is_resizable ? | 54 return details.is_resizable ? |
| 56 new PanelWindowResizer(next_window_resizer, details) : NULL; | 55 new PanelWindowResizer(next_window_resizer, details) : NULL; |
| 57 } | 56 } |
| 58 | 57 |
| 59 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 58 void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| 59 last_location_ = location; |
| 60 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); |
| 60 bool destroyed = false; | 61 bool destroyed = false; |
| 61 if (!did_move_or_resize_) { | 62 if (!did_move_or_resize_) { |
| 62 did_move_or_resize_ = true; | 63 did_move_or_resize_ = true; |
| 63 StartedDragging(); | 64 StartedDragging(); |
| 64 } | 65 } |
| 65 gfx::Point location_in_screen = location; | 66 gfx::Point location_in_screen = location; |
| 66 wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); | 67 wm::ConvertPointToScreen(GetTarget()->parent(), &location_in_screen); |
| 67 | 68 |
| 68 // Check if the destination has changed displays. | 69 // Check if the destination has changed displays. |
| 69 gfx::Screen* screen = Shell::GetScreen(); | 70 gfx::Screen* screen = Shell::GetScreen(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 GetTarget()->GetBoundsInScreen()); | 198 GetTarget()->GetBoundsInScreen()); |
| 198 } | 199 } |
| 199 } | 200 } |
| 200 | 201 |
| 201 void PanelWindowResizer::FinishDragging() { | 202 void PanelWindowResizer::FinishDragging() { |
| 202 if (!did_move_or_resize_) | 203 if (!did_move_or_resize_) |
| 203 return; | 204 return; |
| 204 if (GetTarget()->GetProperty(internal::kPanelAttachedKey) != | 205 if (GetTarget()->GetProperty(internal::kPanelAttachedKey) != |
| 205 should_attach_) { | 206 should_attach_) { |
| 206 GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_); | 207 GetTarget()->SetProperty(internal::kPanelAttachedKey, should_attach_); |
| 207 GetTarget()->SetDefaultParentByRootWindow( | 208 gfx::Rect near_last_location(last_location_, gfx::Size()); |
| 208 GetTarget()->GetRootWindow(), | 209 GetTarget()->SetDefaultParentByRootWindow(GetTarget()->GetRootWindow(), |
| 209 GetTarget()->GetBoundsInScreen()); | 210 near_last_location); |
| 210 } | 211 } |
| 211 if (panel_container_) | 212 if (panel_container_) |
| 212 GetPanelLayoutManager(panel_container_)->FinishDragging(); | 213 GetPanelLayoutManager(panel_container_)->FinishDragging(); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void PanelWindowResizer::UpdateLauncherPosition() { | 216 void PanelWindowResizer::UpdateLauncherPosition() { |
| 216 if (panel_container_) { | 217 if (panel_container_) { |
| 217 GetPanelLayoutManager(panel_container_)->launcher()-> | 218 GetPanelLayoutManager(panel_container_)->launcher()-> |
| 218 UpdateIconPositionForWindow(GetTarget()); | 219 UpdateIconPositionForWindow(GetTarget()); |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 222 } // namespace aura | 223 } // namespace aura |
| OLD | NEW |