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" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Window could get docked by the WorkspaceWindowResizer, update the state. | 117 // Window could get docked by the WorkspaceWindowResizer, update the state. |
118 is_docked_ = dock_layout_->is_dragged_window_docked(); | 118 is_docked_ = dock_layout_->is_dragged_window_docked(); |
119 } | 119 } |
120 | 120 |
121 void DockedWindowResizer::CompleteDrag(int event_flags) { | 121 void DockedWindowResizer::CompleteDrag(int event_flags) { |
122 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 122 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
123 // don't get forced into the workspace that may be shrunken because of docked | 123 // don't get forced into the workspace that may be shrunken because of docked |
124 // windows. | 124 // windows. |
125 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); | 125 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); |
126 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); | 126 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); |
127 if (was_docked_) | 127 window_state->SetTrackedByWorkspace(false); |
128 window_state->SetTrackedByWorkspace(false); | |
129 // The root window can change when dragging into a different screen. | 128 // The root window can change when dragging into a different screen. |
130 next_window_resizer_->CompleteDrag(event_flags); | 129 next_window_resizer_->CompleteDrag(event_flags); |
131 FinishedDragging(); | 130 FinishedDragging(); |
132 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); | 131 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); |
133 } | 132 } |
134 | 133 |
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 window_state->SetTrackedByWorkspace(false); |
142 window_state->SetTrackedByWorkspace(false); | |
143 next_window_resizer_->RevertDrag(); | 141 next_window_resizer_->RevertDrag(); |
144 // Restore docked state to what it was before the drag if necessary. | 142 // Restore docked state to what it was before the drag if necessary. |
145 if (was_docked_ && !is_docked_) { | 143 if (was_docked_ && !is_docked_) { |
146 dock_layout_->DockDraggedWindow(GetTarget()); | 144 dock_layout_->DockDraggedWindow(GetTarget()); |
147 is_docked_ = was_docked_; | 145 is_docked_ = was_docked_; |
148 } | 146 } |
149 FinishedDragging(); | 147 FinishedDragging(); |
150 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); | 148 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); |
151 } | 149 } |
152 | 150 |
(...skipping 136 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 | 287 // 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 | 288 // but then canceled the drag we may need to inform the original layout |
291 // manager that the drag is finished. | 289 // manager that the drag is finished. |
292 if (initial_dock_layout_ != dock_layout_) | 290 if (initial_dock_layout_ != dock_layout_) |
293 initial_dock_layout_->FinishDragging(); | 291 initial_dock_layout_->FinishDragging(); |
294 is_docked_ = false; | 292 is_docked_ = false; |
295 } | 293 } |
296 | 294 |
297 } // namespace internal | 295 } // namespace internal |
298 } // namespace ash | 296 } // namespace ash |
OLD | NEW |