diff options
Diffstat (limited to 'ash/system')
-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; |