Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Side by Side Diff: ash/root_window_controller.cc

Issue 503383002: Allow component IME extension use app.window and add 'ime' window type for app window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and make app.window.canSetVisibleOnAllWorkspaces complex feature Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/shell_unittest.cc » ('j') | extensions/common/api/_api_features.json » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); 646 keyboard_controller->AddObserver(shelf()->shelf_layout_manager());
647 keyboard_controller->AddObserver(panel_layout_manager_); 647 keyboard_controller->AddObserver(panel_layout_manager_);
648 keyboard_controller->AddObserver(docked_layout_manager_); 648 keyboard_controller->AddObserver(docked_layout_manager_);
649 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); 649 keyboard_controller->AddObserver(workspace_controller_->layout_manager());
650 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true); 650 Shell::GetInstance()->delegate()->VirtualKeyboardActivated(true);
651 aura::Window* parent = GetContainer( 651 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer);
652 kShellWindowId_VirtualKeyboardParentContainer);
653 DCHECK(parent); 652 DCHECK(parent);
654 aura::Window* keyboard_container = 653 aura::Window* keyboard_container =
655 keyboard_controller->GetContainerWindow(); 654 keyboard_controller->GetContainerWindow();
656 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); 655 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer);
657 parent->AddChild(keyboard_container); 656 parent->AddChild(keyboard_container);
658 // TODO(oshima): Bounds of keyboard container should be handled by 657 // TODO(oshima): Bounds of keyboard container should be handled by
659 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. 658 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager.
660 keyboard_container->SetBounds(parent->bounds()); 659 keyboard_container->SetBounds(parent->bounds());
661 } 660 }
662 661
663 void RootWindowController::DeactivateKeyboard( 662 void RootWindowController::DeactivateKeyboard(
664 keyboard::KeyboardController* keyboard_controller) { 663 keyboard::KeyboardController* keyboard_controller) {
665 if (!keyboard_controller || 664 if (!keyboard_controller ||
666 !keyboard_controller->keyboard_container_initialized()) { 665 !keyboard_controller->keyboard_container_initialized()) {
667 return; 666 return;
668 } 667 }
669 aura::Window* keyboard_container = 668 aura::Window* keyboard_container =
670 keyboard_controller->GetContainerWindow(); 669 keyboard_controller->GetContainerWindow();
671 if (keyboard_container->GetRootWindow() == GetRootWindow()) { 670 if (keyboard_container->GetRootWindow() == GetRootWindow()) {
672 aura::Window* parent = GetContainer( 671 aura::Window* parent =
673 kShellWindowId_VirtualKeyboardParentContainer); 672 GetContainer(kShellWindowId_ImeWindowParentContainer);
674 DCHECK(parent); 673 DCHECK(parent);
675 parent->RemoveChild(keyboard_container); 674 parent->RemoveChild(keyboard_container);
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 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { 687 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) {
689 aura::Window* parent = GetContainer( 688 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer);
690 kShellWindowId_VirtualKeyboardParentContainer);
691 return parent ? parent->Contains(window) : false; 689 return parent ? parent->Contains(window) : false;
692 } 690 }
693 691
694 //////////////////////////////////////////////////////////////////////////////// 692 ////////////////////////////////////////////////////////////////////////////////
695 // RootWindowController, private: 693 // RootWindowController, private:
696 694
697 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host) 695 RootWindowController::RootWindowController(AshWindowTreeHost* ash_host)
698 : ash_host_(ash_host), 696 : ash_host_(ash_host),
699 root_window_layout_(NULL), 697 root_window_layout_(NULL),
700 docked_layout_manager_(NULL), 698 docked_layout_manager_(NULL),
(...skipping 12 matching lines...) Expand all
713 void RootWindowController::Init(RootWindowType root_window_type, 711 void RootWindowController::Init(RootWindowType root_window_type,
714 bool first_run_after_boot) { 712 bool first_run_after_boot) {
715 aura::Window* root_window = GetRootWindow(); 713 aura::Window* root_window = GetRootWindow();
716 Shell* shell = Shell::GetInstance(); 714 Shell* shell = Shell::GetInstance();
717 shell->InitRootWindow(root_window); 715 shell->InitRootWindow(root_window);
718 716
719 ash_host_->AsWindowTreeHost()->SetCursor(ui::kCursorPointer); 717 ash_host_->AsWindowTreeHost()->SetCursor(ui::kCursorPointer);
720 CreateContainersInRootWindow(root_window); 718 CreateContainersInRootWindow(root_window);
721 719
722 if (root_window_type == VIRTUAL_KEYBOARD) { 720 if (root_window_type == VIRTUAL_KEYBOARD) {
723 aura::Window* virtual_keyboard_parent_container = GetContainer( 721 aura::Window* virtual_keyboard_parent_container =
724 kShellWindowId_VirtualKeyboardParentContainer); 722 GetContainer(kShellWindowId_ImeWindowParentContainer);
725 virtual_keyboard_parent_container->SetBounds(root_window->bounds()); 723 virtual_keyboard_parent_container->SetBounds(root_window->bounds());
726 shell->InitKeyboard(); 724 shell->InitKeyboard();
727 return; 725 return;
728 } 726 }
729 727
730 CreateSystemBackground(first_run_after_boot); 728 CreateSystemBackground(first_run_after_boot);
731 729
732 InitLayoutManagers(); 730 InitLayoutManagers();
733 InitTouchHuds(); 731 InitTouchHuds();
734 732
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 aura::Window* settings_bubble_container = CreateContainer( 1008 aura::Window* settings_bubble_container = CreateContainer(
1011 kShellWindowId_SettingBubbleContainer, 1009 kShellWindowId_SettingBubbleContainer,
1012 "SettingBubbleContainer", 1010 "SettingBubbleContainer",
1013 lock_screen_related_containers); 1011 lock_screen_related_containers);
1014 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); 1012 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container);
1015 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container); 1013 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container);
1016 SetUsesScreenCoordinates(settings_bubble_container); 1014 SetUsesScreenCoordinates(settings_bubble_container);
1017 DescendantShouldStayInSameRootWindow(settings_bubble_container); 1015 DescendantShouldStayInSameRootWindow(settings_bubble_container);
1018 1016
1019 aura::Window* virtual_keyboard_parent_container = 1017 aura::Window* virtual_keyboard_parent_container =
1020 CreateContainer(kShellWindowId_VirtualKeyboardParentContainer, 1018 CreateContainer(kShellWindowId_ImeWindowParentContainer,
1021 "VirtualKeyboardParentContainer", 1019 "VirtualKeyboardParentContainer",
1022 lock_screen_related_containers); 1020 lock_screen_related_containers);
1023 wm::SetSnapsChildrenToPhysicalPixelBoundary( 1021 wm::SetSnapsChildrenToPhysicalPixelBoundary(
1024 virtual_keyboard_parent_container); 1022 virtual_keyboard_parent_container);
1025 SetUsesScreenCoordinates(virtual_keyboard_parent_container); 1023 SetUsesScreenCoordinates(virtual_keyboard_parent_container);
1026 1024
1027 aura::Window* menu_container = CreateContainer( 1025 aura::Window* menu_container = CreateContainer(
1028 kShellWindowId_MenuContainer, 1026 kShellWindowId_MenuContainer,
1029 "MenuContainer", 1027 "MenuContainer",
1030 lock_screen_related_containers); 1028 lock_screen_related_containers);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 else 1079 else
1082 DisableTouchHudProjection(); 1080 DisableTouchHudProjection();
1083 } 1081 }
1084 1082
1085 RootWindowController* GetRootWindowController( 1083 RootWindowController* GetRootWindowController(
1086 const aura::Window* root_window) { 1084 const aura::Window* root_window) {
1087 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 1085 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
1088 } 1086 }
1089 1087
1090 } // namespace ash 1088 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/shell_unittest.cc » ('j') | extensions/common/api/_api_features.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698