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

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

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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
« no previous file with comments | « ui/aura_shell/window_util.cc ('k') | ui/aura_shell/workspace/workspace_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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
OLDNEW
« no previous file with comments | « ui/aura_shell/window_util.cc ('k') | ui/aura_shell/workspace/workspace_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698