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

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

Issue 10852003: Changes all non-workspace code to talk to WorkspaceManager via (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more constness Created 8 years, 4 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
« no previous file with comments | « ash/wm/workspace/workspace_manager.h ('k') | ash/wm/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) 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"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 Workspace* workspace = FindBy(window); 132 Workspace* workspace = FindBy(window);
133 if (workspace) 133 if (workspace)
134 workspace->Activate(); 134 workspace->Activate();
135 } 135 }
136 136
137 void WorkspaceManager::UpdateShelfVisibility() { 137 void WorkspaceManager::UpdateShelfVisibility() {
138 if (shelf_) 138 if (shelf_)
139 shelf_->UpdateVisibilityState(); 139 shelf_->UpdateVisibilityState();
140 } 140 }
141 141
142 WorkspaceManager::WindowState WorkspaceManager::GetWindowState() { 142 WorkspaceWindowState WorkspaceManager::GetWindowState() const {
143 if (!shelf_ || !active_workspace_) 143 if (!shelf_ || !active_workspace_)
144 return WINDOW_STATE_DEFAULT; 144 return WORKSPACE_WINDOW_STATE_DEFAULT;
145 145
146 // TODO: this code needs to be made multi-display aware. 146 // TODO: this code needs to be made multi-display aware.
147 gfx::Rect shelf_bounds(shelf_->GetIdealBounds()); 147 gfx::Rect shelf_bounds(shelf_->GetIdealBounds());
148 const aura::Window::Windows& windows(contents_view_->children()); 148 const aura::Window::Windows& windows(contents_view_->children());
149 bool window_overlaps_launcher = false; 149 bool window_overlaps_launcher = false;
150 bool has_maximized_window = false; 150 bool has_maximized_window = false;
151 for (aura::Window::Windows::const_iterator i = windows.begin(); 151 for (aura::Window::Windows::const_iterator i = windows.begin();
152 i != windows.end(); ++i) { 152 i != windows.end(); ++i) {
153 ui::Layer* layer = (*i)->layer(); 153 ui::Layer* layer = (*i)->layer();
154 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f) 154 if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f)
155 continue; 155 continue;
156 if (wm::IsWindowMaximized(*i)) { 156 if (wm::IsWindowMaximized(*i)) {
157 // An untracked window may still be fullscreen so we keep iterating when 157 // An untracked window may still be fullscreen so we keep iterating when
158 // we hit a maximized window. 158 // we hit a maximized window.
159 has_maximized_window = true; 159 has_maximized_window = true;
160 } else if (wm::IsWindowFullscreen(*i)) { 160 } else if (wm::IsWindowFullscreen(*i)) {
161 return WINDOW_STATE_FULL_SCREEN; 161 return WORKSPACE_WINDOW_STATE_FULL_SCREEN;
162 } 162 }
163 if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds)) 163 if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds))
164 window_overlaps_launcher = true; 164 window_overlaps_launcher = true;
165 } 165 }
166 if (has_maximized_window) 166 if (has_maximized_window)
167 return WINDOW_STATE_MAXIMIZED; 167 return WORKSPACE_WINDOW_STATE_MAXIMIZED;
168 168
169 return window_overlaps_launcher ? WINDOW_STATE_WINDOW_OVERLAPS_SHELF : 169 return window_overlaps_launcher ?
170 WINDOW_STATE_DEFAULT; 170 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF :
171 WORKSPACE_WINDOW_STATE_DEFAULT;
171 } 172 }
172 173
173 void WorkspaceManager::ShowStateChanged(aura::Window* window) { 174 void WorkspaceManager::ShowStateChanged(aura::Window* window) {
174 Workspace* workspace = FindBy(window); 175 Workspace* workspace = FindBy(window);
175 if (!workspace) 176 if (!workspace)
176 return; 177 return;
177 if (!ShouldManageWindow(window)) { 178 if (!ShouldManageWindow(window)) {
178 RemoveWindow(window); 179 RemoveWindow(window);
179 } else { 180 } else {
180 Workspace::Type old_type = workspace->type(); 181 Workspace::Type old_type = workspace->type();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 return workspace; 348 return workspace;
348 } 349 }
349 350
350 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) { 351 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) {
351 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty()) 352 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty())
352 delete workspace; 353 delete workspace;
353 } 354 }
354 355
355 } // namespace internal 356 } // namespace internal
356 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager.h ('k') | ash/wm/workspace/workspace_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698