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" | |
8 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
9 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
10 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
11 #include "ash/screen_ash.h" | 10 #include "ash/screen_ash.h" |
12 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
13 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
14 #include "ash/shell.h" | 13 #include "ash/shell.h" |
15 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
16 #include "ash/wm/coordinate_conversion.h" | 15 #include "ash/wm/coordinate_conversion.h" |
17 #include "ash/wm/dock/docked_window_layout_manager.h" | 16 #include "ash/wm/dock/docked_window_layout_manager.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 void DockedWindowResizer::RevertDrag() { | 134 void DockedWindowResizer::RevertDrag() { |
136 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 135 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
137 // don't get forced into the workspace that may be shrunken because of docked | 136 // don't get forced into the workspace that may be shrunken because of docked |
138 // windows. | 137 // windows. |
139 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); | 138 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); |
140 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); | 139 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); |
141 if (was_docked_) | 140 if (was_docked_) |
142 window_state->SetTrackedByWorkspace(false); | 141 window_state->SetTrackedByWorkspace(false); |
143 next_window_resizer_->RevertDrag(); | 142 next_window_resizer_->RevertDrag(); |
144 // Restore docked state to what it was before the drag if necessary. | 143 // Restore docked state to what it was before the drag if necessary. |
145 if (was_docked_ && !is_docked_) { | 144 if (is_docked_ != was_docked_) { |
146 dock_layout_->DockDraggedWindow(GetTarget()); | |
147 is_docked_ = was_docked_; | 145 is_docked_ = was_docked_; |
| 146 if (is_docked_) |
| 147 dock_layout_->DockDraggedWindow(GetTarget()); |
| 148 else |
| 149 dock_layout_->UndockDraggedWindow(); |
148 } | 150 } |
149 FinishedDragging(); | 151 FinishedDragging(); |
150 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); | 152 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); |
151 } | 153 } |
152 | 154 |
153 aura::Window* DockedWindowResizer::GetTarget() { | 155 aura::Window* DockedWindowResizer::GetTarget() { |
154 return next_window_resizer_->GetTarget(); | 156 return next_window_resizer_->GetTarget(); |
155 } | 157 } |
156 | 158 |
157 const gfx::Point& DockedWindowResizer::GetInitialLocation() const { | 159 const gfx::Point& DockedWindowResizer::GetInitialLocation() const { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // If we started the drag in one root window and moved into another root | 291 // 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 | 292 // but then canceled the drag we may need to inform the original layout |
291 // manager that the drag is finished. | 293 // manager that the drag is finished. |
292 if (initial_dock_layout_ != dock_layout_) | 294 if (initial_dock_layout_ != dock_layout_) |
293 initial_dock_layout_->FinishDragging(); | 295 initial_dock_layout_->FinishDragging(); |
294 is_docked_ = false; | 296 is_docked_ = false; |
295 } | 297 } |
296 | 298 |
297 } // namespace internal | 299 } // namespace internal |
298 } // namespace ash | 300 } // namespace ash |
OLD | NEW |