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/workspace.h" | 5 #include "ui/aura_shell/workspace/workspace.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/aura_shell/property_util.h" | 13 #include "ui/aura_shell/property_util.h" |
| 14 #include "ui/aura_shell/window_util.h" |
14 #include "ui/aura_shell/workspace/workspace_manager.h" | 15 #include "ui/aura_shell/workspace/workspace_manager.h" |
15 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
16 #include "ui/gfx/compositor/layer.h" | 17 #include "ui/gfx/compositor/layer.h" |
17 #include "ui/gfx/compositor/layer_animator.h" | 18 #include "ui/gfx/compositor/layer_animator.h" |
18 | 19 |
19 namespace { | 20 namespace { |
20 // Horizontal margin between windows. | 21 // Horizontal margin between windows. |
21 const int kWindowHorizontalMargin = 10; | 22 const int kWindowHorizontalMargin = 10; |
22 | 23 |
23 // Maximum number of windows a workspace can have. | 24 // Maximum number of windows a workspace can have. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 windows_.erase(std::find(windows_.begin(), windows_.end(), window)); | 89 windows_.erase(std::find(windows_.begin(), windows_.end(), window)); |
89 Layout(NULL); | 90 Layout(NULL); |
90 } | 91 } |
91 | 92 |
92 bool Workspace::Contains(aura::Window* window) const { | 93 bool Workspace::Contains(aura::Window* window) const { |
93 return std::find(windows_.begin(), windows_.end(), window) != windows_.end(); | 94 return std::find(windows_.begin(), windows_.end(), window) != windows_.end(); |
94 } | 95 } |
95 | 96 |
96 aura::Window* Workspace::FindRotateWindowForLocation( | 97 aura::Window* Workspace::FindRotateWindowForLocation( |
97 const gfx::Point& position) { | 98 const gfx::Point& position) { |
98 aura::Window* active = aura::RootWindow::GetInstance()->active_window(); | 99 aura::Window* active = aura_shell::GetActiveWindow(); |
99 if (GetTotalWindowsWidth() < bounds_.width()) { | 100 if (GetTotalWindowsWidth() < bounds_.width()) { |
100 // If all windows fit to the width of the workspace, it returns the | 101 // If all windows fit to the width of the workspace, it returns the |
101 // window which contains |position|'s x coordinate. | 102 // window which contains |position|'s x coordinate. |
102 for (aura::Window::Windows::const_iterator i = windows_.begin(); | 103 for (aura::Window::Windows::const_iterator i = windows_.begin(); |
103 i != windows_.end(); | 104 i != windows_.end(); |
104 ++i) { | 105 ++i) { |
105 if (active == *i) | 106 if (active == *i) |
106 continue; | 107 continue; |
107 gfx::Rect bounds = (*i)->GetTargetBounds(); | 108 gfx::Rect bounds = (*i)->GetTargetBounds(); |
108 if (bounds.x() < position.x() && position.x() < bounds.right()) | 109 if (bounds.x() < position.x() && position.x() < bounds.right()) |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 276 |
276 // static | 277 // static |
277 size_t Workspace::SetMaxWindowsCount(size_t max) { | 278 size_t Workspace::SetMaxWindowsCount(size_t max) { |
278 int old = g_max_windows_per_workspace; | 279 int old = g_max_windows_per_workspace; |
279 g_max_windows_per_workspace = max; | 280 g_max_windows_per_workspace = max; |
280 return old; | 281 return old; |
281 } | 282 } |
282 | 283 |
283 } // namespace internal | 284 } // namespace internal |
284 } // namespace aura_shell | 285 } // namespace aura_shell |
OLD | NEW |