OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 InspectorInputAgent::InspectorInputAgent(Page* page, InspectorClient* client) | 92 InspectorInputAgent::InspectorInputAgent(Page* page, InspectorClient* client) |
93 : InspectorBaseAgent<InspectorInputAgent>("Input") | 93 : InspectorBaseAgent<InspectorInputAgent>("Input") |
94 , m_page(page), m_client(client) | 94 , m_page(page), m_client(client) |
95 { | 95 { |
96 } | 96 } |
97 | 97 |
98 InspectorInputAgent::~InspectorInputAgent() | 98 InspectorInputAgent::~InspectorInputAgent() |
99 { | 99 { |
100 } | 100 } |
101 | 101 |
102 void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
e, const int* modifiers, const double* timestamp, const String* text, const Stri
ng* unmodifiedText, const String* keyIdentifier, const int* windowsVirtualKeyCod
e, const int* nativeVirtualKeyCode, const bool* autoRepeat, const bool* isKeypad
, const bool* isSystemKey) | 102 void InspectorInputAgent::dispatchKeyEvent(ErrorString* error, const String& typ
e, const int* modifiers, const double* timestamp, const String* text, const Stri
ng* unmodifiedText, const String* keyIdentifier, const String* code, const int*
windowsVirtualKeyCode, const int* nativeVirtualKeyCode, const bool* autoRepeat,
const bool* isKeypad, const bool* isSystemKey) |
103 { | 103 { |
104 PlatformEvent::Type convertedType; | 104 PlatformEvent::Type convertedType; |
105 if (type == "keyDown") | 105 if (type == "keyDown") |
106 convertedType = PlatformEvent::KeyDown; | 106 convertedType = PlatformEvent::KeyDown; |
107 else if (type == "keyUp") | 107 else if (type == "keyUp") |
108 convertedType = PlatformEvent::KeyUp; | 108 convertedType = PlatformEvent::KeyUp; |
109 else if (type == "char") | 109 else if (type == "char") |
110 convertedType = PlatformEvent::Char; | 110 convertedType = PlatformEvent::Char; |
111 else if (type == "rawKeyDown") | 111 else if (type == "rawKeyDown") |
112 convertedType = PlatformEvent::RawKeyDown; | 112 convertedType = PlatformEvent::RawKeyDown; |
113 else { | 113 else { |
114 *error = "Unrecognized type: " + type; | 114 *error = "Unrecognized type: " + type; |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 PlatformKeyboardEvent event( | 118 PlatformKeyboardEvent event( |
119 convertedType, | 119 convertedType, |
120 text ? *text : "", | 120 text ? *text : "", |
121 unmodifiedText ? *unmodifiedText : "", | 121 unmodifiedText ? *unmodifiedText : "", |
122 keyIdentifier ? *keyIdentifier : "", | 122 keyIdentifier ? *keyIdentifier : "", |
| 123 code ? *code : "", |
123 windowsVirtualKeyCode ? *windowsVirtualKeyCode : 0, | 124 windowsVirtualKeyCode ? *windowsVirtualKeyCode : 0, |
124 nativeVirtualKeyCode ? *nativeVirtualKeyCode : 0, | 125 nativeVirtualKeyCode ? *nativeVirtualKeyCode : 0, |
125 asBool(autoRepeat), | 126 asBool(autoRepeat), |
126 asBool(isKeypad), | 127 asBool(isKeypad), |
127 asBool(isSystemKey), | 128 asBool(isSystemKey), |
128 static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0), | 129 static_cast<PlatformEvent::Modifiers>(modifiers ? *modifiers : 0), |
129 timestamp ? *timestamp : currentTime()); | 130 timestamp ? *timestamp : currentTime()); |
130 m_client->dispatchKeyEvent(event); | 131 m_client->dispatchKeyEvent(event); |
131 } | 132 } |
132 | 133 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 268 } |
268 | 269 |
269 void InspectorInputAgent::trace(Visitor* visitor) | 270 void InspectorInputAgent::trace(Visitor* visitor) |
270 { | 271 { |
271 visitor->trace(m_page); | 272 visitor->trace(m_page); |
272 InspectorBaseAgent::trace(visitor); | 273 InspectorBaseAgent::trace(visitor); |
273 } | 274 } |
274 | 275 |
275 } // namespace blink | 276 } // namespace blink |
276 | 277 |
OLD | NEW |