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