| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 state_.auto_hide_state == AUTO_HIDE_HIDDEN && | 561 state_.auto_hide_state == AUTO_HIDE_HIDDEN && |
| 562 state.visibility_state == VISIBLE) ? | 562 state.visibility_state == VISIBLE) ? |
| 563 internal::BackgroundAnimator::CHANGE_IMMEDIATE : | 563 internal::BackgroundAnimator::CHANGE_IMMEDIATE : |
| 564 internal::BackgroundAnimator::CHANGE_ANIMATE; | 564 internal::BackgroundAnimator::CHANGE_ANIMATE; |
| 565 StopAnimating(); | 565 StopAnimating(); |
| 566 | 566 |
| 567 State old_state = state_; | 567 State old_state = state_; |
| 568 state_ = state; | 568 state_ = state; |
| 569 TargetBounds target_bounds; | 569 TargetBounds target_bounds; |
| 570 CalculateTargetBounds(state_, &target_bounds); | 570 CalculateTargetBounds(state_, &target_bounds); |
| 571 const int animate_time_ms = | |
| 572 WorkspaceController::IsWorkspace2Enabled() ? kWorkspaceSwitchTimeMS : | |
| 573 130; | |
| 574 if (launcher_widget()) { | 571 if (launcher_widget()) { |
| 575 ui::ScopedLayerAnimationSettings launcher_animation_setter( | 572 ui::ScopedLayerAnimationSettings launcher_animation_setter( |
| 576 GetLayer(launcher_widget())->GetAnimator()); | 573 GetLayer(launcher_widget())->GetAnimator()); |
| 577 launcher_animation_setter.SetTransitionDuration( | 574 launcher_animation_setter.SetTransitionDuration( |
| 578 base::TimeDelta::FromMilliseconds(animate_time_ms)); | 575 base::TimeDelta::FromMilliseconds(kWorkspaceSwitchTimeMS)); |
| 579 launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | 576 launcher_animation_setter.SetTweenType(ui::Tween::EASE_OUT); |
| 580 GetLayer(launcher_widget())->SetBounds( | 577 GetLayer(launcher_widget())->SetBounds( |
| 581 target_bounds.launcher_bounds_in_root); | 578 target_bounds.launcher_bounds_in_root); |
| 582 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); | 579 GetLayer(launcher_widget())->SetOpacity(target_bounds.opacity); |
| 583 } | 580 } |
| 584 ui::ScopedLayerAnimationSettings status_animation_setter( | 581 ui::ScopedLayerAnimationSettings status_animation_setter( |
| 585 GetLayer(status_)->GetAnimator()); | 582 GetLayer(status_)->GetAnimator()); |
| 586 status_animation_setter.SetTransitionDuration( | 583 status_animation_setter.SetTransitionDuration( |
| 587 base::TimeDelta::FromMilliseconds(animate_time_ms)); | 584 base::TimeDelta::FromMilliseconds(kWorkspaceSwitchTimeMS)); |
| 588 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); | 585 status_animation_setter.SetTweenType(ui::Tween::EASE_OUT); |
| 589 | 586 |
| 590 // Delay updating the background when going from AUTO_HIDE_SHOWN to | 587 // Delay updating the background when going from AUTO_HIDE_SHOWN to |
| 591 // AUTO_HIDE_HIDDEN until the shelf animates out. Otherwise during the | 588 // AUTO_HIDE_HIDDEN until the shelf animates out. Otherwise during the |
| 592 // animation you see the background change. | 589 // animation you see the background change. |
| 593 // Also delay the animation when the shelf was hidden, and has just been made | 590 // Also delay the animation when the shelf was hidden, and has just been made |
| 594 // visible (e.g. using a gesture-drag). | 591 // visible (e.g. using a gesture-drag). |
| 595 bool delay_shelf_update = | 592 bool delay_shelf_update = |
| 596 state.visibility_state == AUTO_HIDE && | 593 state.visibility_state == AUTO_HIDE && |
| 597 state.auto_hide_state == AUTO_HIDE_HIDDEN && | 594 state.auto_hide_state == AUTO_HIDE_HIDDEN && |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 918 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 922 if (state.visibility_state == VISIBLE) | 919 if (state.visibility_state == VISIBLE) |
| 923 return size; | 920 return size; |
| 924 if (state.visibility_state == AUTO_HIDE) | 921 if (state.visibility_state == AUTO_HIDE) |
| 925 return kAutoHideSize; | 922 return kAutoHideSize; |
| 926 return 0; | 923 return 0; |
| 927 } | 924 } |
| 928 | 925 |
| 929 } // namespace internal | 926 } // namespace internal |
| 930 } // namespace ash | 927 } // namespace ash |
| OLD | NEW |