| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 return SHELF_AUTO_HIDE; | 227 return SHELF_AUTO_HIDE; |
| 228 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: | 228 case SHELF_AUTO_HIDE_BEHAVIOR_NEVER: |
| 229 return SHELF_VISIBLE; | 229 return SHELF_VISIBLE; |
| 230 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: | 230 case SHELF_AUTO_HIDE_ALWAYS_HIDDEN: |
| 231 return SHELF_HIDDEN; | 231 return SHELF_HIDDEN; |
| 232 } | 232 } |
| 233 return SHELF_VISIBLE; | 233 return SHELF_VISIBLE; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void ShelfLayoutManager::UpdateVisibilityState() { | 236 void ShelfLayoutManager::UpdateVisibilityState() { |
| 237 // Bail out early before the shelf is initialized or after it is destroyed. | 237 // Shelf is not available before login. |
| 238 // TODO(crbug.com/701157): Remove this when the login webui fake-shelf is |
| 239 // replaced with views. |
| 240 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted()) |
| 241 return; |
| 242 |
| 243 // Bail out early after shelf is destroyed. |
| 238 aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); | 244 aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); |
| 239 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window) | 245 if (in_shutdown_ || !shelf_window) |
| 240 return; | 246 return; |
| 247 |
| 241 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { | 248 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { |
| 242 SetState(SHELF_VISIBLE); | 249 SetState(SHELF_VISIBLE); |
| 243 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) { | 250 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) { |
| 244 SetState(SHELF_HIDDEN); | 251 SetState(SHELF_HIDDEN); |
| 245 } else { | 252 } else { |
| 246 // TODO(zelidrag): Verify shelf drag animation still shows on the device | 253 // TODO(zelidrag): Verify shelf drag animation still shows on the device |
| 247 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. | 254 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. |
| 248 wm::WorkspaceWindowState window_state( | 255 wm::WorkspaceWindowState window_state( |
| 249 RootWindowController::ForWindow(shelf_window) | 256 RootWindowController::ForWindow(shelf_window) |
| 250 ->GetWorkspaceWindowState()); | 257 ->GetWorkspaceWindowState()); |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 if (window->IsVisible() && !IsAppListWindow(window->aura_window()) && | 886 if (window->IsVisible() && !IsAppListWindow(window->aura_window()) && |
| 880 root->Contains(window)) { | 887 root->Contains(window)) { |
| 881 return true; | 888 return true; |
| 882 } | 889 } |
| 883 } | 890 } |
| 884 return false; | 891 return false; |
| 885 } | 892 } |
| 886 | 893 |
| 887 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( | 894 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( |
| 888 ShelfVisibilityState visibility_state) const { | 895 ShelfVisibilityState visibility_state) const { |
| 889 if (visibility_state != SHELF_AUTO_HIDE || !wm_shelf_->IsShelfInitialized()) | 896 // Shelf is not available before login. |
| 897 // TODO(crbug.com/701157): Remove this when the login webui fake-shelf is |
| 898 // replaced with views. |
| 899 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted()) |
| 900 return SHELF_AUTO_HIDE_HIDDEN; |
| 901 |
| 902 if (visibility_state != SHELF_AUTO_HIDE) |
| 890 return SHELF_AUTO_HIDE_HIDDEN; | 903 return SHELF_AUTO_HIDE_HIDDEN; |
| 891 | 904 |
| 892 if (shelf_widget_->IsShowingAppList()) | 905 if (shelf_widget_->IsShowingAppList()) |
| 893 return SHELF_AUTO_HIDE_SHOWN; | 906 return SHELF_AUTO_HIDE_SHOWN; |
| 894 | 907 |
| 895 if (shelf_widget_->status_area_widget() && | 908 if (shelf_widget_->status_area_widget() && |
| 896 shelf_widget_->status_area_widget()->ShouldShowShelf()) | 909 shelf_widget_->status_area_widget()->ShouldShowShelf()) |
| 897 return SHELF_AUTO_HIDE_SHOWN; | 910 return SHELF_AUTO_HIDE_SHOWN; |
| 898 | 911 |
| 899 if (shelf_widget_->IsShowingContextMenu()) | 912 if (shelf_widget_->IsShowingContextMenu()) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1156 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1144 } | 1157 } |
| 1145 | 1158 |
| 1146 void ShelfLayoutManager::CancelGestureDrag() { | 1159 void ShelfLayoutManager::CancelGestureDrag() { |
| 1147 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1160 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
| 1148 UpdateVisibilityState(); | 1161 UpdateVisibilityState(); |
| 1149 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1162 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1150 } | 1163 } |
| 1151 | 1164 |
| 1152 } // namespace ash | 1165 } // namespace ash |
| OLD | NEW |