diff options
author | nsatragno@chromium.org <nsatragno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 17:01:09 +0000 |
---|---|---|
committer | nsatragno@chromium.org <nsatragno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 17:01:09 +0000 |
commit | 5bc180214849a1f3a2634d91a116802f048b609d (patch) | |
tree | 5f7e3de01948045cf61734be792243bafcb45100 | |
parent | d25b4bc9a083d035dbf0331f538c97c20eaefd6b (diff) | |
download | chromium_src-5bc180214849a1f3a2634d91a116802f048b609d.zip chromium_src-5bc180214849a1f3a2634d91a116802f048b609d.tar.gz chromium_src-5bc180214849a1f3a2634d91a116802f048b609d.tar.bz2 |
Added a11y alert on entering window overview mode.
The patch alerts a11y support that the overview
mode has been activated. If chromevox is enabled, it
will speak aloud "Alert, entered window overview mode".
BUG=332992
TEST=WindowSelectorTest.A11yAlertOnOverviewMode
Review URL: https://codereview.chromium.org/257763008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267246 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/accessibility_delegate.h | 3 | ||||
-rw-r--r-- | ash/wm/overview/window_overview.cc | 6 | ||||
-rw-r--r-- | ash/wm/overview/window_selector_unittest.cc | 14 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 4 | ||||
-rw-r--r-- | chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc | 8 |
5 files changed, 34 insertions, 1 deletions
diff --git a/ash/accessibility_delegate.h b/ash/accessibility_delegate.h index 7a1b400..05fb051 100644 --- a/ash/accessibility_delegate.h +++ b/ash/accessibility_delegate.h @@ -18,7 +18,8 @@ enum AccessibilityNotificationVisibility { enum AccessibilityAlert { A11Y_ALERT_NONE, - A11Y_ALERT_WINDOW_NEEDED + A11Y_ALERT_WINDOW_NEEDED, + A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED }; // A delegate class to control and query accessibility features. diff --git a/ash/wm/overview/window_overview.cc b/ash/wm/overview/window_overview.cc index ec5efc7..640d21f 100644 --- a/ash/wm/overview/window_overview.cc +++ b/ash/wm/overview/window_overview.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "ash/accessibility_delegate.h" #include "ash/metrics/user_metrics_recorder.h" #include "ash/screen_util.h" #include "ash/shell.h" @@ -150,6 +151,11 @@ WindowOverview::WindowOverview(WindowSelector* window_selector, shell->GetScreen()->AddObserver(this); shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); HideAndTrackNonOverviewWindows(); + // Send an a11y alert only if the overview was activated by the user. + if (window_selector_->mode() == WindowSelector::OVERVIEW) { + shell->accessibility_delegate()->TriggerAccessibilityAlert( + A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); + } } WindowOverview::~WindowOverview() { diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index 028bacd..3389283 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "ash/accessibility_delegate.h" #include "ash/drag_drop/drag_drop_controller.h" #include "ash/root_window_controller.h" #include "ash/screen_util.h" @@ -252,6 +253,19 @@ class WindowSelectorTest : public test::AshTestBase { DISALLOW_COPY_AND_ASSIGN(WindowSelectorTest); }; +// Tests that an a11y alert is sent on entering overview mode. +TEST_F(WindowSelectorTest, A11yAlertOnOverviewMode) { + gfx::Rect bounds(0, 0, 400, 400); + AccessibilityDelegate* delegate = + ash::Shell::GetInstance()->accessibility_delegate(); + scoped_ptr<aura::Window> window1(CreateWindow(bounds)); + EXPECT_NE(delegate->GetLastAccessibilityAlert(), + A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); + ToggleOverview(); + EXPECT_EQ(delegate->GetLastAccessibilityAlert(), + A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); +} + // Tests entering overview mode with two windows and selecting one. TEST_F(WindowSelectorTest, Basic) { gfx::Rect bounds(0, 0, 400, 400); diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index a74c45b..30e5892 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -14624,6 +14624,10 @@ Do you accept? <message name="IDS_A11Y_ALERT_WINDOW_NEEDED" desc="Alert sent to the accessibility api when the user attempts a keyboard command that requires a window to work."> Command unavailable. Press control-N to open a new window. </message> + <message name="IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED" desc="The accessible text read when the user enters window overview mode in Ash."> + Entered window overview mode + </message> + <message name="IDS_DESKTOP_MEDIA_PICKER_SHARE" desc="Used for Share on buttons"> Share </message> diff --git a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc index 5a455ea..3bfe3df 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate_chromeos.cc @@ -183,6 +183,14 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate { ui::AX_EVENT_ALERT, &event); break; } + case ash::A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED: { + AccessibilityAlertInfo event( + profile, l10n_util::GetStringUTF8( + IDS_A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED)); + SendControlAccessibilityNotification( + ui::AX_EVENT_ALERT, &event); + break; + } case ash::A11Y_ALERT_NONE: break; } |