| 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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "ash/wm/workspace/workspace_cycler.h" | 9 #include "ash/wm/workspace/workspace_cycler.h" |
| 10 #include "ash/wm/workspace/workspace_manager.h" | 10 #include "ash/wm/workspace/workspace_manager.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
| 13 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
| 14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 WorkspaceController::WorkspaceController(aura::Window* viewport) | 20 WorkspaceController::WorkspaceController(aura::Window* viewport) |
| 21 : viewport_(viewport), | 21 : ActivationChangeShim(viewport->GetRootWindow()), |
| 22 viewport_(viewport), |
| 22 workspace_cycler_(NULL) { | 23 workspace_cycler_(NULL) { |
| 23 aura::RootWindow* root_window = viewport->GetRootWindow(); | 24 aura::RootWindow* root_window = viewport->GetRootWindow(); |
| 24 workspace_manager_.reset(new WorkspaceManager(viewport)); | 25 workspace_manager_.reset(new WorkspaceManager(viewport)); |
| 25 if (CommandLine::ForCurrentProcess()->HasSwitch( | 26 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 26 switches::kAshEnableWorkspaceScrubbing)) { | 27 switches::kAshEnableWorkspaceScrubbing)) { |
| 27 workspace_cycler_.reset(new WorkspaceCycler(workspace_manager_.get())); | 28 workspace_cycler_.reset(new WorkspaceCycler(workspace_manager_.get())); |
| 28 } | 29 } |
| 29 aura::client::GetActivationClient(root_window)->AddObserver(this); | 30 aura::client::GetActivationClient(root_window)->AddObserver(this); |
| 30 } | 31 } |
| 31 | 32 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 } | 57 } |
| 57 | 58 |
| 58 void WorkspaceController::OnWindowActivated(aura::Window* window, | 59 void WorkspaceController::OnWindowActivated(aura::Window* window, |
| 59 aura::Window* old_active) { | 60 aura::Window* old_active) { |
| 60 if (!window || window->GetRootWindow() == viewport_->GetRootWindow()) | 61 if (!window || window->GetRootWindow() == viewport_->GetRootWindow()) |
| 61 workspace_manager_->SetActiveWorkspaceByWindow(window); | 62 workspace_manager_->SetActiveWorkspaceByWindow(window); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace internal | 65 } // namespace internal |
| 65 } // namespace ash | 66 } // namespace ash |
| OLD | NEW |