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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 653 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
654 } else { | 654 } else { |
655 StopAnimating(); | 655 StopAnimating(); |
656 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); | 656 shelf_animation_setter.SetTransitionDuration(base::TimeDelta()); |
657 status_animation_setter.SetTransitionDuration(base::TimeDelta()); | 657 status_animation_setter.SetTransitionDuration(base::TimeDelta()); |
658 } | 658 } |
659 if (observer) | 659 if (observer) |
660 status_animation_setter.AddObserver(observer); | 660 status_animation_setter.AddObserver(observer); |
661 | 661 |
662 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 662 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); |
663 // mash::wm::ShelfLayout manages window bounds when running mash_shell. | 663 // mash::wm::ShelfLayout manages window bounds when running in mash. |
664 if (!aura::GetMusWindow(shelf_->GetNativeWindow())) { | 664 if (!aura::GetMusWindow(shelf_->GetNativeWindow())) { |
665 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( | 665 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( |
666 shelf_->GetNativeView()->parent(), | 666 shelf_->GetNativeView()->parent(), |
667 target_bounds.shelf_bounds_in_root)); | 667 target_bounds.shelf_bounds_in_root)); |
668 } | 668 } |
669 | 669 |
670 GetLayer(shelf_->status_area_widget())->SetOpacity( | 670 GetLayer(shelf_->status_area_widget())->SetOpacity( |
671 target_bounds.status_opacity); | 671 target_bounds.status_opacity); |
672 | 672 |
673 // Having a window which is visible but does not have an opacity is an | 673 // Having a window which is visible but does not have an opacity is an |
674 // illegal state. We therefore hide the shelf here if required. | 674 // illegal state. We therefore hide the shelf here if required. |
675 if (!target_bounds.status_opacity) | 675 if (!target_bounds.status_opacity) |
676 shelf_->status_area_widget()->Hide(); | 676 shelf_->status_area_widget()->Hide(); |
677 // Setting visibility during an animation causes the visibility property to | 677 // Setting visibility during an animation causes the visibility property to |
678 // animate. Override the animation settings to immediately set the | 678 // animate. Override the animation settings to immediately set the |
679 // visibility property. Opacity will still animate. | 679 // visibility property. Opacity will still animate. |
680 | 680 |
681 // TODO(harrym): Once status area widget is a child view of shelf | 681 // TODO(harrym): Once status area widget is a child view of shelf |
682 // this can be simplified. | 682 // this can be simplified. |
683 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 683 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
684 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin()); | 684 status_bounds.Offset(target_bounds.shelf_bounds_in_root.OffsetFromOrigin()); |
685 // mash::wm::ShelfLayout manages window bounds when running mash_shell. | 685 // mash::wm::ShelfLayout manages window bounds when running mash. |
686 if (!aura::GetMusWindow(shelf_->GetNativeWindow())) { | 686 if (!aura::GetMusWindow(shelf_->GetNativeWindow())) { |
687 shelf_->status_area_widget()->SetBounds( | 687 shelf_->status_area_widget()->SetBounds( |
688 ScreenUtil::ConvertRectToScreen( | 688 ScreenUtil::ConvertRectToScreen( |
689 shelf_->status_area_widget()->GetNativeView()->parent(), | 689 shelf_->status_area_widget()->GetNativeView()->parent(), |
690 status_bounds)); | 690 status_bounds)); |
691 } | 691 } |
692 if (!state_.is_screen_locked) { | 692 if (!state_.is_screen_locked) { |
693 gfx::Insets insets; | 693 gfx::Insets insets; |
694 // If user session is blocked (login to new user session or add user to | 694 // If user session is blocked (login to new user session or add user to |
695 // the existing session - multi-profile) then give 100% of work area only | 695 // the existing session - multi-profile) then give 100% of work area only |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 return false; | 1160 return false; |
1161 } | 1161 } |
1162 if (session_state_delegate->IsUserSessionBlocked() || | 1162 if (session_state_delegate->IsUserSessionBlocked() || |
1163 state_.is_adding_user_screen) { | 1163 state_.is_adding_user_screen) { |
1164 return true; | 1164 return true; |
1165 } | 1165 } |
1166 return false; | 1166 return false; |
1167 } | 1167 } |
1168 | 1168 |
1169 } // namespace ash | 1169 } // namespace ash |
OLD | NEW |