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 // If the shelf view is always visible after creation then some of the shelf | |
337 // visibility code could be simplified. http://crbug.com/674773 | |
msw
2016/12/16 16:26:20
What happens for the lock screen? Isn't the shelf
James Cook
2016/12/20 04:02:42
Updated comment.
The shelf is hidden at the lock
| |
334 shelf_view_->SetVisible( | 338 shelf_view_->SetVisible( |
335 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); | 339 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); |
336 shelf_layout_manager_->LayoutShelf(); | 340 shelf_layout_manager_->LayoutShelf(); |
337 shelf_layout_manager_->UpdateAutoHideState(); | 341 shelf_layout_manager_->UpdateAutoHideState(); |
338 Show(); | 342 Show(); |
339 } | 343 } |
340 | 344 |
341 bool ShelfWidget::IsShelfVisible() const { | 345 bool ShelfWidget::IsShelfVisible() const { |
342 return shelf_view_ && shelf_view_->visible(); | 346 return shelf_view_ && shelf_view_->visible(); |
343 } | 347 } |
344 | 348 |
345 void ShelfWidget::SetShelfVisibility(bool visible) { | |
346 if (shelf_view_) | |
347 shelf_view_->SetVisible(visible); | |
348 } | |
349 | |
350 bool ShelfWidget::IsShowingAppList() const { | 349 bool ShelfWidget::IsShowingAppList() const { |
351 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); | 350 return GetAppListButton() && GetAppListButton()->is_showing_app_list(); |
352 } | 351 } |
353 | 352 |
354 bool ShelfWidget::IsShowingContextMenu() const { | 353 bool ShelfWidget::IsShowingContextMenu() const { |
355 return shelf_view_ && shelf_view_->IsShowingMenu(); | 354 return shelf_view_ && shelf_view_->IsShowingMenu(); |
356 } | 355 } |
357 | 356 |
358 bool ShelfWidget::IsShowingOverflowBubble() const { | 357 bool ShelfWidget::IsShowingOverflowBubble() const { |
359 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); | 358 return shelf_view_ && shelf_view_->IsShowingOverflowBubble(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 if (shelf_view_) | 426 if (shelf_view_) |
428 shelf_view_->UpdateShelfItemBackground(alpha); | 427 shelf_view_->UpdateShelfItemBackground(alpha); |
429 } | 428 } |
430 | 429 |
431 void ShelfWidget::WillDeleteShelfLayoutManager() { | 430 void ShelfWidget::WillDeleteShelfLayoutManager() { |
432 shelf_layout_manager_->RemoveObserver(this); | 431 shelf_layout_manager_->RemoveObserver(this); |
433 shelf_layout_manager_ = nullptr; | 432 shelf_layout_manager_ = nullptr; |
434 } | 433 } |
435 | 434 |
436 } // namespace ash | 435 } // namespace ash |
OLD | NEW |