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