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 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 bool visible = shelf_->status_area_widget()->IsVisible(); | |
| 730 if (visible && !target_bounds.status_opacity) | |
|
sky
2014/05/13 21:43:07
Do you really care about the current visibility?
Mr4D (OOO till 08-26)
2014/05/13 22:08:17
Was only trying to avoid duplicate calls. But sinc
| |
| 731 shelf_->status_area_widget()->Hide(); | |
| 732 else if (!visible && target_bounds.status_opacity) | |
| 733 shelf_->status_area_widget()->Show(); | |
| 734 | |
| 726 // TODO(harrym): Once status area widget is a child view of shelf | 735 // TODO(harrym): Once status area widget is a child view of shelf |
| 727 // this can be simplified. | 736 // this can be simplified. |
| 728 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; | 737 gfx::Rect status_bounds = target_bounds.status_bounds_in_shelf; |
| 729 status_bounds.set_x(status_bounds.x() + | 738 status_bounds.set_x(status_bounds.x() + |
| 730 target_bounds.shelf_bounds_in_root.x()); | 739 target_bounds.shelf_bounds_in_root.x()); |
| 731 status_bounds.set_y(status_bounds.y() + | 740 status_bounds.set_y(status_bounds.y() + |
| 732 target_bounds.shelf_bounds_in_root.y()); | 741 target_bounds.shelf_bounds_in_root.y()); |
| 733 shelf_->status_area_widget()->SetBounds( | 742 shelf_->status_area_widget()->SetBounds( |
| 734 ScreenUtil::ConvertRectToScreen( | 743 ScreenUtil::ConvertRectToScreen( |
| 735 shelf_->status_area_widget()->GetNativeView()->parent(), | 744 shelf_->status_area_widget()->GetNativeView()->parent(), |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1193 | 1202 |
| 1194 void ShelfLayoutManager::SessionStateChanged( | 1203 void ShelfLayoutManager::SessionStateChanged( |
| 1195 SessionStateDelegate::SessionState state) { | 1204 SessionStateDelegate::SessionState state) { |
| 1196 TargetBounds target_bounds; | 1205 TargetBounds target_bounds; |
| 1197 CalculateTargetBounds(state_, &target_bounds); | 1206 CalculateTargetBounds(state_, &target_bounds); |
| 1198 UpdateBoundsAndOpacity(target_bounds, true, NULL); | 1207 UpdateBoundsAndOpacity(target_bounds, true, NULL); |
| 1199 UpdateVisibilityState(); | 1208 UpdateVisibilityState(); |
| 1200 } | 1209 } |
| 1201 | 1210 |
| 1202 } // namespace ash | 1211 } // namespace ash |
| OLD | NEW |