summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 17:19:20 +0000
committeryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-11 17:19:20 +0000
commit78ec3b6a85cf097c1ef9b2b4233773a0c214f63a (patch)
treead043b533cae164c6c2d9dfe297229243273762c /ash
parentf60f30ef1a16ee90426823a73f37c86b268a07f7 (diff)
downloadchromium_src-78ec3b6a85cf097c1ef9b2b4233773a0c214f63a.zip
chromium_src-78ec3b6a85cf097c1ef9b2b4233773a0c214f63a.tar.gz
chromium_src-78ec3b6a85cf097c1ef9b2b4233773a0c214f63a.tar.bz2
Apply Ash's key rewriter to an aura::MouseEvent so that Modifler+Click is handled correctly.
For example, when Ctrl is remapped to Alt, Ctrl+LeftButton should be handled as a RightButton click. BUG=133510 TEST=mostly covered by existing unit_tests for key_rewriter. Also checked that crbug.com/126529 does not reproduce with this CL. Review URL: https://chromiumcodereview.appspot.com/10756003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/key_rewriter_delegate.h2
-rw-r--r--ash/wm/key_rewriter_event_filter.cc13
2 files changed, 14 insertions, 1 deletions
diff --git a/ash/key_rewriter_delegate.h b/ash/key_rewriter_delegate.h
index 127737b..2def851 100644
--- a/ash/key_rewriter_delegate.h
+++ b/ash/key_rewriter_delegate.h
@@ -7,6 +7,7 @@
namespace aura {
class KeyEvent;
+class LocatedEvent;
} // namespace aura
namespace ash {
@@ -25,6 +26,7 @@ class KeyRewriterDelegate {
// 1) Just return ACTION_DROP_EVENT to drop the |event|.
// 2) Rewrite the |event| and return ACTION_REWRITE_EVENT.
virtual Action RewriteOrFilterKeyEvent(aura::KeyEvent* event) = 0;
+ virtual Action RewriteOrFilterLocatedEvent(aura::LocatedEvent* event) = 0;
};
} // namespace ash
diff --git a/ash/wm/key_rewriter_event_filter.cc b/ash/wm/key_rewriter_event_filter.cc
index 30ba84d..6e7ca2e 100644
--- a/ash/wm/key_rewriter_event_filter.cc
+++ b/ash/wm/key_rewriter_event_filter.cc
@@ -44,7 +44,18 @@ bool KeyRewriterEventFilter::PreHandleKeyEvent(
bool KeyRewriterEventFilter::PreHandleMouseEvent(
aura::Window* target, aura::MouseEvent* event) {
- return false; // Not handled.
+ if (!delegate_.get())
+ return false;
+
+ switch (delegate_->RewriteOrFilterLocatedEvent(event)) {
+ case KeyRewriterDelegate::ACTION_REWRITE_EVENT:
+ return false;
+ case KeyRewriterDelegate::ACTION_DROP_EVENT:
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
}
ui::TouchStatus KeyRewriterEventFilter::PreHandleTouchEvent(