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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 if (observer) | 716 if (observer) |
717 status_animation_setter.AddObserver(observer); | 717 status_animation_setter.AddObserver(observer); |
718 | 718 |
719 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); | 719 GetLayer(shelf_)->SetOpacity(target_bounds.opacity); |
720 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( | 720 shelf_->SetBounds(ScreenUtil::ConvertRectToScreen( |
721 shelf_->GetNativeView()->parent(), | 721 shelf_->GetNativeView()->parent(), |
722 target_bounds.shelf_bounds_in_root)); | 722 target_bounds.shelf_bounds_in_root)); |
723 | 723 |
724 GetLayer(shelf_->status_area_widget())->SetOpacity( | 724 GetLayer(shelf_->status_area_widget())->SetOpacity( |
725 target_bounds.status_opacity); | 725 target_bounds.status_opacity); |
| 726 |
| 727 // Having a window which is visible but does not have an opacity is an illegal |
| 728 // state. We therefore show / hide the shelf here if required. |
| 729 if (!target_bounds.status_opacity) |
| 730 shelf_->status_area_widget()->Hide(); |
| 731 else if (target_bounds.status_opacity) |
| 732 shelf_->status_area_widget()->Show(); |
| 733 |
726 // TODO(harrym): Once status area widget is a child view of shelf | 734 // TODO(harrym): Once status area widget is a child view of shelf |
727 // this can be simplified. | 735 // this can be simplified. |
728 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 736 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
729 status_bounds.set_x(status_bounds.x() + | 737 status_bounds.set_x(status_bounds.x() + |
730 target_bounds.shelf_bounds_in_root.x()); | 738 target_bounds.shelf_bounds_in_root.x()); |
731 status_bounds.set_y(status_bounds.y() + | 739 status_bounds.set_y(status_bounds.y() + |
732 target_bounds.shelf_bounds_in_root.y()); | 740 target_bounds.shelf_bounds_in_root.y()); |
733 shelf_->status_area_widget()->SetBounds( | 741 shelf_->status_area_widget()->SetBounds( |
734 ScreenUtil::ConvertRectToScreen( | 742 ScreenUtil::ConvertRectToScreen( |
735 shelf_->status_area_widget()->GetNativeView()->parent(), | 743 shelf_->status_area_widget()->GetNativeView()->parent(), |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1201 |
1194 void ShelfLayoutManager::SessionStateChanged( | 1202 void ShelfLayoutManager::SessionStateChanged( |
1195 SessionStateDelegate::SessionState state) { | 1203 SessionStateDelegate::SessionState state) { |
1196 TargetBounds target_bounds; | 1204 TargetBounds target_bounds; |
1197 CalculateTargetBounds(state_, &target_bounds); | 1205 CalculateTargetBounds(state_, &target_bounds); |
1198 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1206 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
1199 UpdateVisibilityState(); | 1207 UpdateVisibilityState(); |
1200 } | 1208 } |
1201 | 1209 |
1202 } // namespace ash | 1210 } // namespace ash |
OLD | NEW |