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

Side by Side Diff: ash/common/shelf/shelf_widget.cc

Issue 2761063002: Move more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_controller.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"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 background_animator_.PaintBackground( 163 background_animator_.PaintBackground(
164 shelf_layout_manager_->GetShelfBackgroundType(), 164 shelf_layout_manager_->GetShelfBackgroundType(),
165 AnimationChangeType::IMMEDIATE); 165 AnimationChangeType::IMMEDIATE);
166 166
167 views::Widget::AddObserver(this); 167 views::Widget::AddObserver(this);
168 } 168 }
169 169
170 ShelfWidget::~ShelfWidget() { 170 ShelfWidget::~ShelfWidget() {
171 // Must call Shutdown() before destruction. 171 // Must call Shutdown() before destruction.
172 DCHECK(!status_area_widget_); 172 DCHECK(!status_area_widget_);
173 WmShell::Get()->focus_cycler()->RemoveWidget(this); 173 Shell::Get()->focus_cycler()->RemoveWidget(this);
174 SetFocusCycler(nullptr); 174 SetFocusCycler(nullptr);
175 RemoveObserver(this); 175 RemoveObserver(this);
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()->session_controller()->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 Shell::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);
197 } 197 }
198 198
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 shelf_view_ = 234 shelf_view_ =
235 new ShelfView(WmShell::Get()->shelf_model(), 235 new ShelfView(WmShell::Get()->shelf_model(),
236 WmShell::Get()->shelf_delegate(), wm_shelf_, this); 236 WmShell::Get()->shelf_delegate(), wm_shelf_, this);
237 shelf_view_->Init(); 237 shelf_view_->Init();
238 GetContentsView()->AddChildView(shelf_view_); 238 GetContentsView()->AddChildView(shelf_view_);
239 return shelf_view_; 239 return shelf_view_;
240 } 240 }
241 241
242 void ShelfWidget::PostCreateShelf() { 242 void ShelfWidget::PostCreateShelf() {
243 SetFocusCycler(WmShell::Get()->focus_cycler()); 243 SetFocusCycler(Shell::Get()->focus_cycler());
244 244
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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 void ShelfWidget::Shutdown() { 287 void ShelfWidget::Shutdown() {
288 // Shutting down the status area widget may cause some widgets (e.g. bubbles) 288 // Shutting down the status area widget may cause some widgets (e.g. bubbles)
289 // to close, so uninstall the ShelfLayoutManager event filters first. Don't 289 // to close, so uninstall the ShelfLayoutManager event filters first. Don't
290 // reset the pointer until later because other widgets (e.g. app list) may 290 // reset the pointer until later because other widgets (e.g. app list) may
291 // access it later in shutdown. 291 // access it later in shutdown.
292 if (shelf_layout_manager_) 292 if (shelf_layout_manager_)
293 shelf_layout_manager_->PrepareForShutdown(); 293 shelf_layout_manager_->PrepareForShutdown();
294 294
295 if (status_area_widget_) { 295 if (status_area_widget_) {
296 background_animator_.RemoveObserver(status_area_widget_); 296 background_animator_.RemoveObserver(status_area_widget_);
297 WmShell::Get()->focus_cycler()->RemoveWidget(status_area_widget_); 297 Shell::Get()->focus_cycler()->RemoveWidget(status_area_widget_);
298 status_area_widget_->Shutdown(); 298 status_area_widget_->Shutdown();
299 status_area_widget_ = nullptr; 299 status_area_widget_ = nullptr;
300 } 300 }
301 301
302 CloseNow(); 302 CloseNow();
303 } 303 }
304 304
305 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) { 305 void ShelfWidget::UpdateIconPositionForPanel(WmWindow* panel) {
306 if (!shelf_view_) 306 if (!shelf_view_)
307 return; 307 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/shelf/wm_shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698