Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3232)

Unified Diff: ash/common/shelf/shelf_widget.cc

Issue 2625733003: Re-reland: chromeos: Fix shelf appearing at login screen under mash (Closed)
Patch Set: remove include Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/shelf/shelf_widget.cc
diff --git a/ash/common/shelf/shelf_widget.cc b/ash/common/shelf/shelf_widget.cc
index 4ebc52eec6e2f401e9dc2457ebc6ad257f9642a1..ac0583592b8d9c567243b39ee95350ba21fd3369 100644
--- a/ash/common/shelf/shelf_widget.cc
+++ b/ash/common/shelf/shelf_widget.cc
@@ -331,6 +331,12 @@ void ShelfWidget::PostCreateShelf() {
// Ensure the newly created |shelf_| gets current values.
background_animator_.Initialize(this);
+ // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed
+ // because the shelf is only created after the first user session is active.
+ // The ShelfView seems to always be visible after login. At the lock screen
+ // the shelf is hidden because its container is hidden. During auto-hide it is
+ // hidden because ShelfWidget is transparent. Some of the ShelfView visibility
+ // code could be simplified. http://crbug.com/674773
shelf_view_->SetVisible(
WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted());
shelf_layout_manager_->LayoutShelf();
@@ -342,11 +348,6 @@ bool ShelfWidget::IsShelfVisible() const {
return shelf_view_ && shelf_view_->visible();
}
-void ShelfWidget::SetShelfVisibility(bool visible) {
- if (shelf_view_)
- shelf_view_->SetVisible(visible);
-}
-
bool ShelfWidget::IsShowingAppList() const {
return GetAppListButton() && GetAppListButton()->is_showing_app_list();
}
@@ -388,6 +389,9 @@ void ShelfWidget::Shutdown() {
}
void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) {
+ if (!shelf_view_)
+ return;
+
WmWindow* shelf_window = WmLookup::Get()->GetWindowForWidget(this);
shelf_view_->UpdatePanelIconPosition(
panel->GetIntProperty(WmWindowProperty::SHELF_ID),
@@ -396,6 +400,11 @@ void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) {
}
gfx::Rect ShelfWidget::GetScreenBoundsOfItemIconForWindow(WmWindow* window) {
+ // Window animations can be triggered during session restore before the shelf
+ // view is created.
msw 2017/01/11 00:54:54 nit: "In that case, return default empty bounds" (
James Cook 2017/01/11 17:03:48 Done.
+ if (!shelf_view_)
+ return gfx::Rect();
James Cook 2017/01/11 00:39:50 This is the crash fix. It results in the window be
+
ShelfID id = window->GetIntProperty(WmWindowProperty::SHELF_ID);
gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id));
gfx::Point screen_origin;

Powered by Google App Engine
This is Rietveld 408576698