diff options
author | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-05 18:39:52 +0000 |
---|---|---|
committer | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-05 18:39:52 +0000 |
commit | b2da9b606286f651cf45d9312fa5ed8e2ca9c401 (patch) | |
tree | 4c7b561c712ee3247e94402b42476d9d3825cfb2 | |
parent | e82abea5720382429c29c2691d4d17e0719185da (diff) | |
download | chromium_src-b2da9b606286f651cf45d9312fa5ed8e2ca9c401.zip chromium_src-b2da9b606286f651cf45d9312fa5ed8e2ca9c401.tar.gz chromium_src-b2da9b606286f651cf45d9312fa5ed8e2ca9c401.tar.bz2 |
Make Chrome OS virtual keyboard to work with cursor compositing.
Explicitly define container IDs for the parent container of the virtual keyboard,
as well as the mouse cursor container.
This is to ensure the correct ordering in which containers are stacked together.
Specifically the virtual keyboard parent container should be above all non-lock screen,
lock screen and lock screen related containers, but below the mouse cursor container,
which sits immediately below the power animation container.
BUG=347304
TEST=trybots and manual verification.
R=kevers@chromium.org, oshima@chromium.org
Review URL: https://codereview.chromium.org/186673008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255096 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/display/cursor_window_controller.cc | 2 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 25 | ||||
-rw-r--r-- | ash/shell_unittest.cc | 6 | ||||
-rw-r--r-- | ash/shell_window_ids.h | 10 | ||||
-rw-r--r-- | chrome/browser/chromeos/accessibility/accessibility_manager.cc | 9 |
5 files changed, 38 insertions, 14 deletions
diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc index 05f242d..6fb1a08 100644 --- a/ash/display/cursor_window_controller.cc +++ b/ash/display/cursor_window_controller.cc @@ -137,7 +137,7 @@ void CursorWindowController::SetDisplay(const gfx::Display& display) { return; SetContainer(GetRootWindowController(root_window)->GetContainer( - kShellWindowId_OverlayContainer)); + kShellWindowId_MouseCursorContainer)); SetBoundsInScreen(display.bounds()); } diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 06687e4..55196b4 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -617,7 +617,9 @@ void RootWindowController::ActivateKeyboard( keyboard_controller->AddObserver(panel_layout_manager_); keyboard_controller->AddObserver(docked_layout_manager_); } - aura::Window* parent = root_window(); + aura::Window* parent = GetContainer( + kShellWindowId_VirtualKeyboardParentContainer); + DCHECK(parent); aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); @@ -636,7 +638,10 @@ void RootWindowController::DeactivateKeyboard( aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); if (keyboard_container->GetRootWindow() == root_window()) { - root_window()->RemoveChild(keyboard_container); + aura::Window* parent = GetContainer( + kShellWindowId_VirtualKeyboardParentContainer); + DCHECK(parent); + parent->RemoveChild(keyboard_container); if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { // Virtual keyboard may be deactivated while still showing, notify all // observers that keyboard bounds changed to 0 before remove them. @@ -966,8 +971,22 @@ void RootWindowController::CreateContainersInRootWindow( lock_screen_related_containers); SetUsesScreenCoordinates(overlay_container); + aura::Window* virtual_keyboard_parent_container = CreateContainer( + kShellWindowId_VirtualKeyboardParentContainer, + "VirtualKeyboardParentContainer", + root_window); + SetUsesScreenCoordinates(virtual_keyboard_parent_container); + +#if defined(OS_CHROMEOS) + aura::Window* mouse_cursor_container = CreateContainer( + kShellWindowId_MouseCursorContainer, + "MouseCursorContainer", + root_window); + SetUsesScreenCoordinates(mouse_cursor_container); +#endif + CreateContainer(kShellWindowId_PowerButtonAnimationContainer, - "PowerButtonAnimationContainer", root_window) ; + "PowerButtonAnimationContainer", root_window); } void RootWindowController::EnableTouchHudProjection() { diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 7dd9246..160d6b4 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -87,6 +87,12 @@ void ExpectAllContainers() { root_window, internal::kShellWindowId_SettingBubbleContainer)); EXPECT_TRUE(Shell::GetContainer( root_window, internal::kShellWindowId_OverlayContainer)); + EXPECT_TRUE(Shell::GetContainer( + root_window, internal::kShellWindowId_VirtualKeyboardParentContainer)); +#if defined(OS_CHROMEOS) + EXPECT_TRUE(Shell::GetContainer( + root_window, internal::kShellWindowId_MouseCursorContainer)); +#endif } class ModalWindow : public views::WidgetDelegateView { diff --git a/ash/shell_window_ids.h b/ash/shell_window_ids.h index ab5fd23..aedc8b5 100644 --- a/ash/shell_window_ids.h +++ b/ash/shell_window_ids.h @@ -99,8 +99,16 @@ const int kShellWindowId_OverlayContainer = 22; // ID of the window created by PhantomWindowController or DragWindowController. const int kShellWindowId_PhantomWindow = 23; +// A parent container that holds the virtual keyboard container. This is to +// ensure that the virtual keyboard is stacked above most containers but below +// the mouse cursor and the power off animation. +const int kShellWindowId_VirtualKeyboardParentContainer = 24; + +// The container for mouse cursor. +const int kShellWindowId_MouseCursorContainer = 25; + // The topmost container, used for power off animation. -const int kShellWindowId_PowerButtonAnimationContainer = 24; +const int kShellWindowId_PowerButtonAnimationContainer = 26; } // namespace internal diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc index f73afbe..aa7a0437 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc @@ -372,10 +372,6 @@ bool AccessibilityManager::ShouldEnableCursorCompositing() { if (!profile_) return false; PrefService* pref_service = profile_->GetPrefs(); - // TODO(hshi): support cursor compositing when virtual keyboard is enabled. - // See http://www.crbug.com/347009 - if (pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled)) - return false; // Enable cursor compositing when one or more of the listed accessibility // features are turned on. if (pref_service->GetBoolean(prefs::kLargeCursorEnabled) || @@ -741,11 +737,6 @@ void AccessibilityManager::UpdateVirtualKeyboardFromPref() { else if (!keyboard::IsKeyboardEnabled()) ash::Shell::GetInstance()->DeactivateKeyboard(); #endif - -#if defined(OS_CHROMEOS) - ash::Shell::GetInstance()->SetCursorCompositingEnabled( - ShouldEnableCursorCompositing()); -#endif } void AccessibilityManager::CheckBrailleState() { |