diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/star_toggle.cc | 2 | ||||
-rw-r--r-- | chrome/views/link.cc | 15 | ||||
-rw-r--r-- | chrome/views/link.h | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/chrome/browser/views/star_toggle.cc b/chrome/browser/views/star_toggle.cc index 4f986a3..2a16a20 100644 --- a/chrome/browser/views/star_toggle.cc +++ b/chrome/browser/views/star_toggle.cc @@ -63,7 +63,7 @@ void StarToggle::OnMouseReleased(const views::MouseEvent& e, } bool StarToggle::OnKeyPressed(const views::KeyEvent& e) { - if ((e.GetCharacter() == L' ') || (e.GetCharacter() == L'\n')) { + if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { SwitchState(); return true; } diff --git a/chrome/views/link.cc b/chrome/views/link.cc index c824e62..357c3dd 100644 --- a/chrome/views/link.cc +++ b/chrome/views/link.cc @@ -104,15 +104,7 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) { } bool Link::OnKeyPressed(const KeyEvent& e) { - if ((e.GetCharacter() == L' ') || (e.GetCharacter() == L'\n')) { - SetHighlighted(true); - return true; - } - return false; -} - -bool Link::OnKeyReleased(const KeyEvent& e) { - if ((e.GetCharacter() == L' ') || (e.GetCharacter() == L'\n')) { + if ((e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN)) { SetHighlighted(false); // Focus the link on key pressed. @@ -126,6 +118,11 @@ bool Link::OnKeyReleased(const KeyEvent& e) { return false; } +bool Link::OverrideAccelerator(const Accelerator& accelerator) { + return (accelerator.GetKeyCode() == VK_SPACE) || + (accelerator.GetKeyCode() == VK_RETURN); +} + void Link::SetHighlighted(bool f) { if (f != highlighted_) { highlighted_ = f; diff --git a/chrome/views/link.h b/chrome/views/link.h index 8db9620..e80b1795 100644 --- a/chrome/views/link.h +++ b/chrome/views/link.h @@ -47,7 +47,7 @@ class Link : public Label { virtual void OnMouseReleased(const MouseEvent& event, bool canceled); virtual bool OnKeyPressed(const KeyEvent& e); - virtual bool OnKeyReleased(const KeyEvent& e); + virtual bool OverrideAccelerator(const Accelerator& accelerator); virtual void SetFont(const ChromeFont& font); |