| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 wm::GetWindowForFullscreenMode(WmWindow::Get(GetRootWindow()))); | 666 wm::GetWindowForFullscreenMode(WmWindow::Get(GetRootWindow()))); |
| 667 } | 667 } |
| 668 | 668 |
| 669 void RootWindowController::ActivateKeyboard( | 669 void RootWindowController::ActivateKeyboard( |
| 670 keyboard::KeyboardController* keyboard_controller) { | 670 keyboard::KeyboardController* keyboard_controller) { |
| 671 if (!keyboard::IsKeyboardEnabled() || | 671 if (!keyboard::IsKeyboardEnabled() || |
| 672 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 672 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 673 return; | 673 return; |
| 674 } | 674 } |
| 675 DCHECK(keyboard_controller); | 675 DCHECK(keyboard_controller); |
| 676 keyboard_controller->AddObserver(wm_shelf_->shelf_layout_manager()); | 676 Shell::GetInstance()->NotifyVirtualKeyboardActivated( |
| 677 keyboard_controller->AddObserver(panel_layout_manager()); | 677 true, WmWindow::Get(GetRootWindow())); |
| 678 keyboard_controller->AddObserver(docked_window_layout_manager()); | |
| 679 keyboard_controller->AddObserver(workspace_controller()->layout_manager()); | |
| 680 keyboard_controller->AddObserver( | |
| 681 always_on_top_controller_->GetLayoutManager()); | |
| 682 Shell::GetInstance()->NotifyVirtualKeyboardActivated(true); | |
| 683 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 678 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 684 DCHECK(parent); | 679 DCHECK(parent); |
| 685 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 680 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
| 686 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 681 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 687 parent->AddChild(keyboard_container); | 682 parent->AddChild(keyboard_container); |
| 688 } | 683 } |
| 689 | 684 |
| 690 void RootWindowController::DeactivateKeyboard( | 685 void RootWindowController::DeactivateKeyboard( |
| 691 keyboard::KeyboardController* keyboard_controller) { | 686 keyboard::KeyboardController* keyboard_controller) { |
| 692 if (!keyboard_controller || | 687 if (!keyboard_controller || |
| 693 !keyboard_controller->keyboard_container_initialized()) { | 688 !keyboard_controller->keyboard_container_initialized()) { |
| 694 return; | 689 return; |
| 695 } | 690 } |
| 696 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 691 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
| 697 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 692 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
| 698 aura::Window* parent = | 693 aura::Window* parent = |
| 699 GetContainer(kShellWindowId_ImeWindowParentContainer); | 694 GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 700 DCHECK(parent); | 695 DCHECK(parent); |
| 701 // Virtual keyboard may be deactivated while still showing, hide the | 696 // Virtual keyboard may be deactivated while still showing, hide the |
| 702 // keyboard before removing it from view hierarchy. | 697 // keyboard before removing it from view hierarchy. |
| 703 keyboard_controller->HideKeyboard( | 698 keyboard_controller->HideKeyboard( |
| 704 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); | 699 keyboard::KeyboardController::HIDE_REASON_AUTOMATIC); |
| 705 parent->RemoveChild(keyboard_container); | 700 parent->RemoveChild(keyboard_container); |
| 706 keyboard_controller->RemoveObserver(wm_shelf_->shelf_layout_manager()); | 701 Shell::GetInstance()->NotifyVirtualKeyboardActivated( |
| 707 keyboard_controller->RemoveObserver(panel_layout_manager()); | 702 false, WmWindow::Get(GetRootWindow())); |
| 708 keyboard_controller->RemoveObserver(docked_window_layout_manager()); | |
| 709 keyboard_controller->RemoveObserver( | |
| 710 workspace_controller()->layout_manager()); | |
| 711 keyboard_controller->RemoveObserver( | |
| 712 always_on_top_controller_->GetLayoutManager()); | |
| 713 Shell::GetInstance()->NotifyVirtualKeyboardActivated(false); | |
| 714 } | 703 } |
| 715 } | 704 } |
| 716 | 705 |
| 717 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 706 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
| 718 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 707 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 719 return parent ? parent->Contains(window) : false; | 708 return parent ? parent->Contains(window) : false; |
| 720 } | 709 } |
| 721 | 710 |
| 722 void RootWindowController::SetTouchAccessibilityAnchorPoint( | 711 void RootWindowController::SetTouchAccessibilityAnchorPoint( |
| 723 const gfx::Point& anchor_point) { | 712 const gfx::Point& anchor_point) { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 EnableTouchHudProjection(); | 1142 EnableTouchHudProjection(); |
| 1154 else | 1143 else |
| 1155 DisableTouchHudProjection(); | 1144 DisableTouchHudProjection(); |
| 1156 } | 1145 } |
| 1157 | 1146 |
| 1158 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1147 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1159 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1148 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1160 } | 1149 } |
| 1161 | 1150 |
| 1162 } // namespace ash | 1151 } // namespace ash |
| OLD | NEW |