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/common/shelf/shelf_layout_manager.h" | 5 #include "ash/common/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 // TODO(varkha): The functionality of managing insets for display areas | 707 // TODO(varkha): The functionality of managing insets for display areas |
708 // should probably be pushed to a separate component. This would simplify or | 708 // should probably be pushed to a separate component. This would simplify or |
709 // remove entirely the dependency on keyboard and dock. | 709 // remove entirely the dependency on keyboard and dock. |
710 | 710 |
711 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { | 711 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { |
712 // Also push in the work area inset for the keyboard if it is visible. | 712 // Also push in the work area inset for the keyboard if it is visible. |
713 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); | 713 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); |
714 target_bounds->work_area_insets += keyboard_insets; | 714 target_bounds->work_area_insets += keyboard_insets; |
715 } | 715 } |
716 | 716 |
717 // Also push in the work area inset for the dock if it is visible. | |
718 if (!dock_bounds_.IsEmpty()) { | |
719 gfx::Insets dock_insets( | |
720 0, (dock_bounds_.x() > 0 ? 0 : dock_bounds_.width()), 0, | |
721 (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); | |
722 target_bounds->work_area_insets += dock_insets; | |
723 } | |
724 | |
725 // Also push in the work area insets for the ChromeVox panel if it's visible. | 717 // Also push in the work area insets for the ChromeVox panel if it's visible. |
726 if (chromevox_panel_height_) { | 718 if (chromevox_panel_height_) { |
727 gfx::Insets chromevox_insets(chromevox_panel_height_, 0, 0, 0); | 719 gfx::Insets chromevox_insets(chromevox_panel_height_, 0, 0, 0); |
728 target_bounds->work_area_insets += chromevox_insets; | 720 target_bounds->work_area_insets += chromevox_insets; |
729 } | 721 } |
730 | 722 |
731 target_bounds->opacity = ComputeTargetOpacity(state); | 723 target_bounds->opacity = ComputeTargetOpacity(state); |
732 target_bounds->status_opacity = | 724 target_bounds->status_opacity = |
733 (state.visibility_state == SHELF_AUTO_HIDE && | 725 (state.visibility_state == SHELF_AUTO_HIDE && |
734 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | 726 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 } | 968 } |
977 | 969 |
978 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { | 970 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { |
979 if (state.visibility_state == SHELF_VISIBLE) | 971 if (state.visibility_state == SHELF_VISIBLE) |
980 return size; | 972 return size; |
981 if (state.visibility_state == SHELF_AUTO_HIDE) | 973 if (state.visibility_state == SHELF_AUTO_HIDE) |
982 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); | 974 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); |
983 return 0; | 975 return 0; |
984 } | 976 } |
985 | 977 |
986 void ShelfLayoutManager::OnDockBoundsChanging( | |
987 const gfx::Rect& dock_bounds, | |
988 DockedWindowLayoutManagerObserver::Reason reason) { | |
989 // Skip shelf layout in case docked notification originates from this class. | |
990 if (reason == DISPLAY_INSETS_CHANGED) | |
991 return; | |
992 if (dock_bounds_ != dock_bounds) { | |
993 dock_bounds_ = dock_bounds; | |
994 OnWindowResized(); | |
995 UpdateVisibilityState(); | |
996 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); | |
997 } | |
998 } | |
999 | |
1000 void ShelfLayoutManager::OnLockStateEvent(LockStateObserver::EventType event) { | 978 void ShelfLayoutManager::OnLockStateEvent(LockStateObserver::EventType event) { |
1001 if (event == EVENT_LOCK_ANIMATION_STARTED) { | 979 if (event == EVENT_LOCK_ANIMATION_STARTED) { |
1002 // Enter the screen locked state and update the visibility to avoid an odd | 980 // Enter the screen locked state and update the visibility to avoid an odd |
1003 // animation when transitioning the orientation from L/R to bottom. | 981 // animation when transitioning the orientation from L/R to bottom. |
1004 state_.pre_lock_screen_animation_active = true; | 982 state_.pre_lock_screen_animation_active = true; |
1005 UpdateShelfVisibilityAfterLoginUIChange(); | 983 UpdateShelfVisibilityAfterLoginUIChange(); |
1006 } else { | 984 } else { |
1007 state_.pre_lock_screen_animation_active = false; | 985 state_.pre_lock_screen_animation_active = false; |
1008 } | 986 } |
1009 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); | 987 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1126 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1149 } | 1127 } |
1150 | 1128 |
1151 void ShelfLayoutManager::CancelGestureDrag() { | 1129 void ShelfLayoutManager::CancelGestureDrag() { |
1152 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1130 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
1153 UpdateVisibilityState(); | 1131 UpdateVisibilityState(); |
1154 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1132 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1155 } | 1133 } |
1156 | 1134 |
1157 } // namespace ash | 1135 } // namespace ash |
OLD | NEW |