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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 311 } |
312 | 312 |
313 void ShelfLayoutManager::UpdateVisibilityState() { | 313 void ShelfLayoutManager::UpdateVisibilityState() { |
314 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { | 314 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { |
315 SetState(SHELF_VISIBLE); | 315 SetState(SHELF_VISIBLE); |
316 } else { | 316 } else { |
317 // TODO(zelidrag): Verify shelf drag animation still shows on the device | 317 // TODO(zelidrag): Verify shelf drag animation still shows on the device |
318 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. | 318 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. |
319 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); | 319 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
320 switch (window_state) { | 320 switch (window_state) { |
321 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: | 321 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: { |
322 if (FullscreenWithHiddenShelf()) { | 322 const aura::Window* fullscreen_window = GetRootWindowController( |
| 323 root_window_)->GetWindowForFullscreenMode(); |
| 324 if (fullscreen_window && wm::GetWindowState(fullscreen_window)-> |
| 325 hide_shelf_when_fullscreen()) { |
323 SetState(SHELF_HIDDEN); | 326 SetState(SHELF_HIDDEN); |
324 } else { | 327 } else { |
325 // The shelf is sometimes not hidden when in immersive fullscreen. | 328 // The shelf is sometimes not hidden when in immersive fullscreen. |
326 // Force the shelf to be auto hidden in this case. | 329 // Force the shelf to be auto hidden in this case. |
327 SetState(SHELF_AUTO_HIDE); | 330 SetState(SHELF_AUTO_HIDE); |
328 } | 331 } |
329 break; | 332 break; |
| 333 } |
| 334 |
330 case WORKSPACE_WINDOW_STATE_MAXIMIZED: | 335 case WORKSPACE_WINDOW_STATE_MAXIMIZED: |
331 SetState(CalculateShelfVisibility()); | 336 SetState(CalculateShelfVisibility()); |
332 break; | 337 break; |
| 338 |
333 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: | 339 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: |
334 case WORKSPACE_WINDOW_STATE_DEFAULT: | 340 case WORKSPACE_WINDOW_STATE_DEFAULT: |
335 SetState(CalculateShelfVisibility()); | 341 SetState(CalculateShelfVisibility()); |
336 SetWindowOverlapsShelf(window_state == | 342 SetWindowOverlapsShelf(window_state == |
337 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); | 343 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); |
338 break; | 344 break; |
339 } | 345 } |
340 } | 346 } |
341 } | 347 } |
342 | 348 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active, | 536 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active, |
531 aura::Window* lost_active) { | 537 aura::Window* lost_active) { |
532 UpdateAutoHideStateNow(); | 538 UpdateAutoHideStateNow(); |
533 } | 539 } |
534 | 540 |
535 bool ShelfLayoutManager::IsHorizontalAlignment() const { | 541 bool ShelfLayoutManager::IsHorizontalAlignment() const { |
536 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || | 542 return GetAlignment() == SHELF_ALIGNMENT_BOTTOM || |
537 GetAlignment() == SHELF_ALIGNMENT_TOP; | 543 GetAlignment() == SHELF_ALIGNMENT_TOP; |
538 } | 544 } |
539 | 545 |
540 bool ShelfLayoutManager::FullscreenWithHiddenShelf() const { | |
541 RootWindowController* controller = GetRootWindowController(root_window_); | |
542 if (!controller) | |
543 return false; | |
544 const aura::Window* window = controller->GetTopmostFullscreenWindow(); | |
545 if (!window) | |
546 return false; | |
547 return wm::GetWindowState(window)->hide_shelf_when_fullscreen(); | |
548 } | |
549 | |
550 // static | 546 // static |
551 ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { | 547 ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { |
552 ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); | 548 ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); |
553 return shelf ? shelf->shelf_layout_manager() : NULL; | 549 return shelf ? shelf->shelf_layout_manager() : NULL; |
554 } | 550 } |
555 | 551 |
556 //////////////////////////////////////////////////////////////////////////////// | 552 //////////////////////////////////////////////////////////////////////////////// |
557 // ShelfLayoutManager, private: | 553 // ShelfLayoutManager, private: |
558 | 554 |
559 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} | 555 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 return gfx::Insets(0, distance, 0, 0); | 1156 return gfx::Insets(0, distance, 0, 0); |
1161 case SHELF_ALIGNMENT_TOP: | 1157 case SHELF_ALIGNMENT_TOP: |
1162 return gfx::Insets(0, 0, distance, 0); | 1158 return gfx::Insets(0, 0, distance, 0); |
1163 } | 1159 } |
1164 NOTREACHED(); | 1160 NOTREACHED(); |
1165 return gfx::Insets(); | 1161 return gfx::Insets(); |
1166 } | 1162 } |
1167 | 1163 |
1168 } // namespace internal | 1164 } // namespace internal |
1169 } // namespace ash | 1165 } // namespace ash |
OLD | NEW |