diff options
author | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 23:53:41 +0000 |
---|---|---|
committer | kevers@chromium.org <kevers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-29 23:53:41 +0000 |
commit | e1b299bafe3bd77bc556fab2f238db6c7a4bb7bb (patch) | |
tree | 15f265151d1bef6148876c906ef885d443c5823d /ash | |
parent | b94661f4a8c8dcc048ccd29e34eae6b554880d99 (diff) | |
download | chromium_src-e1b299bafe3bd77bc556fab2f238db6c7a4bb7bb.zip chromium_src-e1b299bafe3bd77bc556fab2f238db6c7a4bb7bb.tar.gz chromium_src-e1b299bafe3bd77bc556fab2f238db6c7a4bb7bb.tar.bz2 |
Reland a11y keyboard.
BUG=297132
Patch set 1 is the original CL:
https://codereview.chromium.org/137543002/
which broke tests on the memory bots. Path set 2 contains the fix for the test failure.
Review URL: https://codereview.chromium.org/148213010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accessibility_delegate.h | 3 | ||||
-rw-r--r-- | ash/default_accessibility_delegate.cc | 4 | ||||
-rw-r--r-- | ash/default_accessibility_delegate.h | 1 | ||||
-rw-r--r-- | ash/root_window_controller.cc | 9 | ||||
-rw-r--r-- | ash/shell.cc | 14 | ||||
-rw-r--r-- | ash/shell.h | 7 | ||||
-rw-r--r-- | ash/system/tray_accessibility.cc | 3 | ||||
-rw-r--r-- | ash/test/ash_test_helper.cc | 2 |
8 files changed, 34 insertions, 9 deletions
diff --git a/ash/accessibility_delegate.h b/ash/accessibility_delegate.h index a4ef7eb..8d4b932 100644 --- a/ash/accessibility_delegate.h +++ b/ash/accessibility_delegate.h @@ -63,6 +63,9 @@ class ASH_EXPORT AccessibilityDelegate { // Returns if autoclick is enabled or not. virtual bool IsAutoclickEnabled() const = 0; + // Returns if the a11y virtual keyboard is enabled. + virtual bool IsVirtualKeyboardEnabled() const = 0; + // Returns true when the accessibility menu should be shown. virtual bool ShouldShowAccessibilityMenu() const = 0; diff --git a/ash/default_accessibility_delegate.cc b/ash/default_accessibility_delegate.cc index 99540d7..94a3d30 100644 --- a/ash/default_accessibility_delegate.cc +++ b/ash/default_accessibility_delegate.cc @@ -65,6 +65,10 @@ bool DefaultAccessibilityDelegate::IsAutoclickEnabled() const { return autoclick_enabled_; } +bool DefaultAccessibilityDelegate::IsVirtualKeyboardEnabled() const { + return false; +} + bool DefaultAccessibilityDelegate::ShouldShowAccessibilityMenu() const { return spoken_feedback_enabled_ || high_contrast_enabled_ || diff --git a/ash/default_accessibility_delegate.h b/ash/default_accessibility_delegate.h index 84d0e3e..ad0b684 100644 --- a/ash/default_accessibility_delegate.h +++ b/ash/default_accessibility_delegate.h @@ -29,6 +29,7 @@ class ASH_EXPORT DefaultAccessibilityDelegate : public AccessibilityDelegate { virtual bool IsLargeCursorEnabled() const OVERRIDE; virtual void SetAutoclickEnabled(bool enabled) OVERRIDE; virtual bool IsAutoclickEnabled() const OVERRIDE; + virtual bool IsVirtualKeyboardEnabled() const OVERRIDE; virtual bool ShouldShowAccessibilityMenu() const OVERRIDE; virtual void SilenceSpokenFeedback() const OVERRIDE; virtual void ToggleSpokenFeedback( diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index d295cae..e5030ad 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -614,13 +614,10 @@ void RootWindowController::ActivateKeyboard( void RootWindowController::DeactivateKeyboard( keyboard::KeyboardController* keyboard_controller) { - if (!keyboard::IsKeyboardEnabled()) + if (!keyboard_controller || + !keyboard_controller->keyboard_container_initialized()) { return; - - DCHECK(keyboard_controller); - if (!keyboard_controller->keyboard_container_initialized()) - return; - + } aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); if (keyboard_container->GetRootWindow() == root_window()) { diff --git a/ash/shell.cc b/ash/shell.cc index d5209fb..4c298a4 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -416,6 +416,17 @@ void Shell::CreateKeyboard() { } } +void Shell::DeactivateKeyboard() { + if (keyboard_controller_.get()) { + RootWindowControllerList controllers = GetAllRootWindowControllers(); + for (RootWindowControllerList::iterator iter = controllers.begin(); + iter != controllers.end(); ++iter) { + (*iter)->DeactivateKeyboard(keyboard_controller_.get()); + } + } + keyboard_controller_.reset(); +} + void Shell::ShowShelf() { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); @@ -860,8 +871,9 @@ void Shell::Init() { // The keyboard system must be initialized before the RootWindowController is // created. - if (keyboard::IsKeyboardEnabled()) +#if defined(OS_CHROMEOS) keyboard::InitializeKeyboard(); +#endif lock_state_controller_.reset(new LockStateController); power_button_controller_.reset(new PowerButtonController( diff --git a/ash/shell.h b/ash/shell.h index a9a0d2a..949de18 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -292,10 +292,13 @@ class ASH_EXPORT Shell // Initializes |shelf_|. Does nothing if it's already initialized. void CreateShelf(); - // Creates virtual keyboard. Deletes the old virtual keyboard if it's already - // exist. + // Creates a virtual keyboard. Deletes the old virtual keyboard if it already + // exists. void CreateKeyboard(); + // Deactivates the virtual keyboard. + void DeactivateKeyboard(); + // Show shelf view if it was created hidden (before session has started). void ShowShelf(); diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 8b1902d..3ce65bf 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc @@ -38,6 +38,7 @@ enum AccessibilityState { A11Y_SCREEN_MAGNIFIER = 1 << 2, A11Y_LARGE_CURSOR = 1 << 3, A11Y_AUTOCLICK = 1 << 4, + A11Y_VIRTUAL_KEYBOARD = 1 << 5, }; uint32 GetAccessibilityState() { @@ -54,6 +55,8 @@ uint32 GetAccessibilityState() { state |= A11Y_LARGE_CURSOR; if (delegate->IsAutoclickEnabled()) state |= A11Y_AUTOCLICK; + if (delegate->IsVirtualKeyboardEnabled()) + state |= A11Y_VIRTUAL_KEYBOARD; return state; } diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index e544874..e7d6b22 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -27,6 +27,7 @@ #if defined(OS_CHROMEOS) #include "chromeos/audio/cras_audio_handler.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "ui/keyboard/keyboard.h" #endif #if defined(USE_X11) @@ -113,6 +114,7 @@ void AshTestHelper::TearDown() { chromeos::DBusThreadManager::Shutdown(); dbus_thread_manager_initialized_ = false; } + keyboard::ResetKeyboardForTesting(); #endif aura::Env::DeleteInstance(); |