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/workspace/workspace_manager.h" | 5 #include "ash/wm/workspace/workspace_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace, | 335 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace, |
336 SwitchReason reason, | 336 SwitchReason reason, |
337 base::TimeDelta duration) { | 337 base::TimeDelta duration) { |
338 DCHECK(workspace); | 338 DCHECK(workspace); |
339 if (active_workspace_ == workspace) | 339 if (active_workspace_ == workspace) |
340 return; | 340 return; |
341 | 341 |
342 // It is possible for a user to use accelerator keys to restore windows etc | 342 // It is possible for a user to use accelerator keys to restore windows etc |
343 // while the user is cycling through workspaces. | 343 // while the user is cycling through workspaces. |
344 if (workspace_cycler_.get()) | 344 if (workspace_cycler_) |
345 workspace_cycler_->AbortCycling(); | 345 workspace_cycler_->AbortCycling(); |
346 | 346 |
347 pending_workspaces_.erase(workspace); | 347 pending_workspaces_.erase(workspace); |
348 | 348 |
349 // Adjust the z-order. No need to adjust the z-order for the desktop since | 349 // Adjust the z-order. No need to adjust the z-order for the desktop since |
350 // it always stays at the bottom. | 350 // it always stays at the bottom. |
351 if (workspace != desktop_workspace() && | 351 if (workspace != desktop_workspace() && |
352 FindWorkspace(workspace) == workspaces_.end()) { | 352 FindWorkspace(workspace) == workspaces_.end()) { |
353 contents_view_->StackChildAbove(workspace->window(), | 353 contents_view_->StackChildAbove(workspace->window(), |
354 workspaces_.back()->window()); | 354 workspaces_.back()->window()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 Window* stack_beneath, | 415 Window* stack_beneath, |
416 SwitchReason reason) { | 416 SwitchReason reason) { |
417 // We're all ready moving windows. | 417 // We're all ready moving windows. |
418 if (in_move_) | 418 if (in_move_) |
419 return; | 419 return; |
420 | 420 |
421 DCHECK_NE(desktop_workspace(), workspace); | 421 DCHECK_NE(desktop_workspace(), workspace); |
422 | 422 |
423 // The user may have closed or minimized a window via accelerator keys while | 423 // The user may have closed or minimized a window via accelerator keys while |
424 // cycling through workspaces. | 424 // cycling through workspaces. |
425 if (workspace_cycler_.get()) | 425 if (workspace_cycler_) |
426 workspace_cycler_->AbortCycling(); | 426 workspace_cycler_->AbortCycling(); |
427 | 427 |
428 if (workspace == active_workspace_) | 428 if (workspace == active_workspace_) |
429 SelectNextWorkspace(reason); | 429 SelectNextWorkspace(reason); |
430 | 430 |
431 base::AutoReset<bool> setter(&in_move_, true); | 431 base::AutoReset<bool> setter(&in_move_, true); |
432 | 432 |
433 MoveChildrenToDesktop(workspace->window(), stack_beneath); | 433 MoveChildrenToDesktop(workspace->window(), stack_beneath); |
434 | 434 |
435 { | 435 { |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 new_workspace->window()->Show(); | 816 new_workspace->window()->Show(); |
817 ReparentWindow(window, new_workspace->window(), NULL); | 817 ReparentWindow(window, new_workspace->window(), NULL); |
818 if (is_active) { | 818 if (is_active) { |
819 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, | 819 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, |
820 base::TimeDelta()); | 820 base::TimeDelta()); |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 } // namespace internal | 824 } // namespace internal |
825 } // namespace ash | 825 } // namespace ash |
OLD | NEW |