OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_widget.h" | 5 #include "ash/common/shelf/shelf_widget.h" |
6 | 6 |
7 #include "ash/common/focus_cycler.h" | 7 #include "ash/common/focus_cycler.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 GetContentsView()->AddChildView(shelf_view_); | 324 GetContentsView()->AddChildView(shelf_view_); |
325 return shelf_view_; | 325 return shelf_view_; |
326 } | 326 } |
327 | 327 |
328 void ShelfWidget::PostCreateShelf() { | 328 void ShelfWidget::PostCreateShelf() { |
329 SetFocusCycler(WmShell::Get()->focus_cycler()); | 329 SetFocusCycler(WmShell::Get()->focus_cycler()); |
330 | 330 |
331 // Ensure the newly created |shelf_| gets current values. | 331 // Ensure the newly created |shelf_| gets current values. |
332 background_animator_.Initialize(this); | 332 background_animator_.Initialize(this); |
333 | 333 |
| 334 // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed |
| 335 // because the shelf is only created after the first user session is active. |
| 336 // The ShelfView seems to always be visible after login. At the lock screen |
| 337 // the shelf is hidden because its container is hidden. During auto-hide it is |
| 338 // hidden because ShelfWidget is transparent. Some of the ShelfView visibility |
| 339 // code could be simplified. http://crbug.com/674773 |
334 shelf_view_->SetVisible( | 340 shelf_view_->SetVisible( |
335 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); | 341 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); |
336 shelf_layout_manager_->LayoutShelf(); | 342 shelf_layout_manager_->LayoutShelf(); |
337 shelf_layout_manager_->UpdateAutoHideState(); | 343 shelf_layout_manager_->UpdateAutoHideState(); |
338 Show(); | 344 Show(); |
339 } | 345 } |
340 | 346 |
341 bool ShelfWidget::IsShelfVisible() const { | 347 bool ShelfWidget::IsShelfVisible() const { |
342 return shelf_view_ && shelf_view_->visible(); | 348 return shelf_view_ && shelf_view_->visible(); |
343 } | 349 } |
344 | 350 |
345 void ShelfWidget::SetShelfVisibility(bool visible) { | |
346 if (shelf_view_) | |
347 shelf_view_->SetVisible(visible); | |
348 } | |
349 | |
350 bool ShelfWidget::IsShowingAppList() const { | 351 bool ShelfWidget::IsShowingAppList() const { |
351 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); | 352 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); |
352 } | 353 } |
353 | 354 |
354 bool ShelfWidget::IsShowingContextMenu() const { | 355 bool ShelfWidget::IsShowingContextMenu() const { |
355 return shelf_view_ && shelf_view_->IsShowingMenu(); | 356 return shelf_view_ && shelf_view_->IsShowingMenu(); |
356 } | 357 } |
357 | 358 |
358 bool ShelfWidget::IsShowingOverflowBubble() const { | 359 bool ShelfWidget::IsShowingOverflowBubble() const { |
359 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); | 360 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (shelf_view_) | 428 if (shelf_view_) |
428 shelf_view_->UpdateShelfItemBackground(alpha); | 429 shelf_view_->UpdateShelfItemBackground(alpha); |
429 } | 430 } |
430 | 431 |
431 void ShelfWidget::WillDeleteShelfLayoutManager() { | 432 void ShelfWidget::WillDeleteShelfLayoutManager() { |
432 shelf_layout_manager_->RemoveObserver(this); | 433 shelf_layout_manager_->RemoveObserver(this); |
433 shelf_layout_manager_ = nullptr; | 434 shelf_layout_manager_ = nullptr; |
434 } | 435 } |
435 | 436 |
436 } // namespace ash | 437 } // namespace ash |
OLD | NEW |