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

Side by Side Diff: ash/wm/workspace/workspace_manager.cc

Issue 9699013: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/workspace/workspace_manager.h" 5 #include "ash/wm/workspace/workspace_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/property_util.h" 11 #include "ash/wm/property_util.h"
12 #include "ash/wm/shelf_layout_manager.h" 12 #include "ash/wm/shelf_layout_manager.h"
13 #include "ash/wm/window_animations.h" 13 #include "ash/wm/window_animations.h"
14 #include "ash/wm/window_resizer.h" 14 #include "ash/wm/window_resizer.h"
15 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "ash/wm/workspace/managed_workspace.h" 16 #include "ash/wm/workspace/managed_workspace.h"
17 #include "ash/wm/workspace/maximized_workspace.h" 17 #include "ash/wm/workspace/maximized_workspace.h"
18 #include "base/auto_reset.h" 18 #include "base/auto_reset.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/stl_util.h" 20 #include "base/stl_util.h"
21 #include "ui/aura/env.h"
21 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
22 #include "ui/aura/root_window.h" 23 #include "ui/aura/root_window.h"
24 #include "ui/aura/monitor.h"
25 #include "ui/aura/monitor_manager.h"
23 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
24 #include "ui/base/ui_base_types.h" 27 #include "ui/base/ui_base_types.h"
25 #include "ui/gfx/compositor/layer.h" 28 #include "ui/gfx/compositor/layer.h"
26 #include "ui/gfx/compositor/layer_animator.h" 29 #include "ui/gfx/compositor/layer_animator.h"
27 #include "ui/gfx/compositor/scoped_layer_animation_settings.h" 30 #include "ui/gfx/compositor/scoped_layer_animation_settings.h"
28 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
29 #include "ui/gfx/transform.h" 32 #include "ui/gfx/transform.h"
30 33
31 namespace { 34 namespace {
32 35
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 NOTIMPLEMENTED(); 153 NOTIMPLEMENTED();
151 } 154 }
152 155
153 void WorkspaceManager::SetWorkspaceSize(const gfx::Size& workspace_size) { 156 void WorkspaceManager::SetWorkspaceSize(const gfx::Size& workspace_size) {
154 if (workspace_size == workspace_size_) 157 if (workspace_size == workspace_size_)
155 return; 158 return;
156 workspace_size_ = workspace_size; 159 workspace_size_ = workspace_size;
157 SetWorkspaceBounds(); 160 SetWorkspaceBounds();
158 } 161 }
159 162
160 void WorkspaceManager::OnScreenWorkAreaInsetsChanged() { 163 void WorkspaceManager::OnMonitorWorkAreaInsetsChanged() {
161 SetWorkspaceBounds(); 164 SetWorkspaceBounds();
162 } 165 }
163 166
164 gfx::Rect WorkspaceManager::AlignBoundsToGrid(const gfx::Rect& bounds) { 167 gfx::Rect WorkspaceManager::AlignBoundsToGrid(const gfx::Rect& bounds) {
165 if (grid_size_ <= 1) 168 if (grid_size_ <= 1)
166 return bounds; 169 return bounds;
167 return AlignRectToGrid(bounds, grid_size_); 170 return AlignRectToGrid(bounds, grid_size_);
168 } 171 }
169 172
170 void WorkspaceManager::ShowStateChanged(aura::Window* window) { 173 void WorkspaceManager::ShowStateChanged(aura::Window* window) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 active_workspace_ = workspace; 282 active_workspace_ = workspace;
280 if (active_workspace_) { 283 if (active_workspace_) {
281 SetVisibilityOfWorkspaceWindows(active_workspace_, 284 SetVisibilityOfWorkspaceWindows(active_workspace_,
282 last_active ? ANIMATE : DONT_ANIMATE, true); 285 last_active ? ANIMATE : DONT_ANIMATE, true);
283 UpdateShelfVisibility(); 286 UpdateShelfVisibility();
284 } 287 }
285 288
286 is_overview_ = false; 289 is_overview_ = false;
287 } 290 }
288 291
289 gfx::Rect WorkspaceManager::GetWorkAreaBounds() { 292 gfx::Rect WorkspaceManager::GetWorkAreaBounds() const {
290 gfx::Rect bounds(workspace_size_); 293 gfx::Rect bounds(workspace_size_);
291 bounds.Inset(Shell::GetInstance()->screen()->work_area_insets()); 294 const aura::MonitorManager* monitor_manager =
295 aura::Env::GetInstance()->monitor_manager();
296 const aura::Monitor* monitor =
297 monitor_manager->GetMonitorNearestWindow(contents_view_);
298 bounds.Inset(monitor->work_area_insets());
292 return bounds; 299 return bounds;
293 } 300 }
294 301
295 // Returns the index of the workspace that contains the |window|. 302 // Returns the index of the workspace that contains the |window|.
296 int WorkspaceManager::GetWorkspaceIndexContaining(aura::Window* window) const { 303 int WorkspaceManager::GetWorkspaceIndexContaining(aura::Window* window) const {
297 for (Workspaces::const_iterator i = workspaces_.begin(); 304 for (Workspaces::const_iterator i = workspaces_.begin();
298 i != workspaces_.end(); 305 i != workspaces_.end();
299 ++i) { 306 ++i) {
300 if ((*i)->Contains(window)) 307 if ((*i)->Contains(window))
301 return i - workspaces_.begin(); 308 return i - workspaces_.begin();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (type == Workspace::TYPE_MAXIMIZED) 364 if (type == Workspace::TYPE_MAXIMIZED)
358 workspace = new MaximizedWorkspace(this); 365 workspace = new MaximizedWorkspace(this);
359 else 366 else
360 workspace = new ManagedWorkspace(this); 367 workspace = new ManagedWorkspace(this);
361 AddWorkspace(workspace); 368 AddWorkspace(workspace);
362 return workspace; 369 return workspace;
363 } 370 }
364 371
365 } // namespace internal 372 } // namespace internal
366 } // namespace ash 373 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698