diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 08:31:25 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-12 08:31:25 +0000 |
commit | 5b84f7c665b32f30ddb8a57b12efcf0ff3a01e9b (patch) | |
tree | 80fbce2710e66d090046a2eeeb30a41d673d9121 /ash | |
parent | 6c8ea31a26f08e3cb6fa0a532feb3254ff8afa62 (diff) | |
download | chromium_src-5b84f7c665b32f30ddb8a57b12efcf0ff3a01e9b.zip chromium_src-5b84f7c665b32f30ddb8a57b12efcf0ff3a01e9b.tar.gz chromium_src-5b84f7c665b32f30ddb8a57b12efcf0ff3a01e9b.tar.bz2 |
ash: Make the tray accessible.
With this change, you can press the hotkey (ctrl-f2) to reach the status-tray with the keyboard, and press space or enter to trigger the popup.
BUG=110130
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9668032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126106 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/system/tray/system_tray.cc | 13 | ||||
-rw-r--r-- | ash/system/tray/system_tray.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 3c9bb71..6e80baa 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -291,6 +291,7 @@ SystemTray::SystemTray() set_border(views::Border::CreateEmptyBorder(0, 0, kPaddingFromBottomOfScreen, kPaddingFromRightEdgeOfScreen)); set_notify_enter_exit_on_child(true); + set_focusable(true); SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); AddChildView(container_); } @@ -382,6 +383,18 @@ void SystemTray::ShowItems(std::vector<SystemTrayItem*>& items, bubble_->Show(); } +bool SystemTray::OnKeyPressed(const views::KeyEvent& event) { + if (event.key_code() == ui::VKEY_SPACE || + event.key_code() == ui::VKEY_RETURN) { + if (popup_) + popup_->Hide(); + else + ShowItems(items_, false, true); + return true; + } + return false; +} + bool SystemTray::OnMousePressed(const views::MouseEvent& event) { if (popup_) popup_->Hide(); diff --git a/ash/system/tray/system_tray.h b/ash/system/tray/system_tray.h index fd811f5..b6e31e5 100644 --- a/ash/system/tray/system_tray.h +++ b/ash/system/tray/system_tray.h @@ -51,6 +51,7 @@ class ASH_EXPORT SystemTray : public views::View, bool activate); // Overridden from views::View. + virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |