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