Index: ash/shelf/shelf_layout_manager.cc |
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc |
index 5846b634f59b5157c20581b9caee2b3cf7a96291..0aa077a0452915601912cb9c2ba6f6d843f13375 100644 |
--- a/ash/shelf/shelf_layout_manager.cc |
+++ b/ash/shelf/shelf_layout_manager.cc |
@@ -246,13 +246,11 @@ bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) { |
return false; |
alignment_ = alignment; |
- if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() || |
- state_.is_adding_user_screen) { |
- // The shelf will itself move to the bottom while locked. If a request is |
- // sent to move while being locked, we postpone the move until the lock |
- // screen goes away. |
+ // The shelf will itself move to the bottom while locked or obscured by user |
+ // login. If a request is sent to move while being obscured, we postpone the |
+ // move until the user session is resumed. |
+ if (IsAlignmentLocked()) |
return false; |
- } |
// This should not be called during the lock screen transitions. |
shelf_->SetAlignment(alignment); |
@@ -262,11 +260,8 @@ bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) { |
ShelfAlignment ShelfLayoutManager::GetAlignment() const { |
// When the screen is locked or a user gets added, the shelf is forced into |
- // bottom alignment. Note: We cannot use state_.is_screen_locked here since |
- // that flag gets set later than the SessionStateDelegate reports a locked |
- // screen which leads in |
- if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() || |
- state_.is_adding_user_screen) |
+ // bottom alignment. |
+ if (IsAlignmentLocked()) |
return SHELF_ALIGNMENT_BOTTOM; |
return alignment_; |
} |
@@ -1159,10 +1154,28 @@ void ShelfLayoutManager::SessionStateChanged( |
} |
void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { |
- shelf_->SetAlignment(state_.is_adding_user_screen || state_.is_screen_locked ? |
- SHELF_ALIGNMENT_BOTTOM : alignment_); |
+ shelf_->SetAlignment(GetAlignment()); |
UpdateVisibilityState(); |
LayoutShelf(); |
} |
+bool ShelfLayoutManager::IsAlignmentLocked() const { |
+ SessionStateDelegate* session_state_delegate = |
James Cook
2015/02/17 20:03:36
nit: move this lower down, closer to where it is u
|
+ Shell::GetInstance()->session_state_delegate(); |
+ if (state_.is_screen_locked) |
+ return true; |
+ // The session state becomes active at the start of transitioning to a user |
+ // session, however the session is considered blocked until the full UI is |
+ // ready. Exit early to allow for proper layout. |
+ if (session_state_delegate->GetSessionState() == |
+ SessionStateDelegate::SESSION_STATE_ACTIVE) { |
+ return false; |
+ } |
+ if (session_state_delegate->IsUserSessionBlocked() || |
+ state_.is_adding_user_screen) { |
+ return true; |
+ } |
+ return false; |
+} |
+ |
} // namespace ash |