| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 if (!keyboard::IsKeyboardEnabled() || | 634 if (!keyboard::IsKeyboardEnabled() || |
| 635 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 635 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 636 return; | 636 return; |
| 637 } | 637 } |
| 638 DCHECK(keyboard_controller); | 638 DCHECK(keyboard_controller); |
| 639 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 639 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
| 640 keyboard_controller->AddObserver(panel_layout_manager_); | 640 keyboard_controller->AddObserver(panel_layout_manager_); |
| 641 keyboard_controller->AddObserver(docked_layout_manager_); | 641 keyboard_controller->AddObserver(docked_layout_manager_); |
| 642 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); | 642 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); |
| 643 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); | 643 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); |
| 644 aura::Window* parent = GetContainer( | 644 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 645 kShellWindowId_VirtualKeyboardParentContainer); | |
| 646 DCHECK(parent); | 645 DCHECK(parent); |
| 647 aura::Window* keyboard_container = | 646 aura::Window* keyboard_container = |
| 648 keyboard_controller->GetContainerWindow(); | 647 keyboard_controller->GetContainerWindow(); |
| 649 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 648 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 650 parent->AddChild(keyboard_container); | 649 parent->AddChild(keyboard_container); |
| 651 // TODO(oshima): Bounds of keyboard container should be handled by | 650 // TODO(oshima): Bounds of keyboard container should be handled by |
| 652 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 651 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
| 653 keyboard_container->SetBounds(parent->bounds()); | 652 keyboard_container->SetBounds(parent->bounds()); |
| 654 } | 653 } |
| 655 | 654 |
| 656 void RootWindowController::DeactivateKeyboard( | 655 void RootWindowController::DeactivateKeyboard( |
| 657 keyboard::KeyboardController* keyboard_controller) { | 656 keyboard::KeyboardController* keyboard_controller) { |
| 658 if (!keyboard_controller || | 657 if (!keyboard_controller || |
| 659 !keyboard_controller->keyboard_container_initialized()) { | 658 !keyboard_controller->keyboard_container_initialized()) { |
| 660 return; | 659 return; |
| 661 } | 660 } |
| 662 aura::Window* keyboard_container = | 661 aura::Window* keyboard_container = |
| 663 keyboard_controller->GetContainerWindow(); | 662 keyboard_controller->GetContainerWindow(); |
| 664 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 663 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
| 665 aura::Window* parent = GetContainer( | 664 aura::Window* parent = |
| 666 kShellWindowId_VirtualKeyboardParentContainer); | 665 GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 667 DCHECK(parent); | 666 DCHECK(parent); |
| 668 parent->RemoveChild(keyboard_container); | 667 parent->RemoveChild(keyboard_container); |
| 669 // Virtual keyboard may be deactivated while still showing, notify all | 668 // Virtual keyboard may be deactivated while still showing, notify all |
| 670 // observers that keyboard bounds changed to 0 before remove them. | 669 // observers that keyboard bounds changed to 0 before remove them. |
| 671 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 670 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
| 672 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 671 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
| 673 keyboard_controller->RemoveObserver(panel_layout_manager_); | 672 keyboard_controller->RemoveObserver(panel_layout_manager_); |
| 674 keyboard_controller->RemoveObserver(docked_layout_manager_); | 673 keyboard_controller->RemoveObserver(docked_layout_manager_); |
| 675 keyboard_controller->RemoveObserver( | 674 keyboard_controller->RemoveObserver( |
| 676 workspace_controller_->layout_manager()); | 675 workspace_controller_->layout_manager()); |
| 677 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); | 676 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(false); |
| 678 } | 677 } |
| 679 } | 678 } |
| 680 | 679 |
| 681 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 680 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
| 682 aura::Window* parent = GetContainer( | 681 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 683 kShellWindowId_VirtualKeyboardParentContainer); | |
| 684 return parent ? parent->Contains(window) : false; | 682 return parent ? parent->Contains(window) : false; |
| 685 } | 683 } |
| 686 | 684 |
| 687 //////////////////////////////////////////////////////////////////////////////// | 685 //////////////////////////////////////////////////////////////////////////////// |
| 688 // RootWindowController, private: | 686 // RootWindowController, private: |
| 689 | 687 |
| 690 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) | 688 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) |
| 691 : ash_host_(ash_host), | 689 : ash_host_(ash_host), |
| 692 root_window_layout_(NULL), | 690 root_window_layout_(NULL), |
| 693 docked_layout_manager_(NULL), | 691 docked_layout_manager_(NULL), |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 aura::Window* settings_bubble_container = CreateContainer( | 993 aura::Window* settings_bubble_container = CreateContainer( |
| 996 kShellWindowId_SettingBubbleContainer, | 994 kShellWindowId_SettingBubbleContainer, |
| 997 "SettingBubbleContainer", | 995 "SettingBubbleContainer", |
| 998 lock_screen_related_containers); | 996 lock_screen_related_containers); |
| 999 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | 997 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 1000 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container); | 998 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container); |
| 1001 SetUsesScreenCoordinates(settings_bubble_container); | 999 SetUsesScreenCoordinates(settings_bubble_container); |
| 1002 DescendantShouldStayInSameRootWindow(settings_bubble_container); | 1000 DescendantShouldStayInSameRootWindow(settings_bubble_container); |
| 1003 | 1001 |
| 1004 aura::Window* virtual_keyboard_parent_container = | 1002 aura::Window* virtual_keyboard_parent_container = |
| 1005 CreateContainer(kShellWindowId_VirtualKeyboardParentContainer, | 1003 CreateContainer(kShellWindowId_ImeWindowParentContainer, |
| 1006 "VirtualKeyboardParentContainer", | 1004 "VirtualKeyboardParentContainer", |
| 1007 lock_screen_related_containers); | 1005 lock_screen_related_containers); |
| 1008 wm::SetSnapsChildrenToPhysicalPixelBoundary( | 1006 wm::SetSnapsChildrenToPhysicalPixelBoundary( |
| 1009 virtual_keyboard_parent_container); | 1007 virtual_keyboard_parent_container); |
| 1010 SetUsesScreenCoordinates(virtual_keyboard_parent_container); | 1008 SetUsesScreenCoordinates(virtual_keyboard_parent_container); |
| 1011 | 1009 |
| 1012 aura::Window* menu_container = CreateContainer( | 1010 aura::Window* menu_container = CreateContainer( |
| 1013 kShellWindowId_MenuContainer, | 1011 kShellWindowId_MenuContainer, |
| 1014 "MenuContainer", | 1012 "MenuContainer", |
| 1015 lock_screen_related_containers); | 1013 lock_screen_related_containers); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 else | 1064 else |
| 1067 DisableTouchHudProjection(); | 1065 DisableTouchHudProjection(); |
| 1068 } | 1066 } |
| 1069 | 1067 |
| 1070 RootWindowController* GetRootWindowController( | 1068 RootWindowController* GetRootWindowController( |
| 1071 const aura::Window* root_window) { | 1069 const aura::Window* root_window) { |
| 1072 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1070 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 1073 } | 1071 } |
| 1074 | 1072 |
| 1075 } // namespace ash | 1073 } // namespace ash |
| OLD | NEW |