| 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 #include "ui/aura_shell/workspace/workspace_manager.h" | 4 #include "ui/aura_shell/workspace/workspace_manager.h" |
| 5 | 5 |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "ui/aura_shell/workspace/workspace.h" | 10 #include "ui/aura_shell/workspace/workspace.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // The horizontal margein between workspaces in pixels. | 14 // The horizontal margein between workspaces in pixels. |
| 15 const int kWorkspaceHorizontalMargin = 50; | 15 const int kWorkspaceHorizontalMargin = 50; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace aura_shell { | 18 namespace aura_shell { |
| 19 | 19 |
| 20 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
| 21 // WindowManager, public: | 21 // WindowManager, public: |
| 22 | 22 |
| 23 WorkspaceManager::WorkspaceManager() | 23 WorkspaceManager::WorkspaceManager() |
| 24 : active_workspace_(NULL) { | 24 : active_workspace_(NULL) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 WorkspaceManager::~WorkspaceManager() { | 27 WorkspaceManager::~WorkspaceManager() { |
| 28 STLDeleteElements(&workspaces_); | 28 std::vector<Workspace*> copy_to_delete(workspaces_); |
| 29 STLDeleteElements(©_to_delete); |
| 29 } | 30 } |
| 30 | 31 |
| 31 Workspace* WorkspaceManager::CreateWorkspace() { | 32 Workspace* WorkspaceManager::CreateWorkspace() { |
| 32 return new Workspace(this); | 33 return new Workspace(this); |
| 33 } | 34 } |
| 34 | 35 |
| 35 Workspace* WorkspaceManager::GetActiveWorkspace() const { | 36 Workspace* WorkspaceManager::GetActiveWorkspace() const { |
| 36 return active_workspace_; | 37 return active_workspace_; |
| 37 } | 38 } |
| 38 | 39 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 89 |
| 89 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) { | 90 void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) { |
| 90 DCHECK(std::find(workspaces_.begin(), | 91 DCHECK(std::find(workspaces_.begin(), |
| 91 workspaces_.end(), | 92 workspaces_.end(), |
| 92 workspace) | 93 workspace) |
| 93 != workspaces_.end()); | 94 != workspaces_.end()); |
| 94 active_workspace_ = workspace; | 95 active_workspace_ = workspace; |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace aura_shell | 98 } // namespace aura_shell |
| OLD | NEW |