| Index: ui/aura_shell/workspace/workspace_manager.cc
|
| diff --git a/ui/aura_shell/workspace/workspace_manager.cc b/ui/aura_shell/workspace/workspace_manager.cc
|
| index c8904ea695d310abf48015158891112a05e3634b..2531f884726b6ffa411d99cdc835aacda250ba60 100644
|
| --- a/ui/aura_shell/workspace/workspace_manager.cc
|
| +++ b/ui/aura_shell/workspace/workspace_manager.cc
|
| @@ -1,22 +1,22 @@
|
| // Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| +
|
| #include "ui/aura_shell/workspace/workspace_manager.h"
|
|
|
| #include <algorithm>
|
|
|
| #include "base/auto_reset.h"
|
| +#include "base/logging.h"
|
| +#include "base/stl_util.h"
|
| #include "ui/aura/desktop.h"
|
| #include "ui/aura/screen_aura.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura_shell/workspace/workspace.h"
|
| -#include "ui/aura_shell/workspace/workspace_manager.h"
|
| -#include "ui/gfx/screen.h"
|
| #include "ui/gfx/compositor/layer.h"
|
| #include "ui/gfx/compositor/layer_animator.h"
|
| +#include "ui/gfx/screen.h"
|
| #include "ui/gfx/transform.h"
|
| -#include "base/logging.h"
|
| -#include "base/stl_util.h"
|
|
|
| namespace {
|
|
|
| @@ -30,6 +30,7 @@ const float kMinOverviewScale = 0.3f;
|
| }
|
|
|
| namespace aura_shell {
|
| +namespace internal {
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WindowManager, public:
|
| @@ -40,11 +41,9 @@ WorkspaceManager::WorkspaceManager(aura::Window* viewport)
|
| workspace_size_(
|
| gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size()),
|
| is_overview_(false) {
|
| - aura::Desktop::GetInstance()->AddObserver(this);
|
| }
|
|
|
| WorkspaceManager::~WorkspaceManager() {
|
| - aura::Desktop::GetInstance()->RemoveObserver(this);
|
| std::vector<Workspace*> copy_to_delete(workspaces_);
|
| STLDeleteElements(©_to_delete);
|
| }
|
| @@ -55,6 +54,19 @@ Workspace* WorkspaceManager::CreateWorkspace() {
|
| return workspace;
|
| }
|
|
|
| +void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) {
|
| + DCHECK(std::find(workspaces_.begin(),
|
| + workspaces_.end(),
|
| + workspace)
|
| + != workspaces_.end());
|
| + active_workspace_ = workspace;
|
| +
|
| + DCHECK(!workspaces_.empty());
|
| +
|
| + is_overview_ = false;
|
| + UpdateViewport();
|
| +}
|
| +
|
| Workspace* WorkspaceManager::GetActiveWorkspace() const {
|
| return active_workspace_;
|
| }
|
| @@ -165,21 +177,13 @@ void WorkspaceManager::RotateWindows(aura::Window* source,
|
| }
|
| }
|
|
|
| -////////////////////////////////////////////////////////////////////////////////
|
| -// WorkspaceManager, Overridden from aura::DesktopObserver:
|
| -
|
| -void WorkspaceManager::OnDesktopResized(const gfx::Size& new_size) {
|
| - workspace_size_ =
|
| - gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size();
|
| +void WorkspaceManager::SetWorkspaceSize(const gfx::Size& workspace_size) {
|
| + if (workspace_size == workspace_size_)
|
| + return;
|
| + workspace_size_ = workspace_size;
|
| LayoutWorkspaces();
|
| }
|
|
|
| -void WorkspaceManager::OnActiveWindowChanged(aura::Window* active) {
|
| - Workspace* workspace = FindBy(active);
|
| - if (workspace)
|
| - SetActiveWorkspace(workspace);
|
| -}
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // WorkspaceManager, private:
|
|
|
| @@ -202,19 +206,6 @@ void WorkspaceManager::RemoveWorkspace(Workspace* workspace) {
|
| LayoutWorkspaces();
|
| }
|
|
|
| -void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) {
|
| - DCHECK(std::find(workspaces_.begin(),
|
| - workspaces_.end(),
|
| - workspace)
|
| - != workspaces_.end());
|
| - active_workspace_ = workspace;
|
| -
|
| - DCHECK(!workspaces_.empty());
|
| -
|
| - is_overview_ = false;
|
| - UpdateViewport();
|
| -}
|
| -
|
| gfx::Rect WorkspaceManager::GetWorkAreaBounds(
|
| const gfx::Rect& workspace_bounds) {
|
| gfx::Rect bounds = workspace_bounds;
|
| @@ -253,4 +244,5 @@ void WorkspaceManager::UpdateViewport() {
|
| }
|
| }
|
|
|
| +} // namespace internal
|
| } // namespace aura_shell
|
|
|