OLD | NEW |
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 #import "base/mac/mac_util.h" | 10 #import "base/mac/mac_util.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 215 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
216 return KeyboardCodeFromNSEvent(native_event); | 216 return KeyboardCodeFromNSEvent(native_event); |
217 } | 217 } |
218 | 218 |
219 DomCode CodeFromNative(const base::NativeEvent& native_event) { | 219 DomCode CodeFromNative(const base::NativeEvent& native_event) { |
220 return CodeFromNSEvent(native_event); | 220 return CodeFromNSEvent(native_event); |
221 } | 221 } |
222 | 222 |
223 uint32 PlatformKeycodeFromNative(const base::NativeEvent& native_event) { | |
224 return native_event.keyCode; | |
225 } | |
226 | |
227 uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) { | 223 uint32 WindowsKeycodeFromNative(const base::NativeEvent& native_event) { |
228 return static_cast<uint32>(KeyboardCodeFromNSEvent(native_event)); | 224 return static_cast<uint32>(KeyboardCodeFromNSEvent(native_event)); |
229 } | 225 } |
230 | 226 |
231 uint16 TextFromNative(const base::NativeEvent& native_event) { | 227 uint16 TextFromNative(const base::NativeEvent& native_event) { |
232 NSString* text = @""; | 228 NSString* text = @""; |
233 if ([native_event type] != NSFlagsChanged) | 229 if ([native_event type] != NSFlagsChanged) |
234 text = [native_event characters]; | 230 text = [native_event characters]; |
235 | 231 |
236 // These exceptions are based on WebInputEventFactoryMac.mm: | 232 // These exceptions are based on WebInputEventFactoryMac.mm: |
(...skipping 27 matching lines...) Expand all Loading... |
264 uint16 return_value; | 260 uint16 return_value; |
265 [text getCharacters:&return_value]; | 261 [text getCharacters:&return_value]; |
266 return return_value; | 262 return return_value; |
267 } | 263 } |
268 | 264 |
269 bool IsCharFromNative(const base::NativeEvent& native_event) { | 265 bool IsCharFromNative(const base::NativeEvent& native_event) { |
270 return false; | 266 return false; |
271 } | 267 } |
272 | 268 |
273 } // namespace ui | 269 } // namespace ui |
OLD | NEW |