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_manager.h" | 9 #include "ash/wm/workspace/workspace_manager.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "ui/aura/client/activation_client.h" | 11 #include "ui/aura/client/activation_client.h" |
12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 WorkspaceController::WorkspaceController(aura::Window* viewport) | 19 WorkspaceController::WorkspaceController(aura::Window* viewport) |
20 : viewport_(viewport) { | 20 : ActivationChangeShim(viewport->GetRootWindow()), |
| 21 viewport_(viewport) { |
21 aura::RootWindow* root_window = viewport->GetRootWindow(); | 22 aura::RootWindow* root_window = viewport->GetRootWindow(); |
22 workspace_manager_.reset(new WorkspaceManager(viewport)); | 23 workspace_manager_.reset(new WorkspaceManager(viewport)); |
23 aura::client::GetActivationClient(root_window)->AddObserver(this); | 24 aura::client::GetActivationClient(root_window)->AddObserver(this); |
24 } | 25 } |
25 | 26 |
26 WorkspaceController::~WorkspaceController() { | 27 WorkspaceController::~WorkspaceController() { |
27 aura::client::GetActivationClient(viewport_->GetRootWindow())-> | 28 aura::client::GetActivationClient(viewport_->GetRootWindow())-> |
28 RemoveObserver(this); | 29 RemoveObserver(this); |
29 } | 30 } |
30 | 31 |
(...skipping 19 matching lines...) Expand all Loading... |
50 } | 51 } |
51 | 52 |
52 void WorkspaceController::OnWindowActivated(aura::Window* window, | 53 void WorkspaceController::OnWindowActivated(aura::Window* window, |
53 aura::Window* old_active) { | 54 aura::Window* old_active) { |
54 if (!window || window->GetRootWindow() == viewport_->GetRootWindow()) | 55 if (!window || window->GetRootWindow() == viewport_->GetRootWindow()) |
55 workspace_manager_->SetActiveWorkspaceByWindow(window); | 56 workspace_manager_->SetActiveWorkspaceByWindow(window); |
56 } | 57 } |
57 | 58 |
58 } // namespace internal | 59 } // namespace internal |
59 } // namespace ash | 60 } // namespace ash |
OLD | NEW |