Chromium Code Reviews| 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 WmWindow* shelf_window = WmWindow::Get(shelf_widget_->GetNativeWindow()); | 238 // TODO: Remove this when webui fake-shelf is replaced with views. |
|
msw
2017/05/16 22:42:00
nit: cite the bug, consider " // TODO(crbug.com/#
James Cook
2017/05/17 16:16:12
Done.
| |
| 239 if (in_shutdown_ || !wm_shelf_->IsShelfInitialized() || !shelf_window) | 239 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted()) |
| 240 return; | 240 return; |
| 241 | |
| 242 // Bail out early after shelf is destroyed. | |
| 243 aura::Window* shelf_window = shelf_widget_->GetNativeWindow(); | |
| 244 if (in_shutdown_ || !shelf_window) | |
|
James Cook
2017/05/16 21:32:35
It's unclear if the shelf_window check is needed b
msw
2017/05/16 22:42:00
Acknowledged.
| |
| 245 return; | |
| 246 | |
| 241 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { | 247 if (state_.IsScreenLocked() || state_.IsAddingSecondaryUser()) { |
| 242 SetState(SHELF_VISIBLE); | 248 SetState(SHELF_VISIBLE); |
| 243 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) { | 249 } else if (Shell::Get()->screen_pinning_controller()->IsPinned()) { |
| 244 SetState(SHELF_HIDDEN); | 250 SetState(SHELF_HIDDEN); |
| 245 } else { | 251 } else { |
| 246 // TODO(zelidrag): Verify shelf drag animation still shows on the device | 252 // TODO(zelidrag): Verify shelf drag animation still shows on the device |
| 247 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. | 253 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. |
| 248 wm::WorkspaceWindowState window_state( | 254 wm::WorkspaceWindowState window_state( |
| 249 shelf_window->GetRootWindowController()->GetWorkspaceWindowState()); | 255 RootWindowController::ForWindow(shelf_window) |
| 256 ->GetWorkspaceWindowState()); | |
| 250 | 257 |
| 251 switch (window_state) { | 258 switch (window_state) { |
| 252 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: { | 259 case wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN: { |
| 253 if (IsShelfAutoHideForFullscreenMaximized()) { | 260 if (IsShelfAutoHideForFullscreenMaximized()) { |
| 254 SetState(SHELF_AUTO_HIDE); | 261 SetState(SHELF_AUTO_HIDE); |
| 255 } else if (IsShelfHiddenForFullscreen()) { | 262 } else if (IsShelfHiddenForFullscreen()) { |
| 256 SetState(SHELF_HIDDEN); | 263 SetState(SHELF_HIDDEN); |
| 257 } else { | 264 } else { |
| 258 // The shelf is sometimes not hidden when in immersive fullscreen. | 265 // The shelf is sometimes not hidden when in immersive fullscreen. |
| 259 // Force the shelf to be auto hidden in this case. | 266 // Force the shelf to be auto hidden in this case. |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 877 if (window->IsVisible() && !IsAppListWindow(window) && | 884 if (window->IsVisible() && !IsAppListWindow(window) && |
| 878 root->Contains(window)) { | 885 root->Contains(window)) { |
| 879 return true; | 886 return true; |
| 880 } | 887 } |
| 881 } | 888 } |
| 882 return false; | 889 return false; |
| 883 } | 890 } |
| 884 | 891 |
| 885 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( | 892 ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( |
| 886 ShelfVisibilityState visibility_state) const { | 893 ShelfVisibilityState visibility_state) const { |
| 887 if (visibility_state != SHELF_AUTO_HIDE || !wm_shelf_->IsShelfInitialized()) | 894 // Shelf is not available before login. |
| 895 // TODO: Remove this when webui fake-shelf is replaced with views. | |
| 896 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted()) | |
| 897 return SHELF_AUTO_HIDE_HIDDEN; | |
| 898 | |
| 899 if (visibility_state != SHELF_AUTO_HIDE) | |
| 888 return SHELF_AUTO_HIDE_HIDDEN; | 900 return SHELF_AUTO_HIDE_HIDDEN; |
| 889 | 901 |
| 890 if (shelf_widget_->IsShowingAppList()) | 902 if (shelf_widget_->IsShowingAppList()) |
| 891 return SHELF_AUTO_HIDE_SHOWN; | 903 return SHELF_AUTO_HIDE_SHOWN; |
| 892 | 904 |
| 893 if (shelf_widget_->status_area_widget() && | 905 if (shelf_widget_->status_area_widget() && |
| 894 shelf_widget_->status_area_widget()->ShouldShowShelf()) | 906 shelf_widget_->status_area_widget()->ShouldShowShelf()) |
| 895 return SHELF_AUTO_HIDE_SHOWN; | 907 return SHELF_AUTO_HIDE_SHOWN; |
| 896 | 908 |
| 897 if (shelf_widget_->IsShowingContextMenu()) | 909 if (shelf_widget_->IsShowingContextMenu()) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1153 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1142 } | 1154 } |
| 1143 | 1155 |
| 1144 void ShelfLayoutManager::CancelGestureDrag() { | 1156 void ShelfLayoutManager::CancelGestureDrag() { |
| 1145 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; | 1157 gesture_drag_status_ = GESTURE_DRAG_CANCEL_IN_PROGRESS; |
| 1146 UpdateVisibilityState(); | 1158 UpdateVisibilityState(); |
| 1147 gesture_drag_status_ = GESTURE_DRAG_NONE; | 1159 gesture_drag_status_ = GESTURE_DRAG_NONE; |
| 1148 } | 1160 } |
| 1149 | 1161 |
| 1150 } // namespace ash | 1162 } // namespace ash |
| OLD | NEW |