| 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 | |
| 340 shelf_view_->SetVisible( | 334 shelf_view_->SetVisible( |
| 341 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); | 335 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); |
| 342 shelf_layout_manager_->LayoutShelf(); | 336 shelf_layout_manager_->LayoutShelf(); |
| 343 shelf_layout_manager_->UpdateAutoHideState(); | 337 shelf_layout_manager_->UpdateAutoHideState(); |
| 344 Show(); | 338 Show(); |
| 345 } | 339 } |
| 346 | 340 |
| 347 bool ShelfWidget::IsShelfVisible() const { | 341 bool ShelfWidget::IsShelfVisible() const { |
| 348 return shelf_view_ && shelf_view_->visible(); | 342 return shelf_view_ && shelf_view_->visible(); |
| 349 } | 343 } |
| 350 | 344 |
| 345 void ShelfWidget::SetShelfVisibility(bool visible) { |
| 346 if (shelf_view_) |
| 347 shelf_view_->SetVisible(visible); |
| 348 } |
| 349 |
| 351 bool ShelfWidget::IsShowingAppList() const { | 350 bool ShelfWidget::IsShowingAppList() const { |
| 352 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); | 351 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); |
| 353 } | 352 } |
| 354 | 353 |
| 355 bool ShelfWidget::IsShowingContextMenu() const { | 354 bool ShelfWidget::IsShowingContextMenu() const { |
| 356 return shelf_view_ && shelf_view_->IsShowingMenu(); | 355 return shelf_view_ && shelf_view_->IsShowingMenu(); |
| 357 } | 356 } |
| 358 | 357 |
| 359 bool ShelfWidget::IsShowingOverflowBubble() const { | 358 bool ShelfWidget::IsShowingOverflowBubble() const { |
| 360 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); | 359 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (shelf_view_) | 427 if (shelf_view_) |
| 429 shelf_view_->UpdateShelfItemBackground(alpha); | 428 shelf_view_->UpdateShelfItemBackground(alpha); |
| 430 } | 429 } |
| 431 | 430 |
| 432 void ShelfWidget::WillDeleteShelfLayoutManager() { | 431 void ShelfWidget::WillDeleteShelfLayoutManager() { |
| 433 shelf_layout_manager_->RemoveObserver(this); | 432 shelf_layout_manager_->RemoveObserver(this); |
| 434 shelf_layout_manager_ = nullptr; | 433 shelf_layout_manager_ = nullptr; |
| 435 } | 434 } |
| 436 | 435 |
| 437 } // namespace ash | 436 } // namespace ash |
| OLD | NEW |