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

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

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