OLD | NEW |
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_util.h" | 14 #include "ash/wm/window_util.h" |
15 #include "ash/wm/workspace/managed_workspace.h" | 15 #include "ash/wm/workspace/managed_workspace.h" |
16 #include "ash/wm/workspace/maximized_workspace.h" | 16 #include "ash/wm/workspace/maximized_workspace.h" |
17 #include "base/auto_reset.h" | 17 #include "base/auto_reset.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
21 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
22 #include "ui/aura/root_window.h" | 22 #include "ui/aura/root_window.h" |
23 #include "ui/aura/monitor.h" | |
24 #include "ui/aura/monitor_manager.h" | |
25 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
26 #include "ui/base/ui_base_types.h" | 24 #include "ui/base/ui_base_types.h" |
27 #include "ui/gfx/compositor/layer.h" | 25 #include "ui/gfx/compositor/layer.h" |
28 #include "ui/gfx/compositor/layer_animator.h" | 26 #include "ui/gfx/compositor/layer_animator.h" |
29 #include "ui/gfx/compositor/scoped_layer_animation_settings.h" | 27 #include "ui/gfx/compositor/scoped_layer_animation_settings.h" |
30 #include "ui/gfx/screen.h" | 28 #include "ui/gfx/screen.h" |
31 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
32 | 30 |
33 namespace { | 31 namespace { |
34 | 32 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 130 |
133 void WorkspaceManager::UpdateShelfVisibility() { | 131 void WorkspaceManager::UpdateShelfVisibility() { |
134 shelf_->UpdateVisibilityState(); | 132 shelf_->UpdateVisibilityState(); |
135 } | 133 } |
136 | 134 |
137 WorkspaceManager::WindowState WorkspaceManager::GetWindowState() { | 135 WorkspaceManager::WindowState WorkspaceManager::GetWindowState() { |
138 if (!shelf_ || !active_workspace_) | 136 if (!shelf_ || !active_workspace_) |
139 return WINDOW_STATE_DEFAULT; | 137 return WINDOW_STATE_DEFAULT; |
140 | 138 |
141 // TODO: this code needs to be made multi-monitor aware. | 139 // TODO: this code needs to be made multi-monitor aware. |
142 gfx::Rect bounds(gfx::Screen::GetMonitorAreaNearestWindow(contents_view_)); | 140 gfx::Rect bounds( |
| 141 gfx::Screen::GetMonitorNearestWindow(contents_view_).bounds()); |
143 bounds.set_height(bounds.height() - shelf_->shelf_height()); | 142 bounds.set_height(bounds.height() - shelf_->shelf_height()); |
144 const aura::Window::Windows& windows(contents_view_->children()); | 143 const aura::Window::Windows& windows(contents_view_->children()); |
145 bool window_overlaps_launcher = false; | 144 bool window_overlaps_launcher = false; |
146 for (aura::Window::Windows::const_iterator i = windows.begin(); | 145 for (aura::Window::Windows::const_iterator i = windows.begin(); |
147 i != windows.end(); ++i) { | 146 i != windows.end(); ++i) { |
148 ui::Layer* layer = (*i)->layer(); | 147 ui::Layer* layer = (*i)->layer(); |
149 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) | 148 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) |
150 continue; | 149 continue; |
151 if (wm::IsWindowMaximized(*i)) | 150 if (wm::IsWindowMaximized(*i)) |
152 return WINDOW_STATE_MAXIMIZED; | 151 return WINDOW_STATE_MAXIMIZED; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return workspace; | 327 return workspace; |
329 } | 328 } |
330 | 329 |
331 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) { | 330 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) { |
332 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty()) | 331 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty()) |
333 delete workspace; | 332 delete workspace; |
334 } | 333 } |
335 | 334 |
336 } // namespace internal | 335 } // namespace internal |
337 } // namespace ash | 336 } // namespace ash |
OLD | NEW |