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

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

Issue 9817026: Changes how we detect whether the launcher should be shown when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment 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
« no previous file with comments | « ash/wm/shelf_layout_manager_unittest.cc ('k') | ui/gfx/compositor/layer_animator.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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 } 152 }
153 153
154 gfx::Rect WorkspaceManager::AlignBoundsToGrid(const gfx::Rect& bounds) { 154 gfx::Rect WorkspaceManager::AlignBoundsToGrid(const gfx::Rect& bounds) {
155 if (grid_size_ <= 1) 155 if (grid_size_ <= 1)
156 return bounds; 156 return bounds;
157 return AlignRectToGrid(bounds, grid_size_); 157 return AlignRectToGrid(bounds, grid_size_);
158 } 158 }
159 159
160 void WorkspaceManager::UpdateShelfVisibility() { 160 void WorkspaceManager::UpdateShelfVisibility() {
161 if (!shelf_ || !active_workspace_) { 161 if (!shelf_ || !active_workspace_) {
162 shelf_->SetState(ShelfLayoutManager::VISIBLE, 162 shelf_->SetState(ShelfLayoutManager::VISIBLE);
163 ShelfLayoutManager::AUTO_HIDE_SHOWN);
164 shelf_->SetWindowOverlapsShelf(false); 163 shelf_->SetWindowOverlapsShelf(false);
165 return; 164 return;
166 } 165 }
167 166
168 // TODO: this code needs to be made multi-monitor aware. 167 // TODO: this code needs to be made multi-monitor aware.
169 gfx::Rect bounds(gfx::Screen::GetMonitorAreaNearestWindow(contents_view_)); 168 gfx::Rect bounds(gfx::Screen::GetMonitorAreaNearestWindow(contents_view_));
170 bounds.set_height(bounds.height() - shelf_->shelf_height()); 169 bounds.set_height(bounds.height() - shelf_->shelf_height());
171 const aura::Window::Windows& windows(contents_view_->children()); 170 const aura::Window::Windows& windows(contents_view_->children());
172 bool has_full_screen_window = false; 171 bool has_full_screen_window = false;
173 bool has_max_window = false; 172 bool has_max_window = false;
(...skipping 12 matching lines...) Expand all
186 if (wm::IsWindowFullscreen(*i)) { 185 if (wm::IsWindowFullscreen(*i)) {
187 has_full_screen_window = true; 186 has_full_screen_window = true;
188 break; 187 break;
189 } 188 }
190 if (!window_overlaps_launcher && (*i)->bounds().bottom() > bounds.bottom()) 189 if (!window_overlaps_launcher && (*i)->bounds().bottom() > bounds.bottom())
191 window_overlaps_launcher = true; 190 window_overlaps_launcher = true;
192 } 191 }
193 192
194 ShelfLayoutManager::VisibilityState visibility_state = 193 ShelfLayoutManager::VisibilityState visibility_state =
195 ShelfLayoutManager::VISIBLE; 194 ShelfLayoutManager::VISIBLE;
196 ShelfLayoutManager::AutoHideState auto_hide_state = 195 if (has_full_screen_window)
197 shelf_->auto_hide_state();
198 if (has_full_screen_window) {
199 visibility_state = ShelfLayoutManager::HIDDEN; 196 visibility_state = ShelfLayoutManager::HIDDEN;
200 } else if (has_max_window) { 197 else if (has_max_window)
201 visibility_state = ShelfLayoutManager::AUTO_HIDE; 198 visibility_state = ShelfLayoutManager::AUTO_HIDE;
202 } 199 shelf_->SetState(visibility_state);
203 shelf_->SetState(visibility_state, auto_hide_state);
204 shelf_->SetWindowOverlapsShelf(window_overlaps_launcher); 200 shelf_->SetWindowOverlapsShelf(window_overlaps_launcher);
205 } 201 }
206 202
207 void WorkspaceManager::ShowStateChanged(aura::Window* window) { 203 void WorkspaceManager::ShowStateChanged(aura::Window* window) {
208 if (!IsManagedWindow(window) || !FindBy(window)) 204 if (!IsManagedWindow(window) || !FindBy(window))
209 return; 205 return;
210 206
211 Workspace::Type old_type = FindBy(window)->type(); 207 Workspace::Type old_type = FindBy(window)->type();
212 Workspace::Type new_type = Workspace::TypeForWindow(window); 208 Workspace::Type new_type = Workspace::TypeForWindow(window);
213 if (new_type != old_type) 209 if (new_type != old_type)
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 return workspace; 371 return workspace;
376 } 372 }
377 373
378 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) { 374 void WorkspaceManager::CleanupWorkspace(Workspace* workspace) {
379 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty()) 375 if (workspace->type() != Workspace::TYPE_MANAGED && workspace->is_empty())
380 delete workspace; 376 delete workspace;
381 } 377 }
382 378
383 } // namespace internal 379 } // namespace internal
384 } // namespace ash 380 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/shelf_layout_manager_unittest.cc ('k') | ui/gfx/compositor/layer_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698