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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 // Window could get docked by the WorkspaceWindowResizer, update the state. | 116 // Window could get docked by the WorkspaceWindowResizer, update the state. |
118 is_docked_ = dock_layout_->is_dragged_window_docked(); | 117 is_docked_ = dock_layout_->is_dragged_window_docked(); |
119 } | 118 } |
120 | 119 |
121 void DockedWindowResizer::CompleteDrag(int event_flags) { | 120 void DockedWindowResizer::CompleteDrag(int event_flags) { |
122 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 121 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
123 // don't get forced into the workspace that may be shrunken because of docked | 122 // don't get forced into the workspace that may be shrunken because of docked |
124 // windows. | 123 // windows. |
125 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); | 124 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); |
126 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); | 125 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); |
127 if (was_docked_) | 126 window_state->SetTrackedByWorkspace(false); |
varkha
2013/11/05 20:47:24
This change is from https://codereview.chromium.or
| |
128 window_state->SetTrackedByWorkspace(false); | |
129 // The root window can change when dragging into a different screen. | 127 // The root window can change when dragging into a different screen. |
130 next_window_resizer_->CompleteDrag(event_flags); | 128 next_window_resizer_->CompleteDrag(event_flags); |
131 FinishedDragging(); | 129 FinishedDragging(); |
132 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); | 130 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); |
133 } | 131 } |
134 | 132 |
135 void DockedWindowResizer::RevertDrag() { | 133 void DockedWindowResizer::RevertDrag() { |
136 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they | 134 // Temporarily clear kWindowTrackedByWorkspaceKey for panels so that they |
137 // don't get forced into the workspace that may be shrunken because of docked | 135 // don't get forced into the workspace that may be shrunken because of docked |
138 // windows. | 136 // windows. |
139 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); | 137 wm::WindowState* window_state = wm::GetWindowState(GetTarget()); |
140 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); | 138 bool was_tracked_by_workspace = window_state->tracked_by_workspace(); |
141 if (was_docked_) | 139 window_state->SetTrackedByWorkspace(false); |
varkha
2013/11/05 20:47:24
This change is from https://codereview.chromium.or
| |
142 window_state->SetTrackedByWorkspace(false); | |
143 next_window_resizer_->RevertDrag(); | 140 next_window_resizer_->RevertDrag(); |
144 // Restore docked state to what it was before the drag if necessary. | 141 // Restore docked state to what it was before the drag if necessary. |
145 if (was_docked_ && !is_docked_) { | 142 if (was_docked_ != is_docked_) { |
146 dock_layout_->DockDraggedWindow(GetTarget()); | |
147 is_docked_ = was_docked_; | 143 is_docked_ = was_docked_; |
144 if (is_docked_) | |
145 dock_layout_->DockDraggedWindow(GetTarget()); | |
146 else | |
147 dock_layout_->UndockDraggedWindow(); | |
148 } | 148 } |
149 FinishedDragging(); | 149 FinishedDragging(); |
150 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); | 150 window_state->SetTrackedByWorkspace(was_tracked_by_workspace); |
151 } | 151 } |
152 | 152 |
153 aura::Window* DockedWindowResizer::GetTarget() { | 153 aura::Window* DockedWindowResizer::GetTarget() { |
154 return next_window_resizer_->GetTarget(); | 154 return next_window_resizer_->GetTarget(); |
155 } | 155 } |
156 | 156 |
157 const gfx::Point& DockedWindowResizer::GetInitialLocation() const { | 157 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 | 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 |