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

Side by Side Diff: chrome/browser/ui/ash/event_rewriter.h

Issue 10827145: Convert Aura to use ui::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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/workspace/workspace_window_resizer.cc ('k') | chrome/browser/ui/ash/event_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_ASH_EVENT_REWRITER_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_
6 #define CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ 6 #define CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 kDeviceAppleKeyboard, 44 kDeviceAppleKeyboard,
45 }; 45 };
46 46
47 EventRewriter(); 47 EventRewriter();
48 virtual ~EventRewriter(); 48 virtual ~EventRewriter();
49 49
50 // Calls DeviceAddedInternal. 50 // Calls DeviceAddedInternal.
51 DeviceType DeviceAddedForTesting(int device_id, 51 DeviceType DeviceAddedForTesting(int device_id,
52 const std::string& device_name); 52 const std::string& device_name);
53 // Calls Rewrite. 53 // Calls Rewrite.
54 void RewriteForTesting(aura::KeyEvent* event); 54 void RewriteForTesting(ui::KeyEvent* event);
55 55
56 const std::map<int, DeviceType>& device_id_to_type_for_testing() const { 56 const std::map<int, DeviceType>& device_id_to_type_for_testing() const {
57 return device_id_to_type_; 57 return device_id_to_type_;
58 } 58 }
59 void set_last_device_id_for_testing(int device_id) { 59 void set_last_device_id_for_testing(int device_id) {
60 last_device_id_ = device_id; 60 last_device_id_ = device_id;
61 } 61 }
62 void set_pref_service_for_testing(const PrefService* pref_service) { 62 void set_pref_service_for_testing(const PrefService* pref_service) {
63 pref_service_ = pref_service; 63 pref_service_ = pref_service;
64 } 64 }
65 #if defined(OS_CHROMEOS) 65 #if defined(OS_CHROMEOS)
66 void set_xkeyboard_for_testing(chromeos::input_method::XKeyboard* xkeyboard) { 66 void set_xkeyboard_for_testing(chromeos::input_method::XKeyboard* xkeyboard) {
67 xkeyboard_ = xkeyboard; 67 xkeyboard_ = xkeyboard;
68 } 68 }
69 #endif 69 #endif
70 70
71 // Gets DeviceType from the |device_name|. 71 // Gets DeviceType from the |device_name|.
72 static DeviceType GetDeviceType(const std::string& device_name); 72 static DeviceType GetDeviceType(const std::string& device_name);
73 73
74 private: 74 private:
75 // ash::EventRewriterDelegate overrides: 75 // ash::EventRewriterDelegate overrides:
76 virtual ash::EventRewriterDelegate::Action RewriteOrFilterKeyEvent( 76 virtual ash::EventRewriterDelegate::Action RewriteOrFilterKeyEvent(
77 aura::KeyEvent* event) OVERRIDE; 77 ui::KeyEvent* event) OVERRIDE;
78 virtual ash::EventRewriterDelegate::Action RewriteOrFilterLocatedEvent( 78 virtual ash::EventRewriterDelegate::Action RewriteOrFilterLocatedEvent(
79 aura::LocatedEvent* event) OVERRIDE; 79 ui::LocatedEvent* event) OVERRIDE;
80 80
81 // aura::RootWindowObserver overrides: 81 // aura::RootWindowObserver overrides:
82 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE; 82 virtual void OnKeyboardMappingChanged(const aura::RootWindow* root) OVERRIDE;
83 83
84 #if defined(OS_CHROMEOS) 84 #if defined(OS_CHROMEOS)
85 // chromeos::DeviceHierarchyObserver overrides: 85 // chromeos::DeviceHierarchyObserver overrides:
86 virtual void DeviceHierarchyChanged() OVERRIDE {} 86 virtual void DeviceHierarchyChanged() OVERRIDE {}
87 virtual void DeviceAdded(int device_id) OVERRIDE; 87 virtual void DeviceAdded(int device_id) OVERRIDE;
88 virtual void DeviceRemoved(int device_id) OVERRIDE; 88 virtual void DeviceRemoved(int device_id) OVERRIDE;
89 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE; 89 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE;
90 90
91 // Updates |*_xkeycode_| in response to a keyboard map change. 91 // Updates |*_xkeycode_| in response to a keyboard map change.
92 void RefreshKeycodes(); 92 void RefreshKeycodes();
93 // Converts an X key symbol like XK_Control_L to a key code. 93 // Converts an X key symbol like XK_Control_L to a key code.
94 unsigned char NativeKeySymToNativeKeycode(unsigned long keysym); 94 unsigned char NativeKeySymToNativeKeycode(unsigned long keysym);
95 #endif 95 #endif
96 96
97 // Rewrites the |event| by applying all RewriteXXX functions as needed. 97 // Rewrites the |event| by applying all RewriteXXX functions as needed.
98 void Rewrite(aura::KeyEvent* event); 98 void Rewrite(ui::KeyEvent* event);
99 99
100 // Rewrites a modifier key press/release following the current user 100 // Rewrites a modifier key press/release following the current user
101 // preferences. 101 // preferences.
102 bool RewriteModifiers(aura::KeyEvent* event); 102 bool RewriteModifiers(ui::KeyEvent* event);
103 103
104 // Rewrites a NumPad key press/release without Num Lock to a corresponding key 104 // Rewrites a NumPad key press/release without Num Lock to a corresponding key
105 // press/release with the lock. Returns true when |event| is rewritten. 105 // press/release with the lock. Returns true when |event| is rewritten.
106 bool RewriteNumPadKeys(aura::KeyEvent* event); 106 bool RewriteNumPadKeys(ui::KeyEvent* event);
107 107
108 // Rewrites Backspace and Arrow keys following the Chrome OS keyboard spec. 108 // Rewrites Backspace and Arrow keys following the Chrome OS keyboard spec.
109 // * Alt+Backspace -> Delete 109 // * Alt+Backspace -> Delete
110 // * Alt+Up -> Prior (aka PageUp) 110 // * Alt+Up -> Prior (aka PageUp)
111 // * Alt+Down -> Next (aka PageDown) 111 // * Alt+Down -> Next (aka PageDown)
112 // * Ctrl+Alt+Up -> Home 112 // * Ctrl+Alt+Up -> Home
113 // * Ctrl+Alt+Down -> End 113 // * Ctrl+Alt+Down -> End
114 bool RewriteBackspaceAndArrowKeys(aura::KeyEvent* event); 114 bool RewriteBackspaceAndArrowKeys(ui::KeyEvent* event);
115 115
116 // Rewrites the located |event|. 116 // Rewrites the located |event|.
117 void RewriteLocatedEvent(aura::LocatedEvent* event); 117 void RewriteLocatedEvent(ui::LocatedEvent* event);
118 118
119 // Overwrites |event| with the keycodes and flags. 119 // Overwrites |event| with the keycodes and flags.
120 void OverwriteEvent(aura::KeyEvent* event, 120 void OverwriteEvent(ui::KeyEvent* event,
121 unsigned int new_native_keycode, 121 unsigned int new_native_keycode,
122 unsigned int new_native_state, 122 unsigned int new_native_state,
123 ui::KeyboardCode new_keycode, 123 ui::KeyboardCode new_keycode,
124 int new_flags); 124 int new_flags);
125 125
126 // Checks the type of the |device_name|, and inserts a new entry to 126 // Checks the type of the |device_name|, and inserts a new entry to
127 // |device_id_to_type_|. 127 // |device_id_to_type_|.
128 DeviceType DeviceAddedInternal(int device_id, const std::string& device_name); 128 DeviceType DeviceAddedInternal(int device_id, const std::string& device_name);
129 129
130 // Returns true if |last_device_id_| is Apple's. 130 // Returns true if |last_device_id_| is Apple's.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 chromeos::input_method::XKeyboard* xkeyboard_; // for testing. 171 chromeos::input_method::XKeyboard* xkeyboard_; // for testing.
172 #endif 172 #endif
173 173
174 const PrefService* pref_service_; // for testing. 174 const PrefService* pref_service_; // for testing.
175 175
176 DISALLOW_COPY_AND_ASSIGN(EventRewriter); 176 DISALLOW_COPY_AND_ASSIGN(EventRewriter);
177 }; 177 };
178 178
179 #endif // CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_ 179 #endif // CHROME_BROWSER_UI_ASH_EVENT_REWRITER_H_
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | chrome/browser/ui/ash/event_rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698