Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1672)

Unified Diff: chrome/browser/ui/ash/event_rewriter.h

Issue 11417144: Use rewriting to make ChromeOS keyboard F<number> keys produce extended keycodes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: static const Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/event_rewriter.h
diff --git a/chrome/browser/ui/ash/event_rewriter.h b/chrome/browser/ui/ash/event_rewriter.h
index f35276df188009a5ecdf3480343aa082ec014695..9fb67396d22e9c13f757f2a7b6ab287fa408fbd8 100644
--- a/chrome/browser/ui/ash/event_rewriter.h
+++ b/chrome/browser/ui/ash/event_rewriter.h
@@ -11,6 +11,7 @@
#include "ash/event_rewriter_delegate.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/hash_tables.h"
#include "ui/aura/root_window_observer.h"
#include "ui/base/keycodes/keyboard_codes.h"
@@ -42,6 +43,7 @@ class EventRewriter : public ash::EventRewriterDelegate,
enum DeviceType {
kDeviceUnknown = 0,
kDeviceAppleKeyboard,
+ kDeviceChromeOSKeyboard,
};
EventRewriter();
@@ -66,6 +68,9 @@ class EventRewriter : public ash::EventRewriterDelegate,
void set_xkeyboard_for_testing(chromeos::input_method::XKeyboard* xkeyboard) {
xkeyboard_ = xkeyboard;
}
+ void set_force_chromeos_keyboard_for_testing(bool chromeos_keyboard) {
+ force_chromeos_keyboard_for_testing_ = chromeos_keyboard;
+ }
#endif
// Gets DeviceType from the |device_name|.
@@ -88,6 +93,8 @@ class EventRewriter : public ash::EventRewriterDelegate,
virtual void DeviceRemoved(int device_id) OVERRIDE;
virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE;
+ bool EventSourceIsChromeOSKeyboard() const;
+
// Updates |*_xkeycode_| in response to a keyboard map change.
void RefreshKeycodes();
// Converts an X key symbol like XK_Control_L to a key code.
@@ -125,6 +132,11 @@ class EventRewriter : public ash::EventRewriterDelegate,
// Returns true when the |event| is rewritten.
bool RewriteBackspaceAndArrowKeys(ui::KeyEvent* event);
+ // When the Search key acts as a function key, it remaps Search+1
+ // through Search+= to F1 through F12. Returns true when the |event| is
+ // rewritten.
+ bool RewriteFunctionKeys(ui::KeyEvent* event);
+
// Rewrites the located |event|.
void RewriteLocatedEvent(ui::LocatedEvent* event);
@@ -153,32 +165,10 @@ class EventRewriter : public ash::EventRewriterDelegate,
int last_device_id_;
#if defined(OS_CHROMEOS)
- // X keycodes corresponding to various keysyms.
- unsigned int control_l_xkeycode_;
- unsigned int control_r_xkeycode_;
- unsigned int alt_l_xkeycode_;
- unsigned int alt_r_xkeycode_;
- unsigned int meta_l_xkeycode_;
- unsigned int meta_r_xkeycode_;
- unsigned int windows_l_xkeycode_;
- unsigned int caps_lock_xkeycode_;
- unsigned int void_symbol_xkeycode_;
- unsigned int delete_xkeycode_;
- unsigned int home_xkeycode_;
- unsigned int end_xkeycode_;
- unsigned int prior_xkeycode_;
- unsigned int next_xkeycode_;
- unsigned int kp_0_xkeycode_;
- unsigned int kp_1_xkeycode_;
- unsigned int kp_2_xkeycode_;
- unsigned int kp_3_xkeycode_;
- unsigned int kp_4_xkeycode_;
- unsigned int kp_5_xkeycode_;
- unsigned int kp_6_xkeycode_;
- unsigned int kp_7_xkeycode_;
- unsigned int kp_8_xkeycode_;
- unsigned int kp_9_xkeycode_;
- unsigned int kp_decimal_xkeycode_;
+ bool force_chromeos_keyboard_for_testing_;
+
+ // A mapping from X11 KeySym keys to KeyCode values.
+ base::hash_map<unsigned long, unsigned long> keysym_to_keycode_map_;
chromeos::input_method::XKeyboard* xkeyboard_; // for testing.
#endif

Powered by Google App Engine
This is Rietveld 408576698