| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
| 9 #include "ash/launcher/launcher.h" | 9 #include "ash/launcher/launcher.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| 11 #include "ash/screen_ash.h" | 11 #include "ash/screen_ash.h" |
| 12 #include "ash/shelf/shelf_types.h" | 12 #include "ash/shelf/shelf_types.h" |
| 13 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
| 16 #include "ash/wm/coordinate_conversion.h" | 16 #include "ash/wm/coordinate_conversion.h" |
| 17 #include "ash/wm/dock/docked_window_layout_manager.h" | 17 #include "ash/wm/dock/docked_window_layout_manager.h" |
| 18 #include "ash/wm/window_state.h" | 18 #include "ash/wm/window_state.h" |
| 19 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
| 20 #include "ash/wm/workspace/magnetism_matcher.h" | 20 #include "ash/wm/workspace/magnetism_matcher.h" |
| 21 #include "ash/wm/workspace/workspace_window_resizer.h" | 21 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 22 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
| 24 #include "ui/aura/client/aura_constants.h" | 24 #include "ui/aura/client/aura_constants.h" |
| 25 #include "ui/aura/client/window_tree_client.h" |
| 25 #include "ui/aura/env.h" | 26 #include "ui/aura/env.h" |
| 26 #include "ui/aura/root_window.h" | 27 #include "ui/aura/root_window.h" |
| 27 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_delegate.h" | 29 #include "ui/aura/window_delegate.h" |
| 29 #include "ui/base/hit_test.h" | 30 #include "ui/base/hit_test.h" |
| 30 #include "ui/base/ui_base_types.h" | 31 #include "ui/base/ui_base_types.h" |
| 31 #include "ui/gfx/screen.h" | 32 #include "ui/gfx/screen.h" |
| 32 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
| 33 | 34 |
| 34 namespace ash { | 35 namespace ash { |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // Check if the window needs to be docked or returned to workspace. | 264 // Check if the window needs to be docked or returned to workspace. |
| 264 aura::Window* dock_container = Shell::GetContainer( | 265 aura::Window* dock_container = Shell::GetContainer( |
| 265 window->GetRootWindow(), | 266 window->GetRootWindow(), |
| 266 kShellWindowId_DockedContainer); | 267 kShellWindowId_DockedContainer); |
| 267 if ((is_resized || !attached_panel) && | 268 if ((is_resized || !attached_panel) && |
| 268 is_docked_ != (window->parent() == dock_container)) { | 269 is_docked_ != (window->parent() == dock_container)) { |
| 269 if (is_docked_) { | 270 if (is_docked_) { |
| 270 wm::ReparentChildWithTransientChildren(dock_container, window); | 271 wm::ReparentChildWithTransientChildren(dock_container, window); |
| 271 } else if (window->parent()->id() == kShellWindowId_DockedContainer) { | 272 } else if (window->parent()->id() == kShellWindowId_DockedContainer) { |
| 272 // Reparent the window back to workspace. | 273 // Reparent the window back to workspace. |
| 273 // We need to be careful to give SetDefaultParentByRootWindow location in | 274 // We need to be careful to give ParentWindowWithContext a location in |
| 274 // the right root window (matching the logic in DragWindowResizer) based | 275 // the right root window (matching the logic in DragWindowResizer) based |
| 275 // on which root window a mouse pointer is in. We want to undock into the | 276 // on which root window a mouse pointer is in. We want to undock into the |
| 276 // right screen near the edge of a multiscreen setup (based on where the | 277 // right screen near the edge of a multiscreen setup (based on where the |
| 277 // mouse is). | 278 // mouse is). |
| 278 gfx::Rect near_last_location(last_location_, gfx::Size()); | 279 gfx::Rect near_last_location(last_location_, gfx::Size()); |
| 279 // Reparenting will cause Relayout and possible dock shrinking. | 280 // Reparenting will cause Relayout and possible dock shrinking. |
| 280 aura::Window* previous_parent = window->parent(); | 281 aura::Window* previous_parent = window->parent(); |
| 281 window->SetDefaultParentByRootWindow(window->GetRootWindow(), | 282 aura::client::ParentWindowWithContext(window, window, near_last_location); |
| 282 near_last_location); | |
| 283 if (window->parent() != previous_parent) | 283 if (window->parent() != previous_parent) |
| 284 wm::ReparentTransientChildrenOfChild(window->parent(), window); | 284 wm::ReparentTransientChildrenOfChild(window->parent(), window); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 dock_layout_->FinishDragging(); | 287 dock_layout_->FinishDragging(); |
| 288 | 288 |
| 289 // If we started the drag in one root window and moved into another root | 289 // If we started the drag in one root window and moved into another root |
| 290 // but then canceled the drag we may need to inform the original layout | 290 // but then canceled the drag we may need to inform the original layout |
| 291 // manager that the drag is finished. | 291 // manager that the drag is finished. |
| 292 if (initial_dock_layout_ != dock_layout_) | 292 if (initial_dock_layout_ != dock_layout_) |
| 293 initial_dock_layout_->FinishDragging(); | 293 initial_dock_layout_->FinishDragging(); |
| 294 is_docked_ = false; | 294 is_docked_ = false; |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace internal | 297 } // namespace internal |
| 298 } // namespace ash | 298 } // namespace ash |
| OLD | NEW |