Commit bca64776 authored by noms's avatar noms Committed by Commit bot

[Win] Allow using the arrow keys for tabbing in the avatar bubble.

BUG=414794

Review URL: https://codereview.chromium.org/591263002

Cr-Commit-Position: refs/heads/master@{#296189}
parent 7732fd3f
...@@ -597,6 +597,10 @@ void ProfileChooserView::Init() { ...@@ -597,6 +597,10 @@ void ProfileChooserView::Init() {
view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT; view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
} }
// The arrow keys can be used to tab between items.
AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE));
AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE));
ShowView(view_mode_, avatar_menu_.get()); ShowView(view_mode_, avatar_menu_.get());
} }
...@@ -697,6 +701,16 @@ void ProfileChooserView::WindowClosing() { ...@@ -697,6 +701,16 @@ void ProfileChooserView::WindowClosing() {
} }
} }
bool ProfileChooserView::AcceleratorPressed(
const ui::Accelerator& accelerator) {
if (accelerator.key_code() != ui::VKEY_DOWN &&
accelerator.key_code() != ui::VKEY_UP)
return BubbleDelegateView::AcceleratorPressed(accelerator);
// Move the focus up or down.
GetFocusManager()->AdvanceFocus(accelerator.key_code() != ui::VKEY_DOWN);
return true;
}
void ProfileChooserView::ButtonPressed(views::Button* sender, void ProfileChooserView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
// Disable button after clicking so that it doesn't get clicked twice and // Disable button after clicking so that it doesn't get clicked twice and
......
...@@ -88,6 +88,7 @@ class ProfileChooserView : public views::BubbleDelegateView, ...@@ -88,6 +88,7 @@ class ProfileChooserView : public views::BubbleDelegateView,
// views::BubbleDelegateView: // views::BubbleDelegateView:
virtual void Init() OVERRIDE; virtual void Init() OVERRIDE;
virtual void WindowClosing() OVERRIDE; virtual void WindowClosing() OVERRIDE;
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
// views::ButtonListener: // views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, virtual void ButtonPressed(views::Button* sender,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment