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/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 void ShelfLayoutManager::OnWindowActivated(aura::Window* active, | 488 void ShelfLayoutManager::OnWindowActivated(aura::Window* active, |
489 aura::Window* old_active) { | 489 aura::Window* old_active) { |
490 UpdateAutoHideStateNow(); | 490 UpdateAutoHideStateNow(); |
491 } | 491 } |
492 | 492 |
493 //////////////////////////////////////////////////////////////////////////////// | 493 //////////////////////////////////////////////////////////////////////////////// |
494 // ShelfLayoutManager, private: | 494 // ShelfLayoutManager, private: |
495 | 495 |
496 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} | 496 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} |
497 | 497 |
498 gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( | |
499 aura::Window* window) { | |
500 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); | |
501 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { | |
502 AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds); | |
503 return bounds; | |
504 } | |
505 // SHELF_AUTO_HIDE_BEHAVIOR_NEVER maximized windows don't get any taller. | |
506 return GetUnmaximizedWorkAreaBounds(window); | |
507 } | |
508 | |
509 gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( | |
510 aura::Window* window) { | |
511 gfx::Rect bounds(ScreenAsh::GetDisplayBoundsInParent(window)); | |
512 int size; | |
513 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { | |
514 size = kAutoHideSize; | |
515 } else { | |
516 int width, height; | |
517 GetShelfSize(&width, &height); | |
518 size = std::max(width, height); | |
519 } | |
520 AdjustBoundsBasedOnAlignment(size, &bounds); | |
521 return bounds; | |
522 } | |
523 | |
524 void ShelfLayoutManager::SetState(VisibilityState visibility_state) { | 498 void ShelfLayoutManager::SetState(VisibilityState visibility_state) { |
525 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 499 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
526 State state; | 500 State state; |
527 state.visibility_state = visibility_state; | 501 state.visibility_state = visibility_state; |
528 state.auto_hide_state = CalculateAutoHideState(visibility_state); | 502 state.auto_hide_state = CalculateAutoHideState(visibility_state); |
529 state.is_screen_locked = delegate && delegate->IsScreenLocked(); | 503 state.is_screen_locked = delegate && delegate->IsScreenLocked(); |
530 | 504 |
531 // It's possible for SetState() when a window becomes maximized but the state | 505 // It's possible for SetState() when a window becomes maximized but the state |
532 // won't have changed value. Do the dimming check before the early exit. | 506 // won't have changed value. Do the dimming check before the early exit. |
533 if (launcher_ && workspace_controller_) { | 507 if (launcher_ && workspace_controller_) { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 892 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
919 if (state.visibility_state == VISIBLE) | 893 if (state.visibility_state == VISIBLE) |
920 return size; | 894 return size; |
921 if (state.visibility_state == AUTO_HIDE) | 895 if (state.visibility_state == AUTO_HIDE) |
922 return kAutoHideSize; | 896 return kAutoHideSize; |
923 return 0; | 897 return 0; |
924 } | 898 } |
925 | 899 |
926 } // namespace internal | 900 } // namespace internal |
927 } // namespace ash | 901 } // namespace ash |
OLD | NEW |