| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 if (docked_window_layout_manager_) { | 379 if (docked_window_layout_manager_) { |
| 380 docked_window_layout_manager_->SetShelf(wm_shelf_.get()); | 380 docked_window_layout_manager_->SetShelf(wm_shelf_.get()); |
| 381 if (wm_shelf_->shelf_layout_manager()) | 381 if (wm_shelf_->shelf_layout_manager()) |
| 382 docked_window_layout_manager_->AddObserver( | 382 docked_window_layout_manager_->AddObserver( |
| 383 wm_shelf_->shelf_layout_manager()); | 383 wm_shelf_->shelf_layout_manager()); |
| 384 } | 384 } |
| 385 | 385 |
| 386 // Notify shell observers that the shelf has been created. | 386 // Notify shell observers that the shelf has been created. |
| 387 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will | 387 // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will |
| 388 // require changing AttachedPanelWidgetTargeter's access to WmShelf. | 388 // require changing AttachedPanelWidgetTargeter's access to WmShelf. |
| 389 WmShell::Get()->NotifyShelfCreatedForRootWindow( | 389 Shell::GetInstance()->NotifyShelfCreatedForRootWindow( |
| 390 WmWindow::Get(GetRootWindow())); | 390 WmWindow::Get(GetRootWindow())); |
| 391 | 391 |
| 392 wm_shelf_->shelf_widget()->PostCreateShelf(); | 392 wm_shelf_->shelf_widget()->PostCreateShelf(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 395 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 396 return wm_shelf_->shelf_layout_manager(); | 396 return wm_shelf_->shelf_layout_manager(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 SystemModalContainerLayoutManager* | 399 SystemModalContainerLayoutManager* |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 if (animating_wallpaper_widget_controller()) { | 544 if (animating_wallpaper_widget_controller()) { |
| 545 WallpaperWidgetController* controller = | 545 WallpaperWidgetController* controller = |
| 546 animating_wallpaper_widget_controller()->GetController(true); | 546 animating_wallpaper_widget_controller()->GetController(true); |
| 547 DCHECK_EQ(controller->widget(), widget); | 547 DCHECK_EQ(controller->widget(), widget); |
| 548 // Release the old controller and close its wallpaper widget. | 548 // Release the old controller and close its wallpaper widget. |
| 549 SetWallpaperWidgetController(controller); | 549 SetWallpaperWidgetController(controller); |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 | 552 |
| 553 void RootWindowController::Shutdown() { | 553 void RootWindowController::Shutdown() { |
| 554 WmShell::Get()->RemoveShellObserver(this); | 554 Shell::GetInstance()->RemoveShellObserver(this); |
| 555 | 555 |
| 556 touch_exploration_manager_.reset(); | 556 touch_exploration_manager_.reset(); |
| 557 | 557 |
| 558 ResetRootForNewWindowsIfNecessary(); | 558 ResetRootForNewWindowsIfNecessary(); |
| 559 | 559 |
| 560 CloseChildWindows(); | 560 CloseChildWindows(); |
| 561 aura::Window* root_window = GetRootWindow(); | 561 aura::Window* root_window = GetRootWindow(); |
| 562 GetRootWindowSettings(root_window)->controller = nullptr; | 562 GetRootWindowSettings(root_window)->controller = nullptr; |
| 563 // Forget with the display ID so that display lookup | 563 // Forget with the display ID so that display lookup |
| 564 // ends up with invalid display. | 564 // ends up with invalid display. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 673 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 674 return; | 674 return; |
| 675 } | 675 } |
| 676 DCHECK(keyboard_controller); | 676 DCHECK(keyboard_controller); |
| 677 keyboard_controller->AddObserver(wm_shelf_->shelf_layout_manager()); | 677 keyboard_controller->AddObserver(wm_shelf_->shelf_layout_manager()); |
| 678 keyboard_controller->AddObserver(panel_layout_manager()); | 678 keyboard_controller->AddObserver(panel_layout_manager()); |
| 679 keyboard_controller->AddObserver(docked_window_layout_manager()); | 679 keyboard_controller->AddObserver(docked_window_layout_manager()); |
| 680 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); | 680 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); |
| 681 keyboard_controller->AddObserver( | 681 keyboard_controller->AddObserver( |
| 682 always_on_top_controller_->GetLayoutManager()); | 682 always_on_top_controller_->GetLayoutManager()); |
| 683 WmShell::Get()->NotifyVirtualKeyboardActivated(true); | 683 Shell::GetInstance()->NotifyVirtualKeyboardActivated(true); |
| 684 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 684 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 685 DCHECK(parent); | 685 DCHECK(parent); |
| 686 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 686 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
| 687 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 687 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 688 parent->AddChild(keyboard_container); | 688 parent->AddChild(keyboard_container); |
| 689 } | 689 } |
| 690 | 690 |
| 691 void RootWindowController::DeactivateKeyboard( | 691 void RootWindowController::DeactivateKeyboard( |
| 692 keyboard::KeyboardController* keyboard_controller) { | 692 keyboard::KeyboardController* keyboard_controller) { |
| 693 if (!keyboard_controller || | 693 if (!keyboard_controller || |
| (...skipping 10 matching lines...) Expand all Loading... |
| 704 keyboard_controller->HideKeyboard( | 704 keyboard_controller->HideKeyboard( |
| 705 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); | 705 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); |
| 706 parent->RemoveChild(keyboard_container); | 706 parent->RemoveChild(keyboard_container); |
| 707 keyboard_controller->RemoveObserver(wm_shelf_->shelf_layout_manager()); | 707 keyboard_controller->RemoveObserver(wm_shelf_->shelf_layout_manager()); |
| 708 keyboard_controller->RemoveObserver(panel_layout_manager()); | 708 keyboard_controller->RemoveObserver(panel_layout_manager()); |
| 709 keyboard_controller->RemoveObserver(docked_window_layout_manager()); | 709 keyboard_controller->RemoveObserver(docked_window_layout_manager()); |
| 710 keyboard_controller->RemoveObserver( | 710 keyboard_controller->RemoveObserver( |
| 711 workspace_controller()->layout_manager()); | 711 workspace_controller()->layout_manager()); |
| 712 keyboard_controller->RemoveObserver( | 712 keyboard_controller->RemoveObserver( |
| 713 always_on_top_controller_->GetLayoutManager()); | 713 always_on_top_controller_->GetLayoutManager()); |
| 714 WmShell::Get()->NotifyVirtualKeyboardActivated(false); | 714 Shell::GetInstance()->NotifyVirtualKeyboardActivated(false); |
| 715 } | 715 } |
| 716 } | 716 } |
| 717 | 717 |
| 718 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 718 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
| 719 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 719 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 720 return parent ? parent->Contains(window) : false; | 720 return parent ? parent->Contains(window) : false; |
| 721 } | 721 } |
| 722 | 722 |
| 723 void RootWindowController::SetTouchAccessibilityAnchorPoint( | 723 void RootWindowController::SetTouchAccessibilityAnchorPoint( |
| 724 const gfx::Point& anchor_point) { | 724 const gfx::Point& anchor_point) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 | 797 |
| 798 InitLayoutManagers(); | 798 InitLayoutManagers(); |
| 799 InitTouchHuds(); | 799 InitTouchHuds(); |
| 800 | 800 |
| 801 if (wm_shell->GetPrimaryRootWindowController() | 801 if (wm_shell->GetPrimaryRootWindowController() |
| 802 ->GetSystemModalLayoutManager(nullptr) | 802 ->GetSystemModalLayoutManager(nullptr) |
| 803 ->has_window_dimmer()) { | 803 ->has_window_dimmer()) { |
| 804 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); | 804 GetSystemModalLayoutManager(nullptr)->CreateModalBackground(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 wm_shell->AddShellObserver(this); | 807 shell->AddShellObserver(this); |
| 808 | 808 |
| 809 root_window_layout_manager_->OnWindowResized(); | 809 root_window_layout_manager_->OnWindowResized(); |
| 810 if (root_window_type == RootWindowType::PRIMARY) { | 810 if (root_window_type == RootWindowType::PRIMARY) { |
| 811 if (!wm_shell->IsRunningInMash()) | 811 if (!wm_shell->IsRunningInMash()) |
| 812 shell->InitKeyboard(); | 812 shell->InitKeyboard(); |
| 813 } else { | 813 } else { |
| 814 window_tree_host_->Show(); | 814 window_tree_host_->Show(); |
| 815 | 815 |
| 816 // Create a shelf if a user is already logged in. | 816 // Create a shelf if a user is already logged in. |
| 817 if (wm_shell->GetSessionStateDelegate()->NumberOfLoggedInUsers()) | 817 if (wm_shell->GetSessionStateDelegate()->NumberOfLoggedInUsers()) |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 EnableTouchHudProjection(); | 1154 EnableTouchHudProjection(); |
| 1155 else | 1155 else |
| 1156 DisableTouchHudProjection(); | 1156 DisableTouchHudProjection(); |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1159 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1160 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1160 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 } // namespace ash | 1163 } // namespace ash |
| OLD | NEW |