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

Side by Side Diff: ash/root_window_controller.cc

Issue 2304443002: ash: Move ShelfWidget ownership to WmShelf and refactor access to it (Closed)
Patch Set: typo Created 4 years, 3 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 460
461 const aura::Window* RootWindowController::GetContainer(int container_id) const { 461 const aura::Window* RootWindowController::GetContainer(int container_id) const {
462 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id); 462 return ash_host_->AsWindowTreeHost()->window()->GetChildById(container_id);
463 } 463 }
464 464
465 void RootWindowController::ShowShelf() { 465 void RootWindowController::ShowShelf() {
466 if (!wm_shelf_aura_->IsShelfInitialized()) 466 if (!wm_shelf_aura_->IsShelfInitialized())
467 return; 467 return;
468 // TODO(jamescook): Move this into WmShelf. 468 // TODO(jamescook): Move this into WmShelf.
469 shelf_widget_->SetShelfVisibility(true); 469 wm_shelf_aura_->shelf_widget()->SetShelfVisibility(true);
470 shelf_widget_->status_area_widget()->Show(); 470 wm_shelf_aura_->shelf_widget()->status_area_widget()->Show();
471 } 471 }
472 472
473 void RootWindowController::CreateShelf() { 473 void RootWindowController::CreateShelf() {
474 if (wm_shelf_aura_->IsShelfInitialized()) 474 if (wm_shelf_aura_->IsShelfInitialized())
475 return; 475 return;
476 wm_shelf_aura_->InitializeShelf(); 476 wm_shelf_aura_->InitializeShelf();
477 477
478 if (panel_layout_manager_) 478 if (panel_layout_manager_)
479 panel_layout_manager_->SetShelf(wm_shelf_aura_.get()); 479 panel_layout_manager_->SetShelf(wm_shelf_aura_.get());
480 if (docked_layout_manager_) { 480 if (docked_layout_manager_) {
481 docked_layout_manager_->SetShelf(wm_shelf_aura_.get()); 481 docked_layout_manager_->SetShelf(wm_shelf_aura_.get());
482 if (shelf_widget_->shelf_layout_manager()) 482 if (wm_shelf_aura_->shelf_layout_manager())
msw 2016/08/31 23:01:39 optional nit: curlies
James Cook 2016/08/31 23:33:45 Done.
483 docked_layout_manager_->AddObserver( 483 docked_layout_manager_->AddObserver(
484 shelf_widget_->shelf_layout_manager()); 484 wm_shelf_aura_->shelf_layout_manager());
485 } 485 }
486 486
487 // Notify shell observers that the shelf has been created. 487 // Notify shell observers that the shelf has been created.
488 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will 488 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will
489 // require changing AttachedPanelWidgetTargeter's access to WmShelf. 489 // require changing AttachedPanelWidgetTargeter's access to WmShelf.
490 WmShell::Get()->NotifyShelfCreatedForRootWindow( 490 WmShell::Get()->NotifyShelfCreatedForRootWindow(
491 WmWindowAura::Get(GetRootWindow())); 491 WmWindowAura::Get(GetRootWindow()));
492 492
493 shelf_widget_->PostCreateShelf(); 493 wm_shelf_aura_->shelf_widget()->PostCreateShelf();
494 } 494 }
495 495
496 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) { 496 void RootWindowController::UpdateAfterLoginStatusChange(LoginStatus status) {
497 if (status != LoginStatus::NOT_LOGGED_IN) 497 if (status != LoginStatus::NOT_LOGGED_IN)
498 mouse_event_target_.reset(); 498 mouse_event_target_.reset();
499 if (shelf_widget_->status_area_widget()) 499 StatusAreaWidget* status_area_widget =
500 shelf_widget_->status_area_widget()->UpdateAfterLoginStatusChange(status); 500 wm_shelf_aura_->shelf_widget()->status_area_widget();
501 if (status_area_widget)
502 status_area_widget->UpdateAfterLoginStatusChange(status);
501 } 503 }
502 504
503 void RootWindowController::HandleInitialWallpaperAnimationStarted() { 505 void RootWindowController::HandleInitialWallpaperAnimationStarted() {
504 #if defined(OS_CHROMEOS) 506 #if defined(OS_CHROMEOS)
505 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 507 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
506 switches::kAshAnimateFromBootSplashScreen) && 508 switches::kAshAnimateFromBootSplashScreen) &&
507 boot_splash_screen_.get()) { 509 boot_splash_screen_.get()) {
508 // Make the splash screen fade out so it doesn't obscure the wallpaper's 510 // Make the splash screen fade out so it doesn't obscure the wallpaper's
509 // brightness/grayscale animation. 511 // brightness/grayscale animation.
510 boot_splash_screen_->StartHideAnimation( 512 boot_splash_screen_->StartHideAnimation(
(...skipping 20 matching lines...) Expand all
531 // Release the old controller and close its wallpaper widget. 533 // Release the old controller and close its wallpaper widget.
532 SetWallpaperWidgetController(controller); 534 SetWallpaperWidgetController(controller);
533 } 535 }
534 } 536 }
535 537
536 void RootWindowController::CloseChildWindows() { 538 void RootWindowController::CloseChildWindows() {
537 mouse_event_target_.reset(); 539 mouse_event_target_.reset();
538 540
539 // Remove observer as deactivating keyboard causes |docked_layout_manager_| 541 // Remove observer as deactivating keyboard causes |docked_layout_manager_|
540 // to fire notifications. 542 // to fire notifications.
541 if (docked_layout_manager_ && shelf_widget_ && 543 if (docked_layout_manager_ && wm_shelf_aura_->shelf_layout_manager()) {
542 shelf_widget_->shelf_layout_manager())
543 docked_layout_manager_->RemoveObserver( 544 docked_layout_manager_->RemoveObserver(
544 shelf_widget_->shelf_layout_manager()); 545 wm_shelf_aura_->shelf_layout_manager());
546 }
545 547
546 // Deactivate keyboard container before closing child windows and shutting 548 // Deactivate keyboard container before closing child windows and shutting
547 // down associated layout managers. 549 // down associated layout managers.
548 DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); 550 DeactivateKeyboard(keyboard::KeyboardController::GetInstance());
549 551
550 // panel_layout_manager_ needs to be shut down before windows are destroyed. 552 // panel_layout_manager_ needs to be shut down before windows are destroyed.
551 if (panel_layout_manager_) { 553 if (panel_layout_manager_) {
552 panel_layout_manager_->Shutdown(); 554 panel_layout_manager_->Shutdown();
553 panel_layout_manager_ = NULL; 555 panel_layout_manager_ = NULL;
554 } 556 }
555 // docked_layout_manager_ needs to be shut down before windows are destroyed. 557 // docked_layout_manager_ needs to be shut down before windows are destroyed.
556 if (docked_layout_manager_) { 558 if (docked_layout_manager_) {
557 docked_layout_manager_->Shutdown(); 559 docked_layout_manager_->Shutdown();
558 docked_layout_manager_ = NULL; 560 docked_layout_manager_ = NULL;
559 } 561 }
560 aura::Window* root_window = GetRootWindow(); 562 aura::Window* root_window = GetRootWindow();
561 aura::client::SetDragDropClient(root_window, NULL); 563 aura::client::SetDragDropClient(root_window, NULL);
562 564
563 if (shelf_widget_) 565 wm_shelf_aura_->ShutdownShelfWidget();
564 shelf_widget_->Shutdown();
565 566
566 // Close wallpaper widget first as it depends on tooltip. 567 // Close wallpaper widget first as it depends on tooltip.
567 wallpaper_widget_controller_.reset(); 568 wallpaper_widget_controller_.reset();
568 animating_wallpaper_widget_controller_.reset(); 569 animating_wallpaper_widget_controller_.reset();
569 570
570 wm_root_window_controller_->DeleteWorkspaceController(); 571 wm_root_window_controller_->DeleteWorkspaceController();
571 aura::client::SetTooltipClient(root_window, NULL); 572 aura::client::SetTooltipClient(root_window, NULL);
572 573
573 // Explicitly destroy top level windows. We do this as during part of 574 // Explicitly destroy top level windows. We do this as during part of
574 // destruction such windows may query the RootWindow for state. 575 // destruction such windows may query the RootWindow for state.
(...skipping 19 matching lines...) Expand all
594 // And then remove the containers. 595 // And then remove the containers.
595 while (!root_window->children().empty()) { 596 while (!root_window->children().empty()) {
596 aura::Window* window = root_window->children()[0]; 597 aura::Window* window = root_window->children()[0];
597 if (window->owned_by_parent()) { 598 if (window->owned_by_parent()) {
598 delete window; 599 delete window;
599 } else { 600 } else {
600 root_window->RemoveChild(window); 601 root_window->RemoveChild(window);
601 } 602 }
602 } 603 }
603 604
604 shelf_widget_.reset(); 605 wm_shelf_aura_->DestroyShelfWidget();
606
605 // CloseChildWindows may be called twice during the shutdown of ash unittests. 607 // CloseChildWindows may be called twice during the shutdown of ash unittests.
606 // Avoid notifying WmShelf that the shelf has been destroyed twice. 608 // Avoid notifying WmShelf that the shelf has been destroyed twice.
607 if (wm_shelf_aura_->IsShelfInitialized()) 609 if (wm_shelf_aura_->IsShelfInitialized())
608 wm_shelf_aura_->ShutdownShelf(); 610 wm_shelf_aura_->ShutdownShelf();
609 } 611 }
610 612
611 void RootWindowController::MoveWindowsTo(aura::Window* dst) { 613 void RootWindowController::MoveWindowsTo(aura::Window* dst) {
612 // Clear the workspace controller, so it doesn't incorrectly update the shelf. 614 // Clear the workspace controller, so it doesn't incorrectly update the shelf.
613 wm_root_window_controller_->DeleteWorkspaceController(); 615 wm_root_window_controller_->DeleteWorkspaceController();
614 ReparentAllWindows(GetRootWindow(), dst); 616 ReparentAllWindows(GetRootWindow(), dst);
615 } 617 }
616 618
617 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { 619 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() {
618 return shelf_widget_->shelf_layout_manager(); 620 return wm_shelf_aura_->shelf_layout_manager();
621 }
622
623 StatusAreaWidget* RootWindowController::GetStatusAreaWidget() {
624 ShelfWidget* shelf_widget = wm_shelf_aura_->shelf_widget();
625 return shelf_widget ? shelf_widget->status_area_widget() : nullptr;
619 } 626 }
620 627
621 SystemTray* RootWindowController::GetSystemTray() { 628 SystemTray* RootWindowController::GetSystemTray() {
622 // We assume in throughout the code that this will not return NULL. If code 629 // We assume in throughout the code that this will not return NULL. If code
623 // triggers this for valid reasons, it should test status_area_widget first. 630 // triggers this for valid reasons, it should test status_area_widget first.
624 CHECK(shelf_widget_->status_area_widget()); 631 CHECK(wm_shelf_aura_->shelf_widget()->status_area_widget());
625 return shelf_widget_->status_area_widget()->system_tray(); 632 return wm_shelf_aura_->shelf_widget()->status_area_widget()->system_tray();
626 } 633 }
627 634
628 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen, 635 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
629 ui::MenuSourceType source_type) { 636 ui::MenuSourceType source_type) {
630 ShellDelegate* delegate = WmShell::Get()->delegate(); 637 ShellDelegate* delegate = WmShell::Get()->delegate();
631 DCHECK(delegate); 638 DCHECK(delegate);
632 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr)); 639 menu_model_.reset(delegate->CreateContextMenu(wm_shelf_aura_.get(), nullptr));
633 if (!menu_model_) 640 if (!menu_model_)
634 return; 641 return;
635 642
636 menu_model_adapter_.reset(new views::MenuModelAdapter( 643 menu_model_adapter_.reset(new views::MenuModelAdapter(
637 menu_model_.get(), 644 menu_model_.get(),
638 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this)))); 645 base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this))));
639 646
640 // Wallpaper controller may not be set yet if user clicked on status are 647 // Wallpaper controller may not be set yet if user clicked on status are
641 // before initial animation completion. See crbug.com/222218 648 // before initial animation completion. See crbug.com/222218
642 if (!wallpaper_widget_controller_.get()) 649 if (!wallpaper_widget_controller_.get())
643 return; 650 return;
644 651
645 menu_runner_.reset(new views::MenuRunner( 652 menu_runner_.reset(new views::MenuRunner(
646 menu_model_adapter_->CreateMenu(), 653 menu_model_adapter_->CreateMenu(),
647 views::MenuRunner::CONTEXT_MENU | views::MenuRunner::ASYNC)); 654 views::MenuRunner::CONTEXT_MENU | views::MenuRunner::ASYNC));
648 ignore_result( 655 ignore_result(
649 menu_runner_->RunMenuAt(wallpaper_widget_controller_->widget(), nullptr, 656 menu_runner_->RunMenuAt(wallpaper_widget_controller_->widget(), nullptr,
650 gfx::Rect(location_in_screen, gfx::Size()), 657 gfx::Rect(location_in_screen, gfx::Size()),
651 views::MENU_ANCHOR_TOPLEFT, source_type)); 658 views::MENU_ANCHOR_TOPLEFT, source_type));
652 } 659 }
653 660
654 void RootWindowController::UpdateShelfVisibility() { 661 void RootWindowController::UpdateShelfVisibility() {
655 shelf_widget_->shelf_layout_manager()->UpdateVisibilityState(); 662 wm_shelf_aura_->UpdateVisibilityState();
656 } 663 }
657 664
658 aura::Window* RootWindowController::GetWindowForFullscreenMode() { 665 aura::Window* RootWindowController::GetWindowForFullscreenMode() {
659 return WmWindowAura::GetAuraWindow( 666 return WmWindowAura::GetAuraWindow(
660 wm::GetWindowForFullscreenMode(WmWindowAura::Get(GetRootWindow()))); 667 wm::GetWindowForFullscreenMode(WmWindowAura::Get(GetRootWindow())));
661 } 668 }
662 669
663 void RootWindowController::ActivateKeyboard( 670 void RootWindowController::ActivateKeyboard(
664 keyboard::KeyboardController* keyboard_controller) { 671 keyboard::KeyboardController* keyboard_controller) {
665 if (!keyboard::IsKeyboardEnabled() || 672 if (!keyboard::IsKeyboardEnabled() ||
666 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { 673 GetContainer(kShellWindowId_VirtualKeyboardContainer)) {
667 return; 674 return;
668 } 675 }
669 DCHECK(keyboard_controller); 676 DCHECK(keyboard_controller);
670 keyboard_controller->AddObserver(shelf_widget()->shelf_layout_manager()); 677 keyboard_controller->AddObserver(wm_shelf_aura_->shelf_layout_manager());
671 keyboard_controller->AddObserver(panel_layout_manager_); 678 keyboard_controller->AddObserver(panel_layout_manager_);
672 keyboard_controller->AddObserver(docked_layout_manager_); 679 keyboard_controller->AddObserver(docked_layout_manager_);
673 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); 680 keyboard_controller->AddObserver(workspace_controller()->layout_manager());
674 keyboard_controller->AddObserver( 681 keyboard_controller->AddObserver(
675 always_on_top_controller_->GetLayoutManager()); 682 always_on_top_controller_->GetLayoutManager());
676 WmShell::Get()->NotifyVirtualKeyboardActivated(true); 683 WmShell::Get()->NotifyVirtualKeyboardActivated(true);
677 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); 684 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer);
678 DCHECK(parent); 685 DCHECK(parent);
679 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); 686 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow();
680 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); 687 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer);
681 parent->AddChild(keyboard_container); 688 parent->AddChild(keyboard_container);
682 } 689 }
683 690
684 void RootWindowController::DeactivateKeyboard( 691 void RootWindowController::DeactivateKeyboard(
685 keyboard::KeyboardController* keyboard_controller) { 692 keyboard::KeyboardController* keyboard_controller) {
686 if (!keyboard_controller || 693 if (!keyboard_controller ||
687 !keyboard_controller->keyboard_container_initialized()) { 694 !keyboard_controller->keyboard_container_initialized()) {
688 return; 695 return;
689 } 696 }
690 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); 697 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow();
691 if (keyboard_container->GetRootWindow() == GetRootWindow()) { 698 if (keyboard_container->GetRootWindow() == GetRootWindow()) {
692 aura::Window* parent = 699 aura::Window* parent =
693 GetContainer(kShellWindowId_ImeWindowParentContainer); 700 GetContainer(kShellWindowId_ImeWindowParentContainer);
694 DCHECK(parent); 701 DCHECK(parent);
695 parent->RemoveChild(keyboard_container); 702 parent->RemoveChild(keyboard_container);
696 // Virtual keyboard may be deactivated while still showing, notify all 703 // Virtual keyboard may be deactivated while still showing, notify all
697 // observers that keyboard bounds changed to 0 before remove them. 704 // observers that keyboard bounds changed to 0 before remove them.
698 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); 705 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect());
699 keyboard_controller->RemoveObserver(shelf_widget()->shelf_layout_manager()); 706 keyboard_controller->RemoveObserver(wm_shelf_aura_->shelf_layout_manager());
700 keyboard_controller->RemoveObserver(panel_layout_manager_); 707 keyboard_controller->RemoveObserver(panel_layout_manager_);
701 keyboard_controller->RemoveObserver(docked_layout_manager_); 708 keyboard_controller->RemoveObserver(docked_layout_manager_);
702 keyboard_controller->RemoveObserver( 709 keyboard_controller->RemoveObserver(
703 workspace_controller()->layout_manager()); 710 workspace_controller()->layout_manager());
704 keyboard_controller->RemoveObserver( 711 keyboard_controller->RemoveObserver(
705 always_on_top_controller_->GetLayoutManager()); 712 always_on_top_controller_->GetLayoutManager());
706 WmShell::Get()->NotifyVirtualKeyboardActivated(false); 713 WmShell::Get()->NotifyVirtualKeyboardActivated(false);
707 } 714 }
708 } 715 }
709 716
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 DCHECK(lock_modal_container); 812 DCHECK(lock_modal_container);
806 lock_modal_container->SetLayoutManager( 813 lock_modal_container->SetLayoutManager(
807 new SystemModalContainerLayoutManager(lock_modal_container)); 814 new SystemModalContainerLayoutManager(lock_modal_container));
808 815
809 WmWindow* always_on_top_container = 816 WmWindow* always_on_top_container =
810 WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer)); 817 WmWindowAura::Get(GetContainer(kShellWindowId_AlwaysOnTopContainer));
811 always_on_top_controller_.reset( 818 always_on_top_controller_.reset(
812 new AlwaysOnTopController(always_on_top_container)); 819 new AlwaysOnTopController(always_on_top_container));
813 820
814 // Create the shelf and status area widgets. 821 // Create the shelf and status area widgets.
815 DCHECK(!shelf_widget_.get()); 822 DCHECK(!wm_shelf_aura_->shelf_widget());
816 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); 823 aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer);
817 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); 824 aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer);
818 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container); 825 WmWindow* wm_shelf_container = WmWindowAura::Get(shelf_container);
819 WmWindow* wm_status_container = WmWindowAura::Get(status_container); 826 WmWindow* wm_status_container = WmWindowAura::Get(status_container);
820 shelf_widget_.reset(new ShelfWidget(wm_shelf_container, wm_status_container, 827 wm_shelf_aura_->CreateShelfWidget(WmWindowAura::Get(root_window));
821 wm_shelf_aura_.get())); 828
822 // Make it easier to resize windows that partially overlap the shelf. Must 829 // Make it easier to resize windows that partially overlap the shelf. Must
823 // occur after the ShelfLayoutManager is constructed by ShelfWidget. 830 // occur after the ShelfLayoutManager is constructed by ShelfWidget.
824 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( 831 shelf_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>(
825 wm_shelf_container, wm_shelf_aura_.get())); 832 wm_shelf_container, wm_shelf_aura_.get()));
826 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>( 833 status_container->SetEventTargeter(base::MakeUnique<ShelfWindowTargeter>(
827 wm_status_container, wm_shelf_aura_.get())); 834 wm_status_container, wm_shelf_aura_.get()));
828 835
829 if (!WmShell::Get() 836 if (!WmShell::Get()
830 ->GetSessionStateDelegate() 837 ->GetSessionStateDelegate()
831 ->IsActiveUserSessionStarted()) { 838 ->IsActiveUserSessionStarted()) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 919 }
913 920
914 void RootWindowController::OnMenuClosed() { 921 void RootWindowController::OnMenuClosed() {
915 menu_runner_.reset(); 922 menu_runner_.reset();
916 menu_model_adapter_.reset(); 923 menu_model_adapter_.reset();
917 menu_model_.reset(); 924 menu_model_.reset();
918 Shell::GetInstance()->UpdateShelfVisibility(); 925 Shell::GetInstance()->UpdateShelfVisibility();
919 } 926 }
920 927
921 void RootWindowController::OnLoginStateChanged(LoginStatus status) { 928 void RootWindowController::OnLoginStateChanged(LoginStatus status) {
922 shelf_widget_->shelf_layout_manager()->UpdateVisibilityState(); 929 wm_shelf_aura_->UpdateVisibilityState();
923 } 930 }
924 931
925 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { 932 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
926 if (enabled) 933 if (enabled)
927 EnableTouchHudProjection(); 934 EnableTouchHudProjection();
928 else 935 else
929 DisableTouchHudProjection(); 936 DisableTouchHudProjection();
930 } 937 }
931 938
932 RootWindowController* GetRootWindowController(const aura::Window* root_window) { 939 RootWindowController* GetRootWindowController(const aura::Window* root_window) {
933 if (!root_window) 940 if (!root_window)
934 return nullptr; 941 return nullptr;
935 942
936 if (Shell::GetInstance()->in_mus()) { 943 if (Shell::GetInstance()->in_mus()) {
937 // On mus, like desktop aura, each top-level widget has its own root window, 944 // On mus, like desktop aura, each top-level widget has its own root window,
938 // so |root_window| is not necessarily the display's root. For now, just 945 // so |root_window| is not necessarily the display's root. For now, just
939 // the use the primary display root. 946 // the use the primary display root.
940 // TODO(jamescook): Multi-display support. This depends on how mus windows 947 // TODO(jamescook): Multi-display support. This depends on how mus windows
941 // will be owned by displays. 948 // will be owned by displays.
942 aura::Window* primary_root_window = Shell::GetInstance() 949 aura::Window* primary_root_window = Shell::GetInstance()
943 ->window_tree_host_manager() 950 ->window_tree_host_manager()
944 ->GetPrimaryRootWindow(); 951 ->GetPrimaryRootWindow();
945 return GetRootWindowSettings(primary_root_window)->controller; 952 return GetRootWindowSettings(primary_root_window)->controller;
946 } 953 }
947 954
948 return GetRootWindowSettings(root_window)->controller; 955 return GetRootWindowSettings(root_window)->controller;
949 } 956 }
950 957
951 } // namespace ash 958 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698