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/ash_constants.h" | 10 #include "ash/ash_constants.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 return; | 640 return; |
641 } | 641 } |
642 DCHECK(keyboard_controller); | 642 DCHECK(keyboard_controller); |
643 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 643 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
644 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 644 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
645 keyboard_controller->AddObserver(panel_layout_manager_); | 645 keyboard_controller->AddObserver(panel_layout_manager_); |
646 keyboard_controller->AddObserver(docked_layout_manager_); | 646 keyboard_controller->AddObserver(docked_layout_manager_); |
647 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); | 647 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); |
648 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); | 648 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); |
649 } | 649 } |
650 aura::Window* parent = GetContainer( | 650 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
651 kShellWindowId_VirtualKeyboardParentContainer); | |
652 DCHECK(parent); | 651 DCHECK(parent); |
653 aura::Window* keyboard_container = | 652 aura::Window* keyboard_container = |
654 keyboard_controller->GetContainerWindow(); | 653 keyboard_controller->GetContainerWindow(); |
655 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 654 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
656 parent->AddChild(keyboard_container); | 655 parent->AddChild(keyboard_container); |
657 // TODO(oshima): Bounds of keyboard container should be handled by | 656 // TODO(oshima): Bounds of keyboard container should be handled by |
658 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 657 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
659 keyboard_container->SetBounds(parent->bounds()); | 658 keyboard_container->SetBounds(parent->bounds()); |
660 } | 659 } |
661 | 660 |
662 void RootWindowController::DeactivateKeyboard( | 661 void RootWindowController::DeactivateKeyboard( |
663 keyboard::KeyboardController* keyboard_controller) { | 662 keyboard::KeyboardController* keyboard_controller) { |
664 if (!keyboard_controller || | 663 if (!keyboard_controller || |
665 !keyboard_controller->keyboard_container_initialized()) { | 664 !keyboard_controller->keyboard_container_initialized()) { |
666 return; | 665 return; |
667 } | 666 } |
668 aura::Window* keyboard_container = | 667 aura::Window* keyboard_container = |
669 keyboard_controller->GetContainerWindow(); | 668 keyboard_controller->GetContainerWindow(); |
670 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 669 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
671 aura::Window* parent = GetContainer( | 670 aura::Window* parent = GetContainer( |
672 kShellWindowId_VirtualKeyboardParentContainer); | 671 kShellWindowId_ImeWindowParentContainer); |
673 DCHECK(parent); | 672 DCHECK(parent); |
674 parent->RemoveChild(keyboard_container); | 673 parent->RemoveChild(keyboard_container); |
675 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 674 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
676 // Virtual keyboard may be deactivated while still showing, notify all | 675 // Virtual keyboard may be deactivated while still showing, notify all |
677 // observers that keyboard bounds changed to 0 before remove them. | 676 // observers that keyboard bounds changed to 0 before remove them. |
678 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 677 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
679 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 678 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
680 keyboard_controller->RemoveObserver(panel_layout_manager_); | 679 keyboard_controller->RemoveObserver(panel_layout_manager_); |
681 keyboard_controller->RemoveObserver(docked_layout_manager_); | 680 keyboard_controller->RemoveObserver(docked_layout_manager_); |
682 keyboard_controller->RemoveObserver( | 681 keyboard_controller->RemoveObserver( |
683 workspace_controller_->layout_manager()); | 682 workspace_controller_->layout_manager()); |
684 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); | 683 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); |
685 } | 684 } |
686 } | 685 } |
687 } | 686 } |
688 | 687 |
689 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 688 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
690 aura::Window* parent = GetContainer( | 689 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
691 kShellWindowId_VirtualKeyboardParentContainer); | |
692 return parent ? parent->Contains(window) : false; | 690 return parent ? parent->Contains(window) : false; |
693 } | 691 } |
694 | 692 |
695 //////////////////////////////////////////////////////////////////////////////// | 693 //////////////////////////////////////////////////////////////////////////////// |
696 // RootWindowController, private: | 694 // RootWindowController, private: |
697 | 695 |
698 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) | 696 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) |
699 : ash_host_(ash_host), | 697 : ash_host_(ash_host), |
700 root_window_layout_(NULL), | 698 root_window_layout_(NULL), |
701 docked_layout_manager_(NULL), | 699 docked_layout_manager_(NULL), |
(...skipping 13 matching lines...) Expand all Loading... |
715 bool first_run_after_boot) { | 713 bool first_run_after_boot) { |
716 aura::Window* root_window = GetRootWindow(); | 714 aura::Window* root_window = GetRootWindow(); |
717 Shell* shell = Shell::GetInstance(); | 715 Shell* shell = Shell::GetInstance(); |
718 shell->InitRootWindow(root_window); | 716 shell->InitRootWindow(root_window); |
719 | 717 |
720 ash_host_->AsWindowTreeHost()->SetCursor(ui::kCursorPointer); | 718 ash_host_->AsWindowTreeHost()->SetCursor(ui::kCursorPointer); |
721 CreateContainersInRootWindow(root_window); | 719 CreateContainersInRootWindow(root_window); |
722 | 720 |
723 if (root_window_type == VIRTUAL_KEYBOARD) { | 721 if (root_window_type == VIRTUAL_KEYBOARD) { |
724 aura::Window* virtual_keyboard_parent_container = GetContainer( | 722 aura::Window* virtual_keyboard_parent_container = GetContainer( |
725 kShellWindowId_VirtualKeyboardParentContainer); | 723 kShellWindowId_ImeWindowParentContainer); |
726 virtual_keyboard_parent_container->SetBounds(root_window->bounds()); | 724 virtual_keyboard_parent_container->SetBounds(root_window->bounds()); |
727 shell->InitKeyboard(); | 725 shell->InitKeyboard(); |
728 return; | 726 return; |
729 } | 727 } |
730 | 728 |
731 CreateSystemBackground(first_run_after_boot); | 729 CreateSystemBackground(first_run_after_boot); |
732 | 730 |
733 InitLayoutManagers(); | 731 InitLayoutManagers(); |
734 InitTouchHuds(); | 732 InitTouchHuds(); |
735 | 733 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 SetUsesScreenCoordinates(drag_drop_container); | 1033 SetUsesScreenCoordinates(drag_drop_container); |
1036 | 1034 |
1037 aura::Window* overlay_container = CreateContainer( | 1035 aura::Window* overlay_container = CreateContainer( |
1038 kShellWindowId_OverlayContainer, | 1036 kShellWindowId_OverlayContainer, |
1039 "OverlayContainer", | 1037 "OverlayContainer", |
1040 lock_screen_related_containers); | 1038 lock_screen_related_containers); |
1041 wm::SetSnapsChildrenToPhysicalPixelBoundary(overlay_container); | 1039 wm::SetSnapsChildrenToPhysicalPixelBoundary(overlay_container); |
1042 SetUsesScreenCoordinates(overlay_container); | 1040 SetUsesScreenCoordinates(overlay_container); |
1043 | 1041 |
1044 aura::Window* virtual_keyboard_parent_container = CreateContainer( | 1042 aura::Window* virtual_keyboard_parent_container = CreateContainer( |
1045 kShellWindowId_VirtualKeyboardParentContainer, | 1043 kShellWindowId_ImeWindowParentContainer, |
1046 "VirtualKeyboardParentContainer", | 1044 "VirtualKeyboardParentContainer", |
1047 root_window); | 1045 root_window); |
1048 wm::SetSnapsChildrenToPhysicalPixelBoundary( | 1046 wm::SetSnapsChildrenToPhysicalPixelBoundary( |
1049 virtual_keyboard_parent_container); | 1047 virtual_keyboard_parent_container); |
1050 SetUsesScreenCoordinates(virtual_keyboard_parent_container); | 1048 SetUsesScreenCoordinates(virtual_keyboard_parent_container); |
1051 | 1049 |
1052 #if defined(OS_CHROMEOS) | 1050 #if defined(OS_CHROMEOS) |
1053 aura::Window* mouse_cursor_container = CreateContainer( | 1051 aura::Window* mouse_cursor_container = CreateContainer( |
1054 kShellWindowId_MouseCursorContainer, | 1052 kShellWindowId_MouseCursorContainer, |
1055 "MouseCursorContainer", | 1053 "MouseCursorContainer", |
(...skipping 27 matching lines...) Expand all Loading... |
1083 else | 1081 else |
1084 DisableTouchHudProjection(); | 1082 DisableTouchHudProjection(); |
1085 } | 1083 } |
1086 | 1084 |
1087 RootWindowController* GetRootWindowController( | 1085 RootWindowController* GetRootWindowController( |
1088 const aura::Window* root_window) { | 1086 const aura::Window* root_window) { |
1089 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1087 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
1090 } | 1088 } |
1091 | 1089 |
1092 } // namespace ash | 1090 } // namespace ash |
OLD | NEW |