Chromium Code Reviews| 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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 | 679 |
| 680 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 680 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); |
| 681 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( | 681 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( |
| 682 shelf_->GetNativeView()->parent(), | 682 shelf_->GetNativeView()->parent(), |
| 683 target_bounds.shelf_bounds_in_root)); | 683 target_bounds.shelf_bounds_in_root)); |
| 684 | 684 |
| 685 GetLayer(shelf_->status_area_widget())->SetOpacity( | 685 GetLayer(shelf_->status_area_widget())->SetOpacity( |
| 686 target_bounds.status_opacity); | 686 target_bounds.status_opacity); |
| 687 | 687 |
| 688 // Having a window which is visible but does not have an opacity is an illegal | 688 // Having a window which is visible but does not have an opacity is an illegal |
| 689 // state. We therefore show / hide the shelf here if required. | 689 // state. We therefore hide the shelf here if required. |
| 690 if (!target_bounds.status_opacity) | 690 if (!target_bounds.status_opacity) { |
| 691 shelf_->status_area_widget()->Hide(); | 691 shelf_->status_area_widget()->Hide(); |
| 692 else if (target_bounds.status_opacity) | 692 } else { |
| 693 // Setting visibility during an animation causes the visibility property to | |
| 694 // animate. Override the animation settings to immediately set the | |
|
flackr
2014/09/23 21:18:40
I'd prefer to see the scope of the ScopedLayerAnim
jonross
2014/09/23 21:34:26
Done.
| |
| 695 // visibility property. Opacity will still animate. | |
| 696 ui::ScopedLayerAnimationSettings no_duration_show( | |
| 697 GetLayer(shelf_->status_area_widget())->GetAnimator()); | |
| 698 no_duration_show.SetTransitionDuration(base::TimeDelta()); | |
| 693 shelf_->status_area_widget()->Show(); | 699 shelf_->status_area_widget()->Show(); |
| 700 } | |
| 694 | 701 |
| 695 // TODO(harrym): Once status area widget is a child view of shelf | 702 // TODO(harrym): Once status area widget is a child view of shelf |
| 696 // this can be simplified. | 703 // this can be simplified. |
| 697 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 704 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
| 698 status_bounds.set_x(status_bounds.x() + | 705 status_bounds.set_x(status_bounds.x() + |
| 699 target_bounds.shelf_bounds_in_root.x()); | 706 target_bounds.shelf_bounds_in_root.x()); |
| 700 status_bounds.set_y(status_bounds.y() + | 707 status_bounds.set_y(status_bounds.y() + |
| 701 target_bounds.shelf_bounds_in_root.y()); | 708 target_bounds.shelf_bounds_in_root.y()); |
| 702 shelf_->status_area_widget()->SetBounds( | 709 shelf_->status_area_widget()->SetBounds( |
| 703 ScreenUtil::ConvertRectToScreen( | 710 ScreenUtil::ConvertRectToScreen( |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1140 | 1147 |
| 1141 void ShelfLayoutManager::SessionStateChanged( | 1148 void ShelfLayoutManager::SessionStateChanged( |
| 1142 SessionStateDelegate::SessionState state) { | 1149 SessionStateDelegate::SessionState state) { |
| 1143 TargetBounds target_bounds; | 1150 TargetBounds target_bounds; |
| 1144 CalculateTargetBounds(state_, &target_bounds); | 1151 CalculateTargetBounds(state_, &target_bounds); |
| 1145 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1152 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
| 1146 UpdateVisibilityState(); | 1153 UpdateVisibilityState(); |
| 1147 } | 1154 } |
| 1148 | 1155 |
| 1149 } // namespace ash | 1156 } // namespace ash |
| OLD | NEW |