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

Side by Side Diff: ui/events/cocoa/events_mac.mm

Issue 492863002: mojo: Plumb through sufficient context to make real blink::WebInputEvents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final sky nits Created 6 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 | « mojo/services/public/interfaces/input_events/input_key_codes.mojom ('k') | ui/events/event.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "ui/events/event_utils.h" 5 #include "ui/events/event_utils.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 const char* CodeFromNative(const base::NativeEvent& native_event) { 208 const char* CodeFromNative(const base::NativeEvent& native_event) {
209 return CodeFromNSEvent(native_event); 209 return CodeFromNSEvent(native_event);
210 } 210 }
211 211
212 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { 212 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) {
213 return native_event.keyCode; 213 return native_event.keyCode;
214 } 214 }
215 215
216 uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) {
217 return static_cast<uint32>(KeyboardCodeFromNSEvent(native_event));
218 }
219
220 uint16 TextFromNative(const base::NativeEvent& native_event) {
221 NSString* text = @"";
222 if ([native_event type] != NSFlagsChanged)
223 text = [native_event characters];
224
225 // These exceptions are based on WebInputEventFactoryMac.mm:
226 uint32 windows_keycode = WindowsKeycodeFromNative(native_event);
227 if (windows_keycode == '\r')
228 text = @"\r";
229 if ([text isEqualToString:@"\x7F"])
230 text = @"\x8";
231 if (windows_keycode == 9)
232 text = @"\x9";
233
234 uint16 return_value;
235 [text getCharacters:&return_value];
236 return return_value;
237 }
238
239 uint16 UnmodifiedTextFromNative(const base::NativeEvent& native_event) {
240 NSString* text = @"";
241 if ([native_event type] != NSFlagsChanged)
242 text = [native_event charactersIgnoringModifiers];
243
244 // These exceptions are based on WebInputEventFactoryMac.mm:
245 uint32 windows_keycode = WindowsKeycodeFromNative(native_event);
246 if (windows_keycode == '\r')
247 text = @"\r";
248 if ([text isEqualToString:@"\x7F"])
249 text = @"\x8";
250 if (windows_keycode == 9)
251 text = @"\x9";
252
253 uint16 return_value;
254 [text getCharacters:&return_value];
255 return return_value;
256 }
257
216 bool IsCharFromNative(const base::NativeEvent& native_event) { 258 bool IsCharFromNative(const base::NativeEvent& native_event) {
217 return false; 259 return false;
218 } 260 }
219 261
220 } // namespace ui 262 } // namespace ui
OLDNEW
« no previous file with comments | « mojo/services/public/interfaces/input_events/input_key_codes.mojom ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698