| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /* | 5 /* |
| 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 7 * Copyright (C) 2006-2009 Google Inc. | 7 * Copyright (C) 2006-2009 Google Inc. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" | 31 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" |
| 32 | 32 |
| 33 #import <ApplicationServices/ApplicationServices.h> | 33 #import <ApplicationServices/ApplicationServices.h> |
| 34 #import <Cocoa/Cocoa.h> | 34 #import <Cocoa/Cocoa.h> |
| 35 | 35 |
| 36 #include <stdint.h> | 36 #include <stdint.h> |
| 37 | 37 |
| 38 #include "base/mac/sdk_forward_declarations.h" | 38 #include "base/mac/sdk_forward_declarations.h" |
| 39 #include "base/strings/string_util.h" | 39 #include "base/strings/string_util.h" |
| 40 #include "content/browser/renderer_host/input/web_input_event_util.h" | |
| 41 #include "third_party/WebKit/public/web/WebInputEvent.h" | 40 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 42 #include "ui/base/cocoa/cocoa_base_utils.h" | 41 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 42 #include "ui/events/blink/blink_event_util.h" |
| 43 #import "ui/events/cocoa/cocoa_event_utils.h" | 43 #import "ui/events/cocoa/cocoa_event_utils.h" |
| 44 #include "ui/events/keycodes/keyboard_code_conversion.h" | 44 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 45 #include "ui/events/keycodes/keyboard_code_conversion_mac.h" | 45 #include "ui/events/keycodes/keyboard_code_conversion_mac.h" |
| 46 | 46 |
| 47 namespace content { | 47 namespace content { |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 // Return true if the target modifier key is up. OS X has an "official" flag | 51 // Return true if the target modifier key is up. OS X has an "official" flag |
| 52 // to test whether either left or right versions of a modifier key are held, | 52 // to test whether either left or right versions of a modifier key are held, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 : blink::WebInputEvent::RawKeyDown; | 280 : blink::WebInputEvent::RawKeyDown; |
| 281 | 281 |
| 282 result.modifiers = ModifiersFromEvent(event); | 282 result.modifiers = ModifiersFromEvent(event); |
| 283 | 283 |
| 284 if (([event type] != NSFlagsChanged) && [event isARepeat]) | 284 if (([event type] != NSFlagsChanged) && [event isARepeat]) |
| 285 result.modifiers |= blink::WebInputEvent::IsAutoRepeat; | 285 result.modifiers |= blink::WebInputEvent::IsAutoRepeat; |
| 286 | 286 |
| 287 ui::DomCode dom_code = ui::DomCodeFromNSEvent(event); | 287 ui::DomCode dom_code = ui::DomCodeFromNSEvent(event); |
| 288 result.windowsKeyCode = | 288 result.windowsKeyCode = |
| 289 ui::LocatedToNonLocatedKeyboardCode(ui::KeyboardCodeFromNSEvent(event)); | 289 ui::LocatedToNonLocatedKeyboardCode(ui::KeyboardCodeFromNSEvent(event)); |
| 290 result.modifiers |= DomCodeToWebInputEventModifiers(dom_code); | 290 result.modifiers |= ui::DomCodeToWebInputEventModifiers(dom_code); |
| 291 result.nativeKeyCode = [event keyCode]; | 291 result.nativeKeyCode = [event keyCode]; |
| 292 result.domCode = static_cast<int>(dom_code); | 292 result.domCode = static_cast<int>(dom_code); |
| 293 result.domKey = DomKeyFromEvent(event); | 293 result.domKey = DomKeyFromEvent(event); |
| 294 NSString* text_str = TextFromEvent(event); | 294 NSString* text_str = TextFromEvent(event); |
| 295 NSString* unmodified_str = UnmodifiedTextFromEvent(event); | 295 NSString* unmodified_str = UnmodifiedTextFromEvent(event); |
| 296 | 296 |
| 297 // Begin Apple code, copied from KeyEventMac.mm | 297 // Begin Apple code, copied from KeyEventMac.mm |
| 298 | 298 |
| 299 // Always use 13 for Enter/Return -- we don't want to use AppKit's | 299 // Always use 13 for Enter/Return -- we don't want to use AppKit's |
| 300 // different character for Enter. | 300 // different character for Enter. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 break; | 607 break; |
| 608 default: | 608 default: |
| 609 NOTIMPLEMENTED(); | 609 NOTIMPLEMENTED(); |
| 610 result.type = blink::WebInputEvent::Undefined; | 610 result.type = blink::WebInputEvent::Undefined; |
| 611 } | 611 } |
| 612 | 612 |
| 613 return result; | 613 return result; |
| 614 } | 614 } |
| 615 | 615 |
| 616 } // namespace content | 616 } // namespace content |
| OLD | NEW |