| 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_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" |
| 7 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 8 #include "ash/wm/workspace/workspace_manager.h" | 9 #include "ash/wm/workspace/workspace_manager.h" |
| 9 #include "ui/aura/client/activation_client.h" | 10 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 namespace internal { | 16 namespace internal { |
| 16 | 17 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 52 } |
| 52 | 53 |
| 53 void WorkspaceController::OnWindowActivated(aura::Window* gained_active, | 54 void WorkspaceController::OnWindowActivated(aura::Window* gained_active, |
| 54 aura::Window* lost_active) { | 55 aura::Window* lost_active) { |
| 55 if (!gained_active || | 56 if (!gained_active || |
| 56 gained_active->GetRootWindow() == viewport_->GetRootWindow()) { | 57 gained_active->GetRootWindow() == viewport_->GetRootWindow()) { |
| 57 workspace_manager_->SetActiveWorkspaceByWindow(gained_active); | 58 workspace_manager_->SetActiveWorkspaceByWindow(gained_active); |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 62 void WorkspaceController::OnAttemptToReactivateWindow( |
| 63 aura::Window* request_active, |
| 64 aura::Window* actual_active) { |
| 65 if (ash::Shell::GetInstance()->IsSystemModalWindowOpen()) { |
| 66 // While a system model dialog is showing requests to activate a window |
| 67 // other than that of the modal dialog fail. Outside of this function we |
| 68 // only switch the active workspace when activation changes. That prevents |
| 69 // the active workspace from changing while a system modal dialog is |
| 70 // showing. This code ensures the active workspace changes even though |
| 71 // activation doesn't change away from the system model dialog. |
| 72 workspace_manager_->SetActiveWorkspaceByWindow(request_active); |
| 73 } |
| 74 } |
| 75 |
| 61 } // namespace internal | 76 } // namespace internal |
| 62 } // namespace ash | 77 } // namespace ash |
| OLD | NEW |