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