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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 // TODO(varkha): The functionality of managing insets for display areas | 696 // TODO(varkha): The functionality of managing insets for display areas |
697 // should probably be pushed to a separate component. This would simplify or | 697 // should probably be pushed to a separate component. This would simplify or |
698 // remove entirely the dependency on keyboard and dock. | 698 // remove entirely the dependency on keyboard and dock. |
699 | 699 |
700 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { | 700 if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) { |
701 // Also push in the work area inset for the keyboard if it is visible. | 701 // Also push in the work area inset for the keyboard if it is visible. |
702 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); | 702 gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0); |
703 target_bounds->work_area_insets += keyboard_insets; | 703 target_bounds->work_area_insets += keyboard_insets; |
704 } | 704 } |
705 | 705 |
706 // Also push in the work area inset for the dock if it is visible. | |
707 if (!dock_bounds_.IsEmpty()) { | |
708 gfx::Insets dock_insets( | |
709 0, (dock_bounds_.x() > 0 ? 0 : dock_bounds_.width()), 0, | |
710 (dock_bounds_.x() > 0 ? dock_bounds_.width() : 0)); | |
711 target_bounds->work_area_insets += dock_insets; | |
712 } | |
713 | |
714 // Also push in the work area insets for the ChromeVox panel if it's visible. | 706 // Also push in the work area insets for the ChromeVox panel if it's visible. |
715 if (chromevox_panel_height_) { | 707 if (chromevox_panel_height_) { |
716 gfx::Insets chromevox_insets(chromevox_panel_height_, 0, 0, 0); | 708 gfx::Insets chromevox_insets(chromevox_panel_height_, 0, 0, 0); |
717 target_bounds->work_area_insets += chromevox_insets; | 709 target_bounds->work_area_insets += chromevox_insets; |
718 } | 710 } |
719 | 711 |
720 target_bounds->opacity = ComputeTargetOpacity(state); | 712 target_bounds->opacity = ComputeTargetOpacity(state); |
721 target_bounds->status_opacity = | 713 target_bounds->status_opacity = |
722 (state.visibility_state == SHELF_AUTO_HIDE && | 714 (state.visibility_state == SHELF_AUTO_HIDE && |
723 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && | 715 state.auto_hide_state == SHELF_AUTO_HIDE_HIDDEN && |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 } | 957 } |
966 | 958 |
967 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { | 959 int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { |
968 if (state.visibility_state == SHELF_VISIBLE) | 960 if (state.visibility_state == SHELF_VISIBLE) |
969 return size; | 961 return size; |
970 if (state.visibility_state == SHELF_AUTO_HIDE) | 962 if (state.visibility_state == SHELF_AUTO_HIDE) |
971 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); | 963 return GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); |
972 return 0; | 964 return 0; |
973 } | 965 } |
974 | 966 |
975 void ShelfLayoutManager::OnDockBoundsChanging( | |
976 const gfx::Rect& dock_bounds, | |
977 DockedWindowLayoutManagerObserver::Reason reason) { | |
978 // Skip shelf layout in case docked notification originates from this class. | |
979 if (reason == DISPLAY_INSETS_CHANGED) | |
980 return; | |
981 if (dock_bounds_ != dock_bounds) { | |
982 dock_bounds_ = dock_bounds; | |
983 OnWindowResized(); | |
984 UpdateVisibilityState(); | |
985 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); | |
986 } | |
987 } | |
988 | |
989 void ShelfLayoutManager::OnLockStateEvent(LockStateObserver::EventType event) { | 967 void ShelfLayoutManager::OnLockStateEvent(LockStateObserver::EventType event) { |
990 if (event == EVENT_LOCK_ANIMATION_STARTED) { | 968 if (event == EVENT_LOCK_ANIMATION_STARTED) { |
991 // Enter the screen locked state and update the visibility to avoid an odd | 969 // Enter the screen locked state and update the visibility to avoid an odd |
992 // animation when transitioning the orientation from L/R to bottom. | 970 // animation when transitioning the orientation from L/R to bottom. |
993 state_.pre_lock_screen_animation_active = true; | 971 state_.pre_lock_screen_animation_active = true; |
994 UpdateShelfVisibilityAfterLoginUIChange(); | 972 UpdateShelfVisibilityAfterLoginUIChange(); |
995 } else { | 973 } else { |
996 state_.pre_lock_screen_animation_active = false; | 974 state_.pre_lock_screen_animation_active = false; |
997 } | 975 } |
998 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); | 976 MaybeUpdateShelfBackground(AnimationChangeType::ANIMATE); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1115 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1138 } | 1116 } |
1139 | 1117 |
1140 void ShelfLayoutManager::CancelGestureDrag() { | 1118 void ShelfLayoutManager::CancelGestureDrag() { |
1141 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1119 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
1142 UpdateVisibilityState(); | 1120 UpdateVisibilityState(); |
1143 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1121 gesture_drag_status_ = GESTURE_DRAG_NONE; |
1144 } | 1122 } |
1145 | 1123 |
1146 } // namespace ash | 1124 } // namespace ash |
OLD | NEW |