Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: ui/aura_shell/workspace/workspace_controller.cc

Issue 8430024: Add WorkspaceObserver to observe changes in workspace state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/workspace_controller.h" 5 #include "ui/aura_shell/workspace/workspace_controller.h"
6 6
7 #include "ui/aura/desktop.h" 7 #include "ui/aura/desktop.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/workspace/workspace.h" 10 #include "ui/aura_shell/workspace/workspace.h"
11 #include "ui/aura_shell/workspace/workspace_manager.h" 11 #include "ui/aura_shell/workspace/workspace_manager.h"
12 12
13 namespace aura_shell { 13 namespace aura_shell {
14 namespace internal { 14 namespace internal {
15 15
16 WorkspaceController::WorkspaceController(aura::Window* window) 16 WorkspaceController::WorkspaceController(aura::Window* viewport)
17 : workspace_manager_(new WorkspaceManager(window)), 17 : workspace_manager_(new WorkspaceManager(viewport)) {
18 layout_manager_(new internal::DefaultContainerLayoutManager(
19 window, workspace_manager_.get())) {
20 window->SetLayoutManager(layout_manager_);
21 aura::Desktop::GetInstance()->AddObserver(this); 18 aura::Desktop::GetInstance()->AddObserver(this);
22 } 19 }
23 20
24 WorkspaceController::~WorkspaceController() { 21 WorkspaceController::~WorkspaceController() {
25 aura::Desktop::GetInstance()->RemoveObserver(this); 22 aura::Desktop::GetInstance()->RemoveObserver(this);
26 } 23 }
27 24
28 void WorkspaceController::ToggleOverview() { 25 void WorkspaceController::ToggleOverview() {
29 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); 26 workspace_manager_->SetOverview(!workspace_manager_->is_overview());
30 } 27 }
31 28
32 void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) { 29 void WorkspaceController::OnDesktopResized(const gfx::Size& new_size) {
33 layout_manager_->set_ignore_calculate_bounds(true);
34 workspace_manager_->SetWorkspaceSize(new_size); 30 workspace_manager_->SetWorkspaceSize(new_size);
35 layout_manager_->set_ignore_calculate_bounds(false);
36 } 31 }
37 32
38 void WorkspaceController::OnActiveWindowChanged(aura::Window* active) { 33 void WorkspaceController::OnActiveWindowChanged(aura::Window* active) {
39 // FindBy handles NULL. 34 // FindBy handles NULL.
40 Workspace* workspace = workspace_manager_->FindBy(active); 35 Workspace* workspace = workspace_manager_->FindBy(active);
41 if (workspace) 36 if (workspace)
42 workspace->Activate(); 37 workspace->Activate();
43 } 38 }
44 39
45 } // namespace internal 40 } // namespace internal
46 } // namespace aura_shell 41 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/workspace/workspace_controller.h ('k') | ui/aura_shell/workspace/workspace_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698