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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 return NULL; | 636 return NULL; |
637 } | 637 } |
638 | 638 |
639 void RootWindowController::ActivateKeyboard( | 639 void RootWindowController::ActivateKeyboard( |
640 keyboard::KeyboardController* keyboard_controller) { | 640 keyboard::KeyboardController* keyboard_controller) { |
641 if (!keyboard::IsKeyboardEnabled() || | 641 if (!keyboard::IsKeyboardEnabled() || |
642 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 642 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
643 return; | 643 return; |
644 } | 644 } |
645 DCHECK(keyboard_controller); | 645 DCHECK(keyboard_controller); |
646 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 646 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
647 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 647 keyboard_controller->AddObserver(panel_layout_manager_); |
648 keyboard_controller->AddObserver(panel_layout_manager_); | 648 keyboard_controller->AddObserver(docked_layout_manager_); |
649 keyboard_controller->AddObserver(docked_layout_manager_); | 649 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); |
650 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); | 650 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); |
651 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); | |
652 } | |
653 aura::Window* parent = GetContainer( | 651 aura::Window* parent = GetContainer( |
654 kShellWindowId_VirtualKeyboardParentContainer); | 652 kShellWindowId_VirtualKeyboardParentContainer); |
655 DCHECK(parent); | 653 DCHECK(parent); |
656 aura::Window* keyboard_container = | 654 aura::Window* keyboard_container = |
657 keyboard_controller->GetContainerWindow(); | 655 keyboard_controller->GetContainerWindow(); |
658 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 656 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
659 parent->AddChild(keyboard_container); | 657 parent->AddChild(keyboard_container); |
660 // TODO(oshima): Bounds of keyboard container should be handled by | 658 // TODO(oshima): Bounds of keyboard container should be handled by |
661 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 659 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
662 keyboard_container->SetBounds(parent->bounds()); | 660 keyboard_container->SetBounds(parent->bounds()); |
663 } | 661 } |
664 | 662 |
665 void RootWindowController::DeactivateKeyboard( | 663 void RootWindowController::DeactivateKeyboard( |
666 keyboard::KeyboardController* keyboard_controller) { | 664 keyboard::KeyboardController* keyboard_controller) { |
667 if (!keyboard_controller || | 665 if (!keyboard_controller || |
668 !keyboard_controller->keyboard_container_initialized()) { | 666 !keyboard_controller->keyboard_container_initialized()) { |
669 return; | 667 return; |
670 } | 668 } |
671 aura::Window* keyboard_container = | 669 aura::Window* keyboard_container = |
672 keyboard_controller->GetContainerWindow(); | 670 keyboard_controller->GetContainerWindow(); |
673 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 671 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
674 aura::Window* parent = GetContainer( | 672 aura::Window* parent = GetContainer( |
675 kShellWindowId_VirtualKeyboardParentContainer); | 673 kShellWindowId_VirtualKeyboardParentContainer); |
676 DCHECK(parent); | 674 DCHECK(parent); |
677 parent->RemoveChild(keyboard_container); | 675 parent->RemoveChild(keyboard_container); |
678 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 676 // Virtual keyboard may be deactivated while still showing, notify all |
679 // Virtual keyboard may be deactivated while still showing, notify all | 677 // observers that keyboard bounds changed to 0 before remove them. |
680 // observers that keyboard bounds changed to 0 before remove them. | 678 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
681 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 679 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
682 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 680 keyboard_controller->RemoveObserver(panel_layout_manager_); |
683 keyboard_controller->RemoveObserver(panel_layout_manager_); | 681 keyboard_controller->RemoveObserver(docked_layout_manager_); |
684 keyboard_controller->RemoveObserver(docked_layout_manager_); | 682 keyboard_controller->RemoveObserver( |
685 keyboard_controller->RemoveObserver( | 683 workspace_controller_->layout_manager()); |
686 workspace_controller_->layout_manager()); | 684 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); |
687 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); | |
688 } | |
689 } | 685 } |
690 } | 686 } |
691 | 687 |
692 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 688 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
693 aura::Window* parent = GetContainer( | 689 aura::Window* parent = GetContainer( |
694 kShellWindowId_VirtualKeyboardParentContainer); | 690 kShellWindowId_VirtualKeyboardParentContainer); |
695 return parent ? parent->Contains(window) : false; | 691 return parent ? parent->Contains(window) : false; |
696 } | 692 } |
697 | 693 |
698 //////////////////////////////////////////////////////////////////////////////// | 694 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 734 |
739 if (Shell::GetPrimaryRootWindowController()-> | 735 if (Shell::GetPrimaryRootWindowController()-> |
740 GetSystemModalLayoutManager(NULL)->has_modal_background()) { | 736 GetSystemModalLayoutManager(NULL)->has_modal_background()) { |
741 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 737 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
742 } | 738 } |
743 | 739 |
744 shell->AddShellObserver(this); | 740 shell->AddShellObserver(this); |
745 | 741 |
746 if (root_window_type == PRIMARY) { | 742 if (root_window_type == PRIMARY) { |
747 root_window_layout()->OnWindowResized(); | 743 root_window_layout()->OnWindowResized(); |
748 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) | 744 shell->InitKeyboard(); |
749 shell->InitKeyboard(); | |
750 } else { | 745 } else { |
751 root_window_layout()->OnWindowResized(); | 746 root_window_layout()->OnWindowResized(); |
752 ash_host_->AsWindowTreeHost()->Show(); | 747 ash_host_->AsWindowTreeHost()->Show(); |
753 | 748 |
754 // Create a shelf if a user is already logged in. | 749 // Create a shelf if a user is already logged in. |
755 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 750 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
756 shelf()->CreateShelf(); | 751 shelf()->CreateShelf(); |
757 | 752 |
758 // Notify shell observers about new root window. | 753 // Notify shell observers about new root window. |
759 shell->OnRootWindowAdded(root_window); | 754 shell->OnRootWindowAdded(root_window); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 else | 1081 else |
1087 DisableTouchHudProjection(); | 1082 DisableTouchHudProjection(); |
1088 } | 1083 } |
1089 | 1084 |
1090 RootWindowController* GetRootWindowController( | 1085 RootWindowController* GetRootWindowController( |
1091 const aura::Window* root_window) { | 1086 const aura::Window* root_window) { |
1092 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1087 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
1093 } | 1088 } |
1094 | 1089 |
1095 } // namespace ash | 1090 } // namespace ash |
OLD | NEW |