summaryrefslogtreecommitdiffstats
path: root/ui/views/accessible_pane_view.cc
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 10:23:18 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 10:23:18 +0000
commit5ec61d49aa4a91049c58615279b1b491d8d7a722 (patch)
tree4890ccdbe0f05643e2735733f6cd552f6a09e26c /ui/views/accessible_pane_view.cc
parentbf30b0f36986b2a50539cf9795bf4d5aa1a72f87 (diff)
downloadchromium_src-5ec61d49aa4a91049c58615279b1b491d8d7a722.zip
chromium_src-5ec61d49aa4a91049c58615279b1b491d8d7a722.tar.gz
chromium_src-5ec61d49aa4a91049c58615279b1b491d8d7a722.tar.bz2
Fix launcher and system tray accessibility.
Fix AccessiblePaneView's logic when "Escape" is pressed: now it restores focus to the last focused view but only if it's within the same window and not within this pane - in practice, that only happens within the browser window. Otherwise, it deactivates the current window - so pressing Escape while focused on the launcher or status area will restore activation to the browser window. Also adds an accessible notification when the system tray opens. BUG=225920 Review URL: https://chromiumcodereview.appspot.com/13471014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/accessible_pane_view.cc')
-rw-r--r--ui/views/accessible_pane_view.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/ui/views/accessible_pane_view.cc b/ui/views/accessible_pane_view.cc
index 5ec5f43..21e9076 100644
--- a/ui/views/accessible_pane_view.cc
+++ b/ui/views/accessible_pane_view.cc
@@ -51,6 +51,7 @@ AccessiblePaneView::AccessiblePaneView()
left_key_(ui::VKEY_LEFT, ui::EF_NONE),
right_key_(ui::VKEY_RIGHT, ui::EF_NONE) {
focus_search_.reset(new AccessiblePaneViewFocusSearch(this));
+ last_focused_view_storage_id_ = ViewStorage::GetInstance()->CreateStorageID();
}
AccessiblePaneView::~AccessiblePaneView() {
@@ -66,7 +67,12 @@ bool AccessiblePaneView::SetPaneFocus(views::View* initial_focus) {
if (!focus_manager_)
focus_manager_ = GetFocusManager();
- focus_manager_->StoreFocusedView(true);
+ View* focused_view = focus_manager_->GetFocusedView();
+ if (focused_view && !ContainsForFocusSearch(this, focused_view)) {
+ ViewStorage* view_storage = ViewStorage::GetInstance();
+ view_storage->RemoveView(last_focused_view_storage_id_);
+ view_storage->StoreView(last_focused_view_storage_id_, focused_view);
+ }
// Use the provided initial focus if it's visible and enabled, otherwise
// use the first focusable child.
@@ -162,12 +168,18 @@ bool AccessiblePaneView::AcceleratorPressed(
return false;
switch (accelerator.key_code()) {
- case ui::VKEY_ESCAPE:
+ case ui::VKEY_ESCAPE: {
RemovePaneFocus();
- if (!focus_manager_->RestoreFocusedView() &&
- allow_deactivate_on_esc_)
+ View* last_focused_view = ViewStorage::GetInstance()->RetrieveView(
+ last_focused_view_storage_id_);
+ if (last_focused_view) {
+ focus_manager_->SetFocusedViewWithReason(
+ last_focused_view, FocusManager::kReasonFocusRestore);
+ } else if (allow_deactivate_on_esc_) {
focused_view->GetWidget()->Deactivate();
+ }
return true;
+ }
case ui::VKEY_LEFT:
focus_manager_->AdvanceFocus(true);
return true;