1 // Copyright 2019 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #if !defined(WRT_JS_BRINGUP)
6 #include "wrt/src/browser/wrt_input_picker.h"
8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "wrt/src/browser/wrt_native_window.h"
13 WRTInputPicker::WRTInputPicker(content::WebContents* web_contents,
14 Evas_Object* evas_object,
15 content::DateTimeChooserEfl* date_time_chooser)
16 : content::InputPickerBase(web_contents, evas_object, date_time_chooser),
17 web_contents_(web_contents) {}
19 Evas_Object* WRTInputPicker::GetElmWindow() {
20 auto* window = WRTNativeWindow::FromWebContents(web_contents_);
21 return static_cast<Evas_Object*>(window->GetNativeWindow());
24 void WRTInputPicker::ExecuteEditCommand(const char* command,
29 content::WebContentsImpl* wc =
30 static_cast<content::WebContentsImpl*>(web_contents_);
34 if (auto* input_handler = wc->GetFocusedFrameWidgetInputHandler()) {
35 absl::optional<std::u16string> optional_value;
36 optional_value = value ? absl::make_optional(base::ASCIIToUTF16(value))
38 input_handler->ExecuteEditCommand(std::string(command), optional_value);
42 Evas_Object* WRTInputPicker::GetWebView() {
43 return static_cast<Evas_Object*>(web_contents_->GetNativeView());