diff options
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/combobox/combobox.cc | 12 | ||||
-rw-r--r-- | views/controls/combobox/combobox.h | 2 | ||||
-rw-r--r-- | views/controls/link.cc | 6 | ||||
-rw-r--r-- | views/controls/link.h | 2 |
4 files changed, 10 insertions, 12 deletions
diff --git a/views/controls/combobox/combobox.cc b/views/controls/combobox/combobox.cc index f4ae17b..43165a2 100644 --- a/views/controls/combobox/combobox.cc +++ b/views/controls/combobox/combobox.cc @@ -4,6 +4,7 @@ #include "views/controls/combobox/combobox.h" +#include "base/keyboard_codes.h" #include "base/logging.h" #include "views/controls/combobox/native_combobox_wrapper.h" @@ -69,14 +70,11 @@ void Combobox::SetEnabled(bool flag) { // VK_ESCAPE should be handled by this view when the drop down list is active. // In other words, the list should be closed instead of the dialog. -bool Combobox::OverrideAccelerator(const Accelerator& accelerator) { -#if defined(OS_WIN) - if (accelerator != Accelerator(VK_ESCAPE, false, false, false)) +bool Combobox::SkipDefaultKeyEventProcessing(const KeyEvent& e) { + if (e.GetCharacter() != base::VKEY_ESCAPE || + e.IsShiftDown() || e.IsControlDown() || e.IsAltDown()) { return false; -#else - NOTIMPLEMENTED(); - // TODO(port): figure out VK_keys -#endif + } return native_wrapper_ && native_wrapper_->IsDropdownOpen(); } diff --git a/views/controls/combobox/combobox.h b/views/controls/combobox/combobox.h index 2bb63d2..2196974 100644 --- a/views/controls/combobox/combobox.h +++ b/views/controls/combobox/combobox.h @@ -60,7 +60,7 @@ class Combobox : public View { virtual gfx::Size GetPreferredSize(); virtual void Layout(); virtual void SetEnabled(bool enabled); - virtual bool OverrideAccelerator(const Accelerator& accelerator); + virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); protected: virtual void Focus(); diff --git a/views/controls/link.cc b/views/controls/link.cc index a9b8d7e..14bc112 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -127,10 +127,10 @@ bool Link::OnKeyPressed(const KeyEvent& e) { return false; } -bool Link::OverrideAccelerator(const Accelerator& accelerator) { +bool Link::SkipDefaultKeyEventProcessing(const KeyEvent& e) { #if defined(OS_WIN) - return (accelerator.GetKeyCode() == VK_SPACE) || - (accelerator.GetKeyCode() == VK_RETURN); + // Make sure we don't process space or enter as accelerators. + return (e.GetCharacter() == VK_SPACE) || (e.GetCharacter() == VK_RETURN); #else NOTIMPLEMENTED(); return false; diff --git a/views/controls/link.h b/views/controls/link.h index 36c1f4f..91e77ad 100644 --- a/views/controls/link.h +++ b/views/controls/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 OverrideAccelerator(const Accelerator& accelerator); + virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& e); virtual void SetFont(const gfx::Font& font); |