| 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 <cstring> | 9 #include <cstring> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 (state_.visibility_state == SHELF_VISIBLE || | 245 (state_.visibility_state == SHELF_VISIBLE || |
| 246 (state_.visibility_state == SHELF_AUTO_HIDE && | 246 (state_.visibility_state == SHELF_AUTO_HIDE && |
| 247 state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)); | 247 state_.auto_hide_state == SHELF_AUTO_HIDE_SHOWN)); |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) { | 250 bool ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) { |
| 251 if (alignment_ == alignment) | 251 if (alignment_ == alignment) |
| 252 return false; | 252 return false; |
| 253 | 253 |
| 254 alignment_ = alignment; | 254 alignment_ = alignment; |
| 255 if (state_.is_screen_locked || state_.is_adding_user_screen) { | 255 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() || |
| 256 state_.is_adding_user_screen) { |
| 256 // The shelf will itself move to the bottom while locked. If a request is | 257 // The shelf will itself move to the bottom while locked. If a request is |
| 257 // sent to move while being locked, we postpone the move until the lock | 258 // sent to move while being locked, we postpone the move until the lock |
| 258 // screen goes away. | 259 // screen goes away. |
| 259 return false; | 260 return false; |
| 260 } | 261 } |
| 261 | 262 |
| 262 // This should not be called during the lock screen transitions. | 263 // This should not be called during the lock screen transitions. |
| 263 shelf_->SetAlignment(alignment); | 264 shelf_->SetAlignment(alignment); |
| 264 LayoutShelf(); | 265 LayoutShelf(); |
| 265 return true; | 266 return true; |
| 266 } | 267 } |
| 267 | 268 |
| 268 ShelfAlignment ShelfLayoutManager::GetAlignment() const { | 269 ShelfAlignment ShelfLayoutManager::GetAlignment() const { |
| 269 // When the screen is locked or a user gets added, the shelf is forced into | 270 // When the screen is locked or a user gets added, the shelf is forced into |
| 270 // bottom alignment. Note: We cannot use state_.is_screen_locked here since | 271 // bottom alignment. Note: We cannot use state_.is_screen_locked here since |
| 271 // that flag gets set later than the SessionStateDelegate reports a locked | 272 // that flag gets set later than the SessionStateDelegate reports a locked |
| 272 // screen which leads in | 273 // screen which leads in |
| 273 if (state_.is_screen_locked || state_.is_adding_user_screen) | 274 if (Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked() || |
| 275 state_.is_adding_user_screen) |
| 274 return SHELF_ALIGNMENT_BOTTOM; | 276 return SHELF_ALIGNMENT_BOTTOM; |
| 275 return alignment_; | 277 return alignment_; |
| 276 } | 278 } |
| 277 | 279 |
| 278 gfx::Rect ShelfLayoutManager::GetIdealBounds() { | 280 gfx::Rect ShelfLayoutManager::GetIdealBounds() { |
| 279 gfx::Rect bounds( | 281 gfx::Rect bounds( |
| 280 ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); | 282 ScreenUtil::GetDisplayBoundsInParent(shelf_->GetNativeView())); |
| 281 int width = 0, height = 0; | 283 int width = 0, height = 0; |
| 282 GetShelfSize(&width, &height); | 284 GetShelfSize(&width, &height); |
| 283 return SelectValueForShelfAlignment( | 285 return SelectValueForShelfAlignment( |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 } | 1182 } |
| 1181 | 1183 |
| 1182 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { | 1184 void ShelfLayoutManager::UpdateShelfVisibilityAfterLoginUIChange() { |
| 1183 shelf_->SetAlignment(state_.is_adding_user_screen || state_.is_screen_locked ? | 1185 shelf_->SetAlignment(state_.is_adding_user_screen || state_.is_screen_locked ? |
| 1184 SHELF_ALIGNMENT_BOTTOM : alignment_); | 1186 SHELF_ALIGNMENT_BOTTOM : alignment_); |
| 1185 UpdateVisibilityState(); | 1187 UpdateVisibilityState(); |
| 1186 LayoutShelf(); | 1188 LayoutShelf(); |
| 1187 } | 1189 } |
| 1188 | 1190 |
| 1189 } // namespace ash | 1191 } // namespace ash |
| OLD | NEW |