| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 894 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 921 if (state.visibility_state == VISIBLE) | 895 if (state.visibility_state == VISIBLE) |
| 922 return size; | 896 return size; |
| 923 if (state.visibility_state == AUTO_HIDE) | 897 if (state.visibility_state == AUTO_HIDE) |
| 924 return kAutoHideSize; | 898 return kAutoHideSize; |
| 925 return 0; | 899 return 0; |
| 926 } | 900 } |
| 927 | 901 |
| 928 } // namespace internal | 902 } // namespace internal |
| 929 } // namespace ash | 903 } // namespace ash |
| OLD | NEW |