Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/aura_shell/workspace/workspace_controller.h" | |
| 6 | |
| 7 #include "ui/aura/desktop.h" | |
| 8 #include "ui/aura/window.h" | |
| 9 #include "ui/aura_shell/default_container_layout_manager.h" | |
| 10 #include "ui/aura_shell/workspace/workspace.h" | |
| 11 #include "ui/aura_shell/workspace/workspace_manager.h" | |
| 12 | |
| 13 namespace aura_shell { | |
| 14 namespace internal { | |
| 15 | |
| 16 WorkspaceController::WorkspaceController(aura::Window* window) | |
| 17 : workspace_manager_(new WorkspaceManager(window)), | |
| 18 layout_manager_(new internal::DefaultContainerLayoutManager( | |
| 19 window, workspace_manager_.get())) { | |
| 20 window->SetLayoutManager(layout_manager_); | |
| 21 aura::Desktop::GetInstance()->AddObserver(this); | |
| 22 } | |
| 23 | |
| 24 WorkspaceController::~WorkspaceController() { | |
| 25 aura::Desktop::GetInstance()->RemoveObserver(this); | |
| 26 } | |
| 27 | |
| 28 void WorkspaceController::ToggleOverview() { | |
| 29 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); | |
| 30 } | |
| 31 | |
| 32 void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) { | |
| 33 layout_manager_->set_ignore_calculate_bounds(true); | |
| 34 workspace_manager_->SetWorkspaceSize(new_size); | |
| 35 layout_manager_->set_ignore_calculate_bounds(false); | |
| 36 } | |
| 37 | |
| 38 void WorkspaceController::OnActiveWindowChanged(aura::Window* active) { | |
| 39 // FindBy handles NULL. | |
| 40 Workspace* workspace = workspace_manager_->FindBy(active); | |
| 41 if (workspace) | |
| 42 workspace_manager_->SetActiveWorkspace(workspace); | |
|
oshima
2011/10/28 18:38:23
workspace->Activate();
| |
| 43 } | |
| 44 | |
| 45 } // namespace internal | |
| 46 } // namespace aura_shell | |
| OLD | NEW |