diff options
author | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 11:29:12 +0000 |
---|---|---|
committer | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-16 11:29:12 +0000 |
commit | 7f2af21994d2736db5941b4516a695467da1f08c (patch) | |
tree | 446ea9bf0ec28db9a1a809f40776a63dbb762b3b /ash | |
parent | 924449497521c6d2988b632d290964bf9c244fc9 (diff) | |
download | chromium_src-7f2af21994d2736db5941b4516a695467da1f08c.zip chromium_src-7f2af21994d2736db5941b4516a695467da1f08c.tar.gz chromium_src-7f2af21994d2736db5941b4516a695467da1f08c.tar.bz2 |
Do not toggle Applist with Search key press when accessibility is enabled.
BUG=132296
TEST=manual + aura_shell_unittests
Review URL: https://chromiumcodereview.appspot.com/10543158
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 7 | ||||
-rw-r--r-- | ash/accelerators/accelerator_controller_unittest.cc | 11 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.cc | 8 | ||||
-rw-r--r-- | ash/shell/shell_delegate_impl.h | 2 | ||||
-rw-r--r-- | ash/shell_delegate.h | 3 | ||||
-rw-r--r-- | ash/system/status_area_widget.cc | 6 | ||||
-rw-r--r-- | ash/system/tray/system_tray_delegate.h | 6 | ||||
-rw-r--r-- | ash/system/tray_accessibility.cc | 10 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.cc | 9 | ||||
-rw-r--r-- | ash/test/test_shell_delegate.h | 2 |
10 files changed, 46 insertions, 18 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 63f9fab..ffae155 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -32,6 +32,7 @@ #include "ui/aura/root_window.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/accelerator_manager.h" +#include "ui/base/keycodes/keyboard_codes.h" #include "ui/compositor/debug_utils.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_sequence.h" @@ -357,6 +358,12 @@ bool AcceleratorController::PerformAction(int action, // this key combination is reserved for partial screenshot. return true; case TOGGLE_APP_LIST: + // When spoken feedback is enabled, we should neither toggle the list nor + // consume the key since Search+Shift is one of the shortcuts the a11y + // feature uses. crbug.com/132296 + DCHECK_EQ(ui::VKEY_LWIN, accelerator.key_code()); + if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) + return false; ash::Shell::GetInstance()->ToggleAppList(); return true; case TOGGLE_CAPS_LOCK: diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index e3d505e..56ffde5 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -11,6 +11,7 @@ #include "ash/shell_window_ids.h" #include "ash/system/brightness/brightness_control_delegate.h" #include "ash/test/ash_test_base.h" +#include "ash/test/test_shell_delegate.h" #include "ash/volume_control_delegate.h" #include "ash/wm/window_util.h" #include "ui/aura/event.h" @@ -534,6 +535,16 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); } + // ToggleAppList (with spoken feedback enabled) + { + ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); + delegate->ToggleSpokenFeedback(); + EXPECT_FALSE(GetController()->Process( + ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); + delegate->ToggleSpokenFeedback(); + EXPECT_TRUE(GetController()->Process( + ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); + } // ToggleCapsLock { EXPECT_FALSE(GetController()->Process( diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 661aa51..bc3f30d 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -18,7 +18,8 @@ namespace shell { ShellDelegateImpl::ShellDelegateImpl() : watcher_(NULL), launcher_delegate_(NULL), - locked_(false) { + locked_(false), + spoken_feedback_enabled_(false) { } ShellDelegateImpl::~ShellDelegateImpl() { @@ -93,6 +94,11 @@ content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() { } void ShellDelegateImpl::ToggleSpokenFeedback() { + spoken_feedback_enabled_ = !spoken_feedback_enabled_; +} + +bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const { + return spoken_feedback_enabled_; } app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index cb7d821..ba9ed88 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -39,6 +39,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { virtual void ShowTaskManager() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual void ToggleSpokenFeedback() OVERRIDE; + virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual void StartPartialScreenshot( ash::ScreenshotDelegate* screenshot_delegate) OVERRIDE; @@ -56,6 +57,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { LauncherDelegateImpl* launcher_delegate_; bool locked_; + bool spoken_feedback_enabled_; DISALLOW_COPY_AND_ASSIGN(ShellDelegateImpl); }; diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index db7d634..e4f4ee8 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -97,6 +97,9 @@ class ASH_EXPORT ShellDelegate { // for accessibility. virtual void ToggleSpokenFeedback() = 0; + // Returns true if spoken feedback is enabled. + virtual bool IsSpokenFeedbackEnabled() const = 0; + // Invoked to create an AppListViewDelegate. Shell takes the ownership of // the created delegate. virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0; diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index b3eb72f..6d78f47 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc @@ -115,12 +115,6 @@ class DummySystemTrayDelegate : public SystemTrayDelegate { caps_lock_enabled_ = enabled; } - virtual bool IsInAccessibilityMode() const OVERRIDE { - return false; - } - - virtual void SetEnableSpokenFeedback(bool enable) OVERRIDE {} - virtual void ShutDown() OVERRIDE {} virtual void SignOut() OVERRIDE { diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index 4c73d32..9efebbf 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -161,12 +161,6 @@ class SystemTrayDelegate { // Sets the caps lock status to |enabled|. virtual void SetCapsLockEnabled(bool enabled) = 0; - // Gets whether accessibility mode is turned on. - virtual bool IsInAccessibilityMode() const = 0; - - // Enables or disables spoken feedback. - virtual void SetEnableSpokenFeedback(bool enable) = 0; - // Attempts to shut down the system. virtual void ShutDown() = 0; diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 104174c..bb9c8f2 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc @@ -5,7 +5,7 @@ #include "ash/system/tray_accessibility.h" #include "ash/shell.h" -#include "ash/system/tray/system_tray_delegate.h" +#include "ash/shell_delegate.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_views.h" #include "grit/ash_strings.h" @@ -46,7 +46,8 @@ class DefaultAccessibilityView : public ActionableView { protected: // Overridden from ActionableView. virtual bool PerformAction(const views::Event& event) OVERRIDE { - ash::Shell::GetInstance()->tray_delegate()->SetEnableSpokenFeedback(false); + if (Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) + Shell::GetInstance()->delegate()->ToggleSpokenFeedback(); GetWidget()->Close(); return true; } @@ -66,11 +67,12 @@ TrayAccessibility::TrayAccessibility() TrayAccessibility::~TrayAccessibility() {} bool TrayAccessibility::GetInitialVisibility() { - return ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode(); + return Shell::GetInstance()->delegate() && + Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled(); } views::View* TrayAccessibility::CreateDefaultView(user::LoginStatus status) { - if (!ash::Shell::GetInstance()->tray_delegate()->IsInAccessibilityMode()) + if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) return NULL; DCHECK(string_id_); diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 57601c1..fc6ff4d 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -17,7 +17,9 @@ namespace ash { namespace test { -TestShellDelegate::TestShellDelegate() : locked_(false) { +TestShellDelegate::TestShellDelegate() + : locked_(false), + spoken_feedback_enabled_(false) { } TestShellDelegate::~TestShellDelegate() { @@ -78,6 +80,11 @@ content::BrowserContext* TestShellDelegate::GetCurrentBrowserContext() { } void TestShellDelegate::ToggleSpokenFeedback() { + spoken_feedback_enabled_ = !spoken_feedback_enabled_; +} + +bool TestShellDelegate::IsSpokenFeedbackEnabled() const { + return spoken_feedback_enabled_; } app_list::AppListViewDelegate* TestShellDelegate::CreateAppListViewDelegate() { diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index a69642d..339b06d 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -35,6 +35,7 @@ class TestShellDelegate : public ShellDelegate { virtual void ShowTaskManager() OVERRIDE; virtual content::BrowserContext* GetCurrentBrowserContext() OVERRIDE; virtual void ToggleSpokenFeedback() OVERRIDE; + virtual bool IsSpokenFeedbackEnabled() const OVERRIDE; virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; virtual void StartPartialScreenshot( ScreenshotDelegate* screenshot_delegate) OVERRIDE; @@ -46,6 +47,7 @@ class TestShellDelegate : public ShellDelegate { private: bool locked_; + bool spoken_feedback_enabled_; DISALLOW_COPY_AND_ASSIGN(TestShellDelegate); }; |