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" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |