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

Side by Side Diff: ash/root_window_controller.cc

Issue 2393083005: Moves Shell::CreateShelf() to WmShell (Closed)
Patch Set: tweak Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/aura/aura_layout_manager_adapter.h" 10 #include "ash/aura/aura_layout_manager_adapter.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 aura::Window* RootWindowController::GetContainer(int container_id) { 306 aura::Window* RootWindowController::GetContainer(int container_id) {
307 return GetRootWindow()->GetChildById(container_id); 307 return GetRootWindow()->GetChildById(container_id);
308 } 308 }
309 309
310 const aura::Window* RootWindowController::GetContainer(int container_id) const { 310 const aura::Window* RootWindowController::GetContainer(int container_id) const {
311 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); 311 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id);
312 } 312 }
313 313
314 void RootWindowController::CreateShelf() {
315 if (wm_shelf_aura_->IsShelfInitialized())
316 return;
317 wm_shelf_aura_->InitializeShelf();
318
319 if (panel_layout_manager())
320 panel_layout_manager()->SetShelf(wm_shelf_aura_.get());
321 if (docked_window_layout_manager()) {
322 docked_window_layout_manager()->SetShelf(wm_shelf_aura_.get());
323 if (wm_shelf_aura_->shelf_layout_manager()) {
324 docked_window_layout_manager()->AddObserver(
325 wm_shelf_aura_->shelf_layout_manager());
326 }
327 }
328
329 // Notify shell observers that the shelf has been created.
330 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will
331 // require changing AttachedPanelWidgetTargeter's access to WmShelf.
332 WmShell::Get()->NotifyShelfCreatedForRootWindow(
333 WmWindowAura::Get(GetRootWindow()));
334
335 wm_shelf_aura_->shelf_widget()->PostCreateShelf();
336 }
337
338 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { 314 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) {
339 if (status != LoginStatus::NOT_LOGGED_IN) 315 if (status != LoginStatus::NOT_LOGGED_IN)
340 mouse_event_target_.reset(); 316 mouse_event_target_.reset();
341 StatusAreaWidget* status_area_widget = 317 StatusAreaWidget* status_area_widget =
342 wm_shelf_aura_->shelf_widget()->status_area_widget(); 318 wm_shelf_aura_->shelf_widget()->status_area_widget();
343 if (status_area_widget) 319 if (status_area_widget)
344 status_area_widget->UpdateAfterLoginStatusChange(status); 320 status_area_widget->UpdateAfterLoginStatusChange(status);
345 } 321 }
346 322
347 void RootWindowController::OnInitialWallpaperAnimationStarted() { 323 void RootWindowController::OnInitialWallpaperAnimationStarted() {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 WmShell::Get()->AddShellObserver(this); 496 WmShell::Get()->AddShellObserver(this);
521 497
522 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized(); 498 wm_root_window_controller_->root_window_layout_manager()->OnWindowResized();
523 if (root_window_type == PRIMARY) { 499 if (root_window_type == PRIMARY) {
524 shell->InitKeyboard(); 500 shell->InitKeyboard();
525 } else { 501 } else {
526 ash_host_->AsWindowTreeHost()->Show(); 502 ash_host_->AsWindowTreeHost()->Show();
527 503
528 // Create a shelf if a user is already logged in. 504 // Create a shelf if a user is already logged in.
529 if (WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers()) 505 if (WmShell::Get()->GetSessionStateDelegate()->NumberOfLoggedInUsers())
530 CreateShelf(); 506 wm_root_window_controller_->CreateShelf();
531 507
532 // Notify shell observers about new root window. 508 // Notify shell observers about new root window.
533 shell->OnRootWindowAdded(WmWindowAura::Get(root_window)); 509 shell->OnRootWindowAdded(WmWindowAura::Get(root_window));
534 } 510 }
535 511
536 #if defined(OS_CHROMEOS) 512 #if defined(OS_CHROMEOS)
537 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 513 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
538 switches::kAshDisableTouchExplorationMode)) { 514 switches::kAshDisableTouchExplorationMode)) {
539 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); 515 touch_exploration_manager_.reset(new AshTouchExplorationManager(this));
540 } 516 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 EnableTouchHudProjection(); 625 EnableTouchHudProjection();
650 else 626 else
651 DisableTouchHudProjection(); 627 DisableTouchHudProjection();
652 } 628 }
653 629
654 RootWindowController* GetRootWindowController(const aura::Window* root_window) { 630 RootWindowController* GetRootWindowController(const aura::Window* root_window) {
655 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; 631 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr;
656 } 632 }
657 633
658 } // namespace ash 634 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698