| 548 | } |
| 549 | |
| 550 | int InputManager::KeyDown(BrowserHandle browser_wrapper, |
| 551 | const Json::Value& down_action, |
| 552 | InputState* input_state) { |
| 553 | int status_code = WD_SUCCESS; |
| 554 | std::string key_value = down_action["value"].asString(); |
| 555 | std::wstring key = StringUtilities::ToWString(key_value); |
| 556 | |
| 557 | if (!this->IsSingleKey(key)) { |
| 558 | return EINVALIDARGUMENT; |
| 559 | } |
| 560 | |
| 561 | if (this->action_simulator_->UseExtraInfo()) { |
| 562 | LOG(DEBUG) << "Using synthetic events for sending keys"; |
| 563 | KeyboardExtraInfo* extra_info = new KeyboardExtraInfo(); |
| 564 | extra_info->character = key; |
| 565 | INPUT input_element; |
| 566 | input_element.type = INPUT_KEYBOARD; |
| 567 | |
| 568 | input_element.ki.wVk = 0; |
| 569 | input_element.ki.wScan = 0; |
| 570 | input_element.ki.dwFlags = 0; |
| 571 | input_element.ki.dwExtraInfo = reinterpret_cast<ULONG_PTR>(extra_info); |
| 572 | input_element.ki.time = 0; |
| 573 | this->inputs_.push_back(input_element); |
| 574 | } else { |
| 575 | HWND window_handle = browser_wrapper->GetContentWindowHandle(); |
| 576 | this->AddKeyboardInput(window_handle, key, false, input_state); |
| 577 | } |
| 578 | return status_code; |
| 579 | } |
| 580 | |
| 581 | int InputManager::KeyUp(BrowserHandle browser_wrapper, |
| 582 | const Json::Value& up_action, |
no test coverage detected