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 "content/browser/devtools/protocol/input_handler.h" | 5 #include "content/browser/devtools/protocol/input_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 event.windowsKeyCode = *windows_virtual_key_code; | 191 event.windowsKeyCode = *windows_virtual_key_code; |
192 if (native_virtual_key_code) | 192 if (native_virtual_key_code) |
193 event.nativeKeyCode = *native_virtual_key_code; | 193 event.nativeKeyCode = *native_virtual_key_code; |
194 if (auto_repeat && *auto_repeat) | 194 if (auto_repeat && *auto_repeat) |
195 event.modifiers |= blink::WebInputEvent::IsAutoRepeat; | 195 event.modifiers |= blink::WebInputEvent::IsAutoRepeat; |
196 if (is_keypad && *is_keypad) | 196 if (is_keypad && *is_keypad) |
197 event.modifiers |= blink::WebInputEvent::IsKeyPad; | 197 event.modifiers |= blink::WebInputEvent::IsKeyPad; |
198 if (is_system_key) | 198 if (is_system_key) |
199 event.isSystemKey = *is_system_key; | 199 event.isSystemKey = *is_system_key; |
200 | 200 |
201 if (key_identifier) { | |
202 if (key_identifier->size() > | |
203 blink::WebKeyboardEvent::keyIdentifierLengthCap) { | |
204 return Response::InvalidParams("Invalid 'keyIdentifier' parameter"); | |
205 } | |
206 for (size_t i = 0; i < key_identifier->size(); ++i) | |
207 event.keyIdentifier[i] = (*key_identifier)[i]; | |
208 } else if (event.type != blink::WebInputEvent::Char) { | |
209 event.setKeyIdentifierFromWindowsKeyCode(); | |
210 } | |
211 | |
212 if (code) { | 201 if (code) { |
213 event.domCode = static_cast<int>( | 202 event.domCode = static_cast<int>( |
214 ui::KeycodeConverter::CodeStringToDomCode(*code)); | 203 ui::KeycodeConverter::CodeStringToDomCode(*code)); |
215 } | 204 } |
216 | 205 |
217 if (key) { | 206 if (key) { |
218 event.domKey = static_cast<int>( | 207 event.domKey = static_cast<int>( |
219 ui::KeycodeConverter::KeyStringToDomKey(*key)); | 208 ui::KeycodeConverter::KeyStringToDomKey(*key)); |
220 } | 209 } |
221 | 210 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } else { | 508 } else { |
520 client_->SendError(command_id, | 509 client_->SendError(command_id, |
521 Response::InternalError(base::StringPrintf( | 510 Response::InternalError(base::StringPrintf( |
522 "Synthetic tap failed, result was %d", result))); | 511 "Synthetic tap failed, result was %d", result))); |
523 } | 512 } |
524 } | 513 } |
525 | 514 |
526 } // namespace input | 515 } // namespace input |
527 } // namespace devtools | 516 } // namespace devtools |
528 } // namespace content | 517 } // namespace content |
OLD | NEW |