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

Side by Side Diff: chrome/browser/ui/views/ash/key_rewriter.h

Issue 10756003: Apply Ash's key rewriter to an aura::MouseEvent so that Modifler+Click is handled correctly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/key_rewriter_event_filter.cc ('k') | chrome/browser/ui/views/ash/key_rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_
6 #define CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 #endif 70 #endif
71 71
72 // Gets DeviceType from the |device_name|. 72 // Gets DeviceType from the |device_name|.
73 static DeviceType GetDeviceType(const std::string& device_name); 73 static DeviceType GetDeviceType(const std::string& device_name);
74 74
75 private: 75 private:
76 // ash::KeyRewriterDelegate overrides: 76 // ash::KeyRewriterDelegate overrides:
77 virtual ash::KeyRewriterDelegate::Action RewriteOrFilterKeyEvent( 77 virtual ash::KeyRewriterDelegate::Action RewriteOrFilterKeyEvent(
78 aura::KeyEvent* event) OVERRIDE; 78 aura::KeyEvent* event) OVERRIDE;
79 virtual ash::KeyRewriterDelegate::Action RewriteOrFilterLocatedEvent(
80 aura::LocatedEvent* event) OVERRIDE;
79 81
80 // aura::RootWindowObserver overrides: 82 // aura::RootWindowObserver overrides:
81 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE; 83 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE;
82 84
83 #if defined(OS_CHROMEOS) 85 #if defined(OS_CHROMEOS)
84 // chromeos::DeviceHierarchyObserver overrides: 86 // chromeos::DeviceHierarchyObserver overrides:
85 virtual void DeviceHierarchyChanged() OVERRIDE {} 87 virtual void DeviceHierarchyChanged() OVERRIDE {}
86 virtual void DeviceAdded(int device_id) OVERRIDE; 88 virtual void DeviceAdded(int device_id) OVERRIDE;
87 virtual void DeviceRemoved(int device_id) OVERRIDE; 89 virtual void DeviceRemoved(int device_id) OVERRIDE;
88 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE; 90 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE;
(...skipping 16 matching lines...) Expand all
105 bool RewriteNumPadKeys(aura::KeyEvent* event); 107 bool RewriteNumPadKeys(aura::KeyEvent* event);
106 108
107 // Rewrites Backspace and Arrow keys following the Chrome OS keyboard spec. 109 // Rewrites Backspace and Arrow keys following the Chrome OS keyboard spec.
108 // * Alt+Backspace -> Delete 110 // * Alt+Backspace -> Delete
109 // * Alt+Up -> Prior (aka PageUp) 111 // * Alt+Up -> Prior (aka PageUp)
110 // * Alt+Down -> Next (aka PageDown) 112 // * Alt+Down -> Next (aka PageDown)
111 // * Ctrl+Alt+Up -> Home 113 // * Ctrl+Alt+Up -> Home
112 // * Ctrl+Alt+Down -> End 114 // * Ctrl+Alt+Down -> End
113 bool RewriteBackspaceAndArrowKeys(aura::KeyEvent* event); 115 bool RewriteBackspaceAndArrowKeys(aura::KeyEvent* event);
114 116
117 // Rewrites the located |event|.
118 void RewriteLocatedEvent(aura::LocatedEvent* event);
119
115 // Overwrites |event| with the keycodes and flags. 120 // Overwrites |event| with the keycodes and flags.
116 void OverwriteEvent(aura::KeyEvent* event, 121 void OverwriteEvent(aura::KeyEvent* event,
117 unsigned int new_native_keycode, 122 unsigned int new_native_keycode,
118 unsigned int new_native_state, 123 unsigned int new_native_state,
119 ui::KeyboardCode new_keycode, 124 ui::KeyboardCode new_keycode,
120 int new_flags); 125 int new_flags);
121 126
122 // Checks the type of the |device_name|, and inserts a new entry to 127 // Checks the type of the |device_name|, and inserts a new entry to
123 // |device_id_to_type_|. 128 // |device_id_to_type_|.
124 DeviceType DeviceAddedInternal(int device_id, const std::string& device_name); 129 DeviceType DeviceAddedInternal(int device_id, const std::string& device_name);
125 130
126 // Returns true if |last_device_id_| is Apple's. 131 // Returns true if |last_device_id_| is Apple's.
127 bool IsAppleKeyboard() const; 132 bool IsAppleKeyboard() const;
128 133
134 // Remaps |original_flags| to |remapped_flags| and |original_native_modifiers|
135 // to |remapped_native_modifiers| following the current user prefs.
136 void GetRemappedModifierMasks(int original_flags,
137 unsigned int original_native_modifiers,
138 int* remapped_flags,
139 unsigned int* remapped_native_modifiers) const;
140
129 std::map<int, DeviceType> device_id_to_type_; 141 std::map<int, DeviceType> device_id_to_type_;
130 int last_device_id_; 142 int last_device_id_;
131 143
132 #if defined(OS_CHROMEOS) 144 #if defined(OS_CHROMEOS)
133 // X keycodes corresponding to various keysyms. 145 // X keycodes corresponding to various keysyms.
134 unsigned int control_l_xkeycode_; 146 unsigned int control_l_xkeycode_;
135 unsigned int control_r_xkeycode_; 147 unsigned int control_r_xkeycode_;
136 unsigned int alt_l_xkeycode_; 148 unsigned int alt_l_xkeycode_;
137 unsigned int alt_r_xkeycode_; 149 unsigned int alt_r_xkeycode_;
138 unsigned int meta_l_xkeycode_; 150 unsigned int meta_l_xkeycode_;
(...skipping 20 matching lines...) Expand all
159 171
160 chromeos::input_method::XKeyboard* xkeyboard_; // for testing. 172 chromeos::input_method::XKeyboard* xkeyboard_; // for testing.
161 #endif 173 #endif
162 174
163 const PrefService* pref_service_; // for testing. 175 const PrefService* pref_service_; // for testing.
164 176
165 DISALLOW_COPY_AND_ASSIGN(KeyRewriter); 177 DISALLOW_COPY_AND_ASSIGN(KeyRewriter);
166 }; 178 };
167 179
168 #endif // CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_ 180 #endif // CHROME_BROWSER_UI_VIEWS_ASH_KEY_REWRITER_H_
OLDNEW
« no previous file with comments | « ash/wm/key_rewriter_event_filter.cc ('k') | chrome/browser/ui/views/ash/key_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698