| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/workspace_controller.h" | 5 #include "ui/aura_shell/workspace_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/desktop.h" | 7 #include "ui/aura/root_window.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/aura_shell/default_container_layout_manager.h" | 9 #include "ui/aura_shell/default_container_layout_manager.h" |
| 10 #include "ui/aura_shell/launcher/launcher.h" | 10 #include "ui/aura_shell/launcher/launcher.h" |
| 11 #include "ui/aura_shell/launcher/launcher_model.h" | 11 #include "ui/aura_shell/launcher/launcher_model.h" |
| 12 #include "ui/aura_shell/shell.h" | 12 #include "ui/aura_shell/shell.h" |
| 13 #include "ui/aura_shell/workspace/workspace.h" | 13 #include "ui/aura_shell/workspace/workspace.h" |
| 14 #include "ui/aura_shell/workspace/workspace_manager.h" | 14 #include "ui/aura_shell/workspace/workspace_manager.h" |
| 15 | 15 |
| 16 namespace aura_shell { | 16 namespace aura_shell { |
| 17 namespace internal { | 17 namespace internal { |
| 18 | 18 |
| 19 WorkspaceController::WorkspaceController(aura::Window* viewport) | 19 WorkspaceController::WorkspaceController(aura::Window* viewport) |
| 20 : workspace_manager_(new WorkspaceManager(viewport)), | 20 : workspace_manager_(new WorkspaceManager(viewport)), |
| 21 launcher_model_(NULL), | 21 launcher_model_(NULL), |
| 22 ignore_move_event_(false) { | 22 ignore_move_event_(false) { |
| 23 workspace_manager_->AddObserver(this); | 23 workspace_manager_->AddObserver(this); |
| 24 aura::Desktop::GetInstance()->AddObserver(this); | 24 aura::RootWindow::GetInstance()->AddObserver(this); |
| 25 } | 25 } |
| 26 | 26 |
| 27 WorkspaceController::~WorkspaceController() { | 27 WorkspaceController::~WorkspaceController() { |
| 28 workspace_manager_->RemoveObserver(this); | 28 workspace_manager_->RemoveObserver(this); |
| 29 if (launcher_model_) | 29 if (launcher_model_) |
| 30 launcher_model_->RemoveObserver(this); | 30 launcher_model_->RemoveObserver(this); |
| 31 aura::Desktop::GetInstance()->RemoveObserver(this); | 31 aura::RootWindow::GetInstance()->RemoveObserver(this); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void WorkspaceController::ToggleOverview() { | 34 void WorkspaceController::ToggleOverview() { |
| 35 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); | 35 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void WorkspaceController::SetLauncherModel(LauncherModel* launcher_model) { | 38 void WorkspaceController::SetLauncherModel(LauncherModel* launcher_model) { |
| 39 DCHECK(!launcher_model_); | 39 DCHECK(!launcher_model_); |
| 40 launcher_model_ = launcher_model; | 40 launcher_model_ = launcher_model; |
| 41 launcher_model_->AddObserver(this); | 41 launcher_model_->AddObserver(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 //////////////////////////////////////////////////////////////////////////////// | 44 //////////////////////////////////////////////////////////////////////////////// |
| 45 // WorkspaceController, aura::DesktopObserver overrides: | 45 // WorkspaceController, aura::RootWindowObserver overrides: |
| 46 | 46 |
| 47 void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) { | 47 void WorkspaceController::OnRootWindowResized(const gfx::Size& new_size) { |
| 48 workspace_manager_->SetWorkspaceSize(new_size); | 48 workspace_manager_->SetWorkspaceSize(new_size); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void WorkspaceController::OnActiveWindowChanged(aura::Window* active) { | 51 void WorkspaceController::OnActiveWindowChanged(aura::Window* active) { |
| 52 // FindBy handles NULL. | 52 // FindBy handles NULL. |
| 53 Workspace* workspace = workspace_manager_->FindBy(active); | 53 Workspace* workspace = workspace_manager_->FindBy(active); |
| 54 if (workspace) | 54 if (workspace) |
| 55 workspace->Activate(); | 55 workspace->Activate(); |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ignore_move_event_ = true; | 106 ignore_move_event_ = true; |
| 107 workspace_manager_->RotateWindows(start, target); | 107 workspace_manager_->RotateWindows(start, target); |
| 108 ignore_move_event_ = false; | 108 ignore_move_event_ = false; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void WorkspaceController::LauncherItemImagesChanged(int index) { | 111 void WorkspaceController::LauncherItemImagesChanged(int index) { |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace internal | 114 } // namespace internal |
| 115 } // namespace aura_shell | 115 } // namespace aura_shell |
| OLD | NEW |