diff options
author | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 00:57:57 +0000 |
---|---|---|
committer | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-27 00:57:57 +0000 |
commit | 42f06f9ca2fe07018a88994569f87373a7c6c578 (patch) | |
tree | 526028affef80bcaa4a9b0771f27ac969e0b8c47 /ash/key_rewriter_delegate.h | |
parent | 706cfde8e0b70a58ecb60d3f6eb918295b188234 (diff) | |
download | chromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.zip chromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.tar.gz chromium_src-42f06f9ca2fe07018a88994569f87373a7c6c578.tar.bz2 |
Automatically remap Command key on an Apple keyboard to Control [part 1 of 2 - Ash part]
Add key_rewriter_event_filter.h which allows its delegate to rewrite or delete an aura::KeyEvent. The new interface will be used for implementing the following three features:
* crosbug.com/25097: Remap keys on external keyboards (R19)
* crosbug.com/27167: Consider adding a way to send function keys to web pages (R20)
* crbug.com/115112: Move modifier remapping code from X to Chrome (M20)
Part 2 of 2: http://codereview.chromium.org/9854025/
BUG=chromium-os:25097
BUG=chromium-os:27167
BUG=115112
TEST=try
Review URL: https://chromiumcodereview.appspot.com/9838010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/key_rewriter_delegate.h')
-rw-r--r-- | ash/key_rewriter_delegate.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ash/key_rewriter_delegate.h b/ash/key_rewriter_delegate.h new file mode 100644 index 0000000..16fcad9 --- /dev/null +++ b/ash/key_rewriter_delegate.h @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_KEY_REWRITER_DELEGATE_H_ +#define ASH_KEY_REWRITER_DELEGATE_H_ +#pragma once + +namespace aura { +class KeyEvent; +} // namespace aura + +namespace ash { + +// Delegate for rewriting or filtering a key event. +class KeyRewriterDelegate { + public: + enum Action { + ACTION_REWRITE_EVENT, + ACTION_DROP_EVENT, + }; + + virtual ~KeyRewriterDelegate() {} + + // A derived class can do either of the following: + // 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; +}; + +} // namespace ash + +#endif // ASH_KEY_REWRITER_DELEGATE_H_ |