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/animation/animation_change_type.h" | 7 #include "ash/animation/animation_change_type.h" |
8 #include "ash/common/focus_cycler.h" | 8 #include "ash/common/focus_cycler.h" |
9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_controller.h" |
10 #include "ash/common/shelf/app_list_button.h" | 10 #include "ash/common/shelf/app_list_button.h" |
11 #include "ash/common/shelf/shelf_background_animator_observer.h" | 11 #include "ash/common/shelf/shelf_background_animator_observer.h" |
12 #include "ash/common/shelf/shelf_constants.h" | 12 #include "ash/common/shelf/shelf_constants.h" |
13 #include "ash/common/shelf/shelf_delegate.h" | 13 #include "ash/common/shelf/shelf_delegate.h" |
14 #include "ash/common/shelf/shelf_layout_manager.h" | 14 #include "ash/common/shelf/shelf_layout_manager.h" |
15 #include "ash/common/shelf/shelf_view.h" | 15 #include "ash/common/shelf/shelf_view.h" |
16 #include "ash/common/shelf/wm_shelf.h" | 16 #include "ash/common/shelf/wm_shelf.h" |
17 #include "ash/common/shelf/wm_shelf_util.h" | 17 #include "ash/common/shelf/wm_shelf_util.h" |
18 #include "ash/common/system/status_area_layout_manager.h" | 18 #include "ash/common/system/status_area_layout_manager.h" |
19 #include "ash/common/system/status_area_widget.h" | 19 #include "ash/common/system/status_area_widget.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 background_animator_.RemoveObserver(delegate_view_); | 176 background_animator_.RemoveObserver(delegate_view_); |
177 background_animator_.RemoveObserver(this); | 177 background_animator_.RemoveObserver(this); |
178 } | 178 } |
179 | 179 |
180 void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) { | 180 void ShelfWidget::CreateStatusAreaWidget(WmWindow* status_container) { |
181 DCHECK(status_container); | 181 DCHECK(status_container); |
182 DCHECK(!status_area_widget_); | 182 DCHECK(!status_area_widget_); |
183 // TODO(jamescook): Move ownership to RootWindowController. | 183 // TODO(jamescook): Move ownership to RootWindowController. |
184 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_); | 184 status_area_widget_ = new StatusAreaWidget(status_container, wm_shelf_); |
185 status_area_widget_->CreateTrayViews(); | 185 status_area_widget_->CreateTrayViews(); |
186 if (WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()) | 186 if (WmShell::Get()->session_controller()->IsActiveUserSessionStarted()) |
187 status_area_widget_->Show(); | 187 status_area_widget_->Show(); |
188 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_); | 188 WmShell::Get()->focus_cycler()->AddWidget(status_area_widget_); |
189 background_animator_.AddObserver(status_area_widget_); | 189 background_animator_.AddObserver(status_area_widget_); |
190 status_container->SetLayoutManager( | 190 status_container->SetLayoutManager( |
191 base::MakeUnique<StatusAreaLayoutManager>(this)); | 191 base::MakeUnique<StatusAreaLayoutManager>(this)); |
192 } | 192 } |
193 | 193 |
194 void ShelfWidget::SetPaintsBackground(ShelfBackgroundType background_type, | 194 void ShelfWidget::SetPaintsBackground(ShelfBackgroundType background_type, |
195 AnimationChangeType change_type) { | 195 AnimationChangeType change_type) { |
196 background_animator_.PaintBackground(background_type, change_type); | 196 background_animator_.PaintBackground(background_type, change_type); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Ensure the newly created |shelf_| gets current values. | 245 // Ensure the newly created |shelf_| gets current values. |
246 background_animator_.NotifyObserver(this); | 246 background_animator_.NotifyObserver(this); |
247 | 247 |
248 // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed | 248 // TODO(jamescook): The IsActiveUserSessionStarted() check may not be needed |
249 // because the shelf is only created after the first user session is active. | 249 // because the shelf is only created after the first user session is active. |
250 // The ShelfView seems to always be visible after login. At the lock screen | 250 // The ShelfView seems to always be visible after login. At the lock screen |
251 // the shelf is hidden because its container is hidden. During auto-hide it is | 251 // the shelf is hidden because its container is hidden. During auto-hide it is |
252 // hidden because ShelfWidget is transparent. Some of the ShelfView visibility | 252 // hidden because ShelfWidget is transparent. Some of the ShelfView visibility |
253 // code could be simplified. http://crbug.com/674773 | 253 // code could be simplified. http://crbug.com/674773 |
254 shelf_view_->SetVisible( | 254 shelf_view_->SetVisible( |
255 WmShell::Get()->GetSessionStateDelegate()->IsActiveUserSessionStarted()); | 255 WmShell::Get()->session_controller()->IsActiveUserSessionStarted()); |
256 shelf_layout_manager_->LayoutShelf(); | 256 shelf_layout_manager_->LayoutShelf(); |
257 shelf_layout_manager_->UpdateAutoHideState(); | 257 shelf_layout_manager_->UpdateAutoHideState(); |
258 Show(); | 258 Show(); |
259 } | 259 } |
260 | 260 |
261 bool ShelfWidget::IsShelfVisible() const { | 261 bool ShelfWidget::IsShelfVisible() const { |
262 return shelf_view_ && shelf_view_->visible(); | 262 return shelf_view_ && shelf_view_->visible(); |
263 } | 263 } |
264 | 264 |
265 bool ShelfWidget::IsShowingAppList() const { | 265 bool ShelfWidget::IsShowingAppList() const { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 if (shelf_view_) | 350 if (shelf_view_) |
351 shelf_view_->UpdateShelfItemBackground(color); | 351 shelf_view_->UpdateShelfItemBackground(color); |
352 } | 352 } |
353 | 353 |
354 void ShelfWidget::WillDeleteShelfLayoutManager() { | 354 void ShelfWidget::WillDeleteShelfLayoutManager() { |
355 shelf_layout_manager_->RemoveObserver(this); | 355 shelf_layout_manager_->RemoveObserver(this); |
356 shelf_layout_manager_ = nullptr; | 356 shelf_layout_manager_ = nullptr; |
357 } | 357 } |
358 | 358 |
359 } // namespace ash | 359 } // namespace ash |
OLD | NEW |