• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ohos_nweb/bridge/ark_web_handler_wrapper.h"
17 
18 #include "ohos_nweb/bridge/ark_web_access_request_impl.h"
19 #include "ohos_nweb/bridge/ark_web_applink_callback_impl.h"
20 #include "ohos_nweb/bridge/ark_web_console_log_impl.h"
21 #include "ohos_nweb/bridge/ark_web_context_menu_callback_impl.h"
22 #include "ohos_nweb/bridge/ark_web_context_menu_params_impl.h"
23 #include "ohos_nweb/bridge/ark_web_controller_handler_impl.h"
24 #include "ohos_nweb/bridge/ark_web_core_struct_utils.h"
25 #include "ohos_nweb/bridge/ark_web_cursor_info_impl.h"
26 #include "ohos_nweb/bridge/ark_web_custom_keyboard_handler_impl.h"
27 #include "ohos_nweb/bridge/ark_web_data_resubmission_callback_impl.h"
28 #include "ohos_nweb/bridge/ark_web_date_time_chooser_callback_impl.h"
29 #include "ohos_nweb/bridge/ark_web_date_time_chooser_impl.h"
30 #include "ohos_nweb/bridge/ark_web_drag_data_impl.h"
31 #include "ohos_nweb/bridge/ark_web_file_selector_params_impl.h"
32 #include "ohos_nweb/bridge/ark_web_first_meaningful_paint_details_impl.h"
33 #include "ohos_nweb/bridge/ark_web_full_screen_exit_handler_impl.h"
34 #include "ohos_nweb/bridge/ark_web_geo_location_callback_impl.h"
35 #include "ohos_nweb/bridge/ark_web_image_options_impl.h"
36 #include "ohos_nweb/bridge/ark_web_js_dialog_result_impl.h"
37 #include "ohos_nweb/bridge/ark_web_js_http_auth_result_impl.h"
38 #include "ohos_nweb/bridge/ark_web_js_ssl_error_result_impl.h"
39 #include "ohos_nweb/bridge/ark_web_js_ssl_select_cert_result_impl.h"
40 #include "ohos_nweb/bridge/ark_web_key_event_impl.h"
41 #include "ohos_nweb/bridge/ark_web_largest_contentful_paint_details_impl.h"
42 #include "ohos_nweb/bridge/ark_web_load_committed_details_impl.h"
43 #include "ohos_nweb/bridge/ark_web_native_embed_data_info_impl.h"
44 #include "ohos_nweb/bridge/ark_web_native_embed_touch_event_impl.h"
45 #include "ohos_nweb/bridge/ark_web_native_embed_mouse_event_impl.h"
46 #include "ohos_nweb/bridge/ark_web_nweb_impl.h"
47 #include "ohos_nweb/bridge/ark_web_quick_menu_callback_impl.h"
48 #include "ohos_nweb/bridge/ark_web_quick_menu_params_impl.h"
49 #include "ohos_nweb/bridge/ark_web_screen_capture_access_request_impl.h"
50 #include "ohos_nweb/bridge/ark_web_select_popup_menu_callback_impl.h"
51 #include "ohos_nweb/bridge/ark_web_select_popup_menu_param_impl.h"
52 #include "ohos_nweb/bridge/ark_web_string_vector_value_callback_impl.h"
53 #include "ohos_nweb/bridge/ark_web_touch_handle_hot_zone_impl.h"
54 #include "ohos_nweb/bridge/ark_web_touch_handle_state_impl.h"
55 #include "ohos_nweb/bridge/ark_web_url_resource_error_impl.h"
56 #include "ohos_nweb/bridge/ark_web_url_resource_request_impl.h"
57 #include "ohos_nweb/bridge/ark_web_url_resource_response_impl.h"
58 #include "ohos_nweb/cpptoc/ark_web_date_time_suggestion_vector_cpptoc.h"
59 
60 #include "base/bridge/ark_web_bridge_macros.h"
61 
62 namespace OHOS::ArkWeb {
63 
ArkWebHandlerWrapper(ArkWebRefPtr<ArkWebHandler> ark_web_handler)64 ArkWebHandlerWrapper::ArkWebHandlerWrapper(ArkWebRefPtr<ArkWebHandler> ark_web_handler)
65     : ark_web_handler_(ark_web_handler)
66 {}
67 
SetNWeb(std::shared_ptr<OHOS::NWeb::NWeb> nweb)68 void ArkWebHandlerWrapper::SetNWeb(std::shared_ptr<OHOS::NWeb::NWeb> nweb)
69 {
70     if (CHECK_SHARED_PTR_IS_NULL(nweb)) {
71         ark_web_handler_->SetNWeb(nullptr);
72         return;
73     }
74 
75     ark_web_handler_->SetNWeb(new ArkWebNWebImpl(nweb));
76 }
77 
OnFocus()78 bool ArkWebHandlerWrapper::OnFocus()
79 {
80     return ark_web_handler_->OnFocus();
81 }
82 
OnMessage(const std::string & param)83 void ArkWebHandlerWrapper::OnMessage(const std::string& param)
84 {
85     ArkWebString stParam = ArkWebStringClassToStruct(param);
86 
87     ark_web_handler_->OnMessage(stParam);
88 
89     ArkWebStringStructRelease(stParam);
90 }
91 
OnResource(const std::string & url)92 void ArkWebHandlerWrapper::OnResource(const std::string& url)
93 {
94     ArkWebString stUrl = ArkWebStringClassToStruct(url);
95 
96     ark_web_handler_->OnResource(stUrl);
97 
98     ArkWebStringStructRelease(stUrl);
99 }
100 
OnPageIcon(const void * data,size_t width,size_t height,ArkWebImageColorType color_type,ArkWebImageAlphaType alpha_type)101 void ArkWebHandlerWrapper::OnPageIcon(
102     const void* data, size_t width, size_t height, ArkWebImageColorType color_type, ArkWebImageAlphaType alpha_type)
103 {
104     ark_web_handler_->OnPageIcon(data, width, height, static_cast<int>(color_type), static_cast<int>(alpha_type));
105 }
106 
OnPageTitle(const std::string & title)107 void ArkWebHandlerWrapper::OnPageTitle(const std::string& title)
108 {
109     ArkWebString stTitle = ArkWebStringClassToStruct(title);
110 
111     ark_web_handler_->OnPageTitle(stTitle);
112 
113     ArkWebStringStructRelease(stTitle);
114 }
115 
OnProxyDied()116 void ArkWebHandlerWrapper::OnProxyDied()
117 {
118     ark_web_handler_->OnProxyDied();
119 }
120 
OnHttpError(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,std::shared_ptr<OHOS::NWeb::NWebUrlResourceResponse> response)121 void ArkWebHandlerWrapper::OnHttpError(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,
122     std::shared_ptr<OHOS::NWeb::NWebUrlResourceResponse> response)
123 {
124     ArkWebRefPtr<ArkWebUrlResourceRequest> ark_web_request = nullptr;
125     if (!CHECK_SHARED_PTR_IS_NULL(request)) {
126         ark_web_request = new ArkWebUrlResourceRequestImpl(request);
127     }
128 
129     ArkWebRefPtr<ArkWebUrlResourceResponse> ark_web_response = nullptr;
130     if (!CHECK_SHARED_PTR_IS_NULL(response)) {
131         ark_web_response = new ArkWebUrlResourceResponseImpl(response);
132     }
133 
134     ark_web_handler_->OnHttpError(ark_web_request, ark_web_response);
135 }
136 
OnConsoleLog(std::shared_ptr<OHOS::NWeb::NWebConsoleLog> console_log)137 bool ArkWebHandlerWrapper::OnConsoleLog(std::shared_ptr<OHOS::NWeb::NWebConsoleLog> console_log)
138 {
139     if (CHECK_SHARED_PTR_IS_NULL(console_log)) {
140         return ark_web_handler_->OnConsoleLog(nullptr);
141     }
142 
143     return ark_web_handler_->OnConsoleLog(new ArkWebConsoleLogImpl(console_log));
144 }
145 
OnRouterPush(const std::string & param)146 void ArkWebHandlerWrapper::OnRouterPush(const std::string& param)
147 {
148     ArkWebString stParam = ArkWebStringClassToStruct(param);
149 
150     ark_web_handler_->OnRouterPush(stParam);
151 
152     ArkWebStringStructRelease(stParam);
153 }
154 
OnPageLoadEnd(int http_status_code,const std::string & url)155 void ArkWebHandlerWrapper::OnPageLoadEnd(int http_status_code, const std::string& url)
156 {
157     ArkWebString stUrl = ArkWebStringClassToStruct(url);
158 
159     ark_web_handler_->OnPageLoadEnd(http_status_code, stUrl);
160 
161     ArkWebStringStructRelease(stUrl);
162 }
163 
OnPageLoadBegin(const std::string & url)164 void ArkWebHandlerWrapper::OnPageLoadBegin(const std::string& url)
165 {
166     ArkWebString stUrl = ArkWebStringClassToStruct(url);
167 
168     ark_web_handler_->OnPageLoadBegin(stUrl);
169 
170     ArkWebStringStructRelease(stUrl);
171 }
172 
OnPageLoadError(int error_code,const std::string & description,const std::string & url)173 void ArkWebHandlerWrapper::OnPageLoadError(int error_code, const std::string& description, const std::string& url)
174 {
175     ArkWebString stUrl = ArkWebStringClassToStruct(url);
176     ArkWebString stDescription = ArkWebStringClassToStruct(description);
177 
178     ark_web_handler_->OnPageLoadError(error_code, stDescription, stUrl);
179 
180     ArkWebStringStructRelease(stUrl);
181     ArkWebStringStructRelease(stDescription);
182 }
183 
OnDesktopIconUrl(const std::string & icon_url,bool precomposed)184 void ArkWebHandlerWrapper::OnDesktopIconUrl(const std::string& icon_url, bool precomposed)
185 {
186     ArkWebString stIconUrl = ArkWebStringClassToStruct(icon_url);
187 
188     ark_web_handler_->OnDesktopIconUrl(stIconUrl, precomposed);
189 
190     ArkWebStringStructRelease(stIconUrl);
191 }
192 
OnLoadingProgress(int new_progress)193 void ArkWebHandlerWrapper::OnLoadingProgress(int new_progress)
194 {
195     ark_web_handler_->OnLoadingProgress(new_progress);
196 }
197 
OnGeolocationShow(const std::string & origin,std::shared_ptr<OHOS::NWeb::NWebGeolocationCallbackInterface> callback)198 void ArkWebHandlerWrapper::OnGeolocationShow(
199     const std::string& origin, std::shared_ptr<OHOS::NWeb::NWebGeolocationCallbackInterface> callback)
200 {
201     ArkWebString stOrigin = ArkWebStringClassToStruct(origin);
202 
203     if (CHECK_SHARED_PTR_IS_NULL(callback)) {
204         ark_web_handler_->OnGeolocationShow(stOrigin, nullptr);
205     } else {
206         ark_web_handler_->OnGeolocationShow(stOrigin, new ArkWebGeoLocationCallbackImpl(callback));
207     }
208 
209     ArkWebStringStructRelease(stOrigin);
210 }
211 
OnGeolocationHide()212 void ArkWebHandlerWrapper::OnGeolocationHide()
213 {
214     ark_web_handler_->OnGeolocationHide();
215 }
216 
OnFileSelectorShow(std::shared_ptr<OHOS::NWeb::NWebStringVectorValueCallback> callback,std::shared_ptr<OHOS::NWeb::NWebFileSelectorParams> params)217 bool ArkWebHandlerWrapper::OnFileSelectorShow(std::shared_ptr<OHOS::NWeb::NWebStringVectorValueCallback> callback,
218     std::shared_ptr<OHOS::NWeb::NWebFileSelectorParams> params)
219 {
220     ArkWebRefPtr<ArkWebStringVectorValueCallback> ark_web_callback = nullptr;
221     if (!CHECK_SHARED_PTR_IS_NULL(callback)) {
222         ark_web_callback = new ArkWebStringVectorValueCallbackImpl(callback);
223     }
224 
225     ArkWebRefPtr<ArkWebFileSelectorParams> ark_web_params = nullptr;
226     if (!CHECK_SHARED_PTR_IS_NULL(params)) {
227         ark_web_params = new ArkWebFileSelectorParamsImpl(params);
228     }
229 
230     return ark_web_handler_->OnFileSelectorShow(ark_web_callback, ark_web_params);
231 }
232 
OnResourceLoadError(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,std::shared_ptr<OHOS::NWeb::NWebUrlResourceError> error)233 void ArkWebHandlerWrapper::OnResourceLoadError(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,
234     std::shared_ptr<OHOS::NWeb::NWebUrlResourceError> error)
235 {
236     ArkWebRefPtr<ArkWebUrlResourceRequest> ark_web_request = nullptr;
237     if (!CHECK_SHARED_PTR_IS_NULL(request)) {
238         ark_web_request = new ArkWebUrlResourceRequestImpl(request);
239     }
240 
241     ArkWebRefPtr<ArkWebUrlResourceError> ark_web_error = nullptr;
242     if (!CHECK_SHARED_PTR_IS_NULL(error)) {
243         ark_web_error = new ArkWebUrlResourceErrorImpl(error);
244     }
245 
246     ark_web_handler_->OnResourceLoadError(ark_web_request, ark_web_error);
247 }
248 
OnPermissionRequest(std::shared_ptr<OHOS::NWeb::NWebAccessRequest> request)249 void ArkWebHandlerWrapper::OnPermissionRequest(std::shared_ptr<OHOS::NWeb::NWebAccessRequest> request)
250 {
251     if (CHECK_SHARED_PTR_IS_NULL(request)) {
252         ark_web_handler_->OnPermissionRequest(nullptr);
253         return;
254     }
255 
256     ark_web_handler_->OnPermissionRequest(new ArkWebAccessRequestImpl(request));
257 }
258 
OnQuickMenuDismissed()259 void ArkWebHandlerWrapper::OnQuickMenuDismissed()
260 {
261     ark_web_handler_->OnQuickMenuDismissed();
262 }
263 
OnContextMenuDismissed()264 void ArkWebHandlerWrapper::OnContextMenuDismissed()
265 {
266     ark_web_handler_->OnContextMenuDismissed();
267 }
268 
OnTouchSelectionChanged(std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> insert_handle,std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> start_selection_handle,std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> end_selection_handle)269 void ArkWebHandlerWrapper::OnTouchSelectionChanged(std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> insert_handle,
270     std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> start_selection_handle,
271     std::shared_ptr<OHOS::NWeb::NWebTouchHandleState> end_selection_handle)
272 {
273     ArkWebRefPtr<ArkWebTouchHandleState> ark_web_insert_handle = nullptr;
274     if (!CHECK_SHARED_PTR_IS_NULL(insert_handle)) {
275         ark_web_insert_handle = new ArkWebTouchHandleStateImpl(insert_handle);
276     }
277 
278     ArkWebRefPtr<ArkWebTouchHandleState> ark_web_start_selection_handle = nullptr;
279     if (!CHECK_SHARED_PTR_IS_NULL(start_selection_handle)) {
280         ark_web_start_selection_handle = new ArkWebTouchHandleStateImpl(start_selection_handle);
281     }
282 
283     ArkWebRefPtr<ArkWebTouchHandleState> ark_web_end_selection_handle = nullptr;
284     if (!CHECK_SHARED_PTR_IS_NULL(end_selection_handle)) {
285         ark_web_end_selection_handle = new ArkWebTouchHandleStateImpl(end_selection_handle);
286     }
287 
288     ark_web_handler_->OnTouchSelectionChanged(
289         ark_web_insert_handle, ark_web_start_selection_handle, ark_web_end_selection_handle);
290 }
291 
OnHandleInterceptRequest(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,std::shared_ptr<OHOS::NWeb::NWebUrlResourceResponse> response)292 bool ArkWebHandlerWrapper::OnHandleInterceptRequest(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,
293     std::shared_ptr<OHOS::NWeb::NWebUrlResourceResponse> response)
294 {
295     ArkWebRefPtr<ArkWebUrlResourceRequest> ark_web_request = nullptr;
296     if (!CHECK_SHARED_PTR_IS_NULL(request)) {
297         ark_web_request = new ArkWebUrlResourceRequestImpl(request);
298     }
299 
300     ArkWebRefPtr<ArkWebUrlResourceResponse> ark_web_response = nullptr;
301     if (!CHECK_SHARED_PTR_IS_NULL(response)) {
302         ark_web_response = new ArkWebUrlResourceResponseImpl(response);
303     }
304 
305     return ark_web_handler_->OnHandleInterceptRequest(ark_web_request, ark_web_response);
306 }
307 
OnRefreshAccessedHistory(const std::string & url,bool is_reload)308 void ArkWebHandlerWrapper::OnRefreshAccessedHistory(const std::string& url, bool is_reload)
309 {
310     ArkWebString stUrl = ArkWebStringClassToStruct(url);
311 
312     ark_web_handler_->OnRefreshAccessedHistory(stUrl, is_reload);
313 
314     ArkWebStringStructRelease(stUrl);
315 }
316 
OnPermissionRequestCanceled(std::shared_ptr<OHOS::NWeb::NWebAccessRequest> request)317 void ArkWebHandlerWrapper::OnPermissionRequestCanceled(std::shared_ptr<OHOS::NWeb::NWebAccessRequest> request)
318 {
319     if (CHECK_SHARED_PTR_IS_NULL(request)) {
320         ark_web_handler_->OnPermissionRequestCanceled(nullptr);
321         return;
322     }
323 
324     ark_web_handler_->OnPermissionRequestCanceled(new ArkWebAccessRequestImpl(request));
325 }
326 
OnHandleInterceptUrlLoading(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request)327 bool ArkWebHandlerWrapper::OnHandleInterceptUrlLoading(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request)
328 {
329     if (CHECK_SHARED_PTR_IS_NULL(request)) {
330         return ark_web_handler_->OnHandleInterceptUrlLoading(nullptr);
331     }
332 
333     return ark_web_handler_->OnHandleInterceptUrlLoading(new ArkWebUrlResourceRequestImpl(request));
334 }
335 
RunQuickMenu(std::shared_ptr<OHOS::NWeb::NWebQuickMenuParams> params,std::shared_ptr<OHOS::NWeb::NWebQuickMenuCallback> callback)336 bool ArkWebHandlerWrapper::RunQuickMenu(std::shared_ptr<OHOS::NWeb::NWebQuickMenuParams> params,
337     std::shared_ptr<OHOS::NWeb::NWebQuickMenuCallback> callback)
338 {
339     ArkWebRefPtr<ArkWebQuickMenuParams> ark_web_params = nullptr;
340     if (!CHECK_SHARED_PTR_IS_NULL(params)) {
341         ark_web_params = new ArkWebQuickMenuParamsImpl(params);
342     }
343 
344     ArkWebRefPtr<ArkWebQuickMenuCallback> ark_web_callback = nullptr;
345     if (!CHECK_SHARED_PTR_IS_NULL(callback)) {
346         ark_web_callback = new ArkWebQuickMenuCallbackImpl(callback);
347     }
348 
349     return ark_web_handler_->RunQuickMenu(ark_web_params, ark_web_callback);
350 }
351 
RunContextMenu(std::shared_ptr<OHOS::NWeb::NWebContextMenuParams> params,std::shared_ptr<OHOS::NWeb::NWebContextMenuCallback> callback)352 bool ArkWebHandlerWrapper::RunContextMenu(std::shared_ptr<OHOS::NWeb::NWebContextMenuParams> params,
353     std::shared_ptr<OHOS::NWeb::NWebContextMenuCallback> callback)
354 {
355     ArkWebRefPtr<ArkWebContextMenuParams> ark_web_params = nullptr;
356     if (!CHECK_SHARED_PTR_IS_NULL(params)) {
357         ark_web_params = new ArkWebContextMenuParamsImpl(params);
358     }
359 
360     ArkWebRefPtr<ArkWebContextMenuCallback> ark_web_callback = nullptr;
361     if (!CHECK_SHARED_PTR_IS_NULL(callback)) {
362         ark_web_callback = new ArkWebContextMenuCallbackImpl(callback);
363     }
364 
365     return ark_web_handler_->RunContextMenu(ark_web_params, ark_web_callback);
366 }
367 
UpdateDragCursor(ArkWebDragOperation op)368 void ArkWebHandlerWrapper::UpdateDragCursor(ArkWebDragOperation op)
369 {
370     ark_web_handler_->UpdateDragCursor(static_cast<unsigned char>(op));
371 }
372 
FilterScrollEvent(const float x,const float y,const float x_velocity,const float y_velocity)373 bool ArkWebHandlerWrapper::FilterScrollEvent(
374     const float x, const float y, const float x_velocity, const float y_velocity)
375 {
376     return ark_web_handler_->FilterScrollEvent(x, y, x_velocity, y_velocity);
377 }
378 
VisitedUrlHistory()379 std::vector<std::string> ArkWebHandlerWrapper::VisitedUrlHistory()
380 {
381     ArkWebStringVector stUrlHistory = ark_web_handler_->VisitedUrlHistory();
382 
383     std::vector<std::string> objUrlHistory = ArkWebStringVectorStructToClass(stUrlHistory);
384     ArkWebStringVectorStructRelease(stUrlHistory);
385     return objUrlHistory;
386 }
387 
OnWindowNewByJS(const std::string & target_url,bool is_alert,bool is_user_trigger,std::shared_ptr<OHOS::NWeb::NWebControllerHandler> handler)388 void ArkWebHandlerWrapper::OnWindowNewByJS(const std::string& target_url, bool is_alert, bool is_user_trigger,
389     std::shared_ptr<OHOS::NWeb::NWebControllerHandler> handler)
390 {
391     ArkWebString stTargetUrl = ArkWebStringClassToStruct(target_url);
392 
393     if (CHECK_SHARED_PTR_IS_NULL(handler)) {
394         ark_web_handler_->OnWindowNewByJS(stTargetUrl, is_alert, is_user_trigger, nullptr);
395     } else {
396         ark_web_handler_->OnWindowNewByJS(
397             stTargetUrl, is_alert, is_user_trigger, new ArkWebControllerHandlerImpl(handler));
398     }
399 
400     ArkWebStringStructRelease(stTargetUrl);
401 }
402 
OnWindowExitByJS()403 void ArkWebHandlerWrapper::OnWindowExitByJS()
404 {
405     ark_web_handler_->OnWindowExitByJS();
406 }
407 
OnAlertDialogByJS(const std::string & url,const std::string & message,std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)408 bool ArkWebHandlerWrapper::OnAlertDialogByJS(
409     const std::string& url, const std::string& message, std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)
410 {
411     ArkWebString stUrl = ArkWebStringClassToStruct(url);
412     ArkWebString stMessage = ArkWebStringClassToStruct(message);
413 
414     bool flag = false;
415     if (CHECK_SHARED_PTR_IS_NULL(result)) {
416         flag = ark_web_handler_->OnAlertDialogByJS(stUrl, stMessage, nullptr);
417     } else {
418         flag = ark_web_handler_->OnAlertDialogByJS(stUrl, stMessage, new ArkWebJsDialogResultImpl(result));
419     }
420 
421     ArkWebStringStructRelease(stUrl);
422     ArkWebStringStructRelease(stMessage);
423     return flag;
424 }
425 
OnBeforeUnloadByJS(const std::string & url,const std::string & message,std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)426 bool ArkWebHandlerWrapper::OnBeforeUnloadByJS(
427     const std::string& url, const std::string& message, std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)
428 {
429     ArkWebString stUrl = ArkWebStringClassToStruct(url);
430     ArkWebString stMessage = ArkWebStringClassToStruct(message);
431 
432     bool flag = false;
433     if (CHECK_SHARED_PTR_IS_NULL(result)) {
434         flag = ark_web_handler_->OnBeforeUnloadByJS(stUrl, stMessage, nullptr);
435     } else {
436         flag = ark_web_handler_->OnBeforeUnloadByJS(stUrl, stMessage, new ArkWebJsDialogResultImpl(result));
437     }
438 
439     ArkWebStringStructRelease(stUrl);
440     ArkWebStringStructRelease(stMessage);
441     return flag;
442 }
443 
OnPromptDialogByJS(const std::string & url,const std::string & message,const std::string & default_value,std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)444 bool ArkWebHandlerWrapper::OnPromptDialogByJS(const std::string& url, const std::string& message,
445     const std::string& default_value, std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)
446 {
447     ArkWebString stUrl = ArkWebStringClassToStruct(url);
448     ArkWebString stMessage = ArkWebStringClassToStruct(message);
449     ArkWebString stDefaultValue = ArkWebStringClassToStruct(default_value);
450 
451     bool flag = false;
452     if (CHECK_SHARED_PTR_IS_NULL(result)) {
453         flag = ark_web_handler_->OnPromptDialogByJS(stUrl, stMessage, stDefaultValue, nullptr);
454     } else {
455         flag = ark_web_handler_->OnPromptDialogByJS(
456             stUrl, stMessage, stDefaultValue, new ArkWebJsDialogResultImpl(result));
457     }
458 
459     ArkWebStringStructRelease(stUrl);
460     ArkWebStringStructRelease(stMessage);
461     ArkWebStringStructRelease(stDefaultValue);
462     return flag;
463 }
464 
OnConfirmDialogByJS(const std::string & url,const std::string & message,std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)465 bool ArkWebHandlerWrapper::OnConfirmDialogByJS(
466     const std::string& url, const std::string& message, std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)
467 {
468     ArkWebString stUrl = ArkWebStringClassToStruct(url);
469     ArkWebString stMessage = ArkWebStringClassToStruct(message);
470 
471     bool flag = false;
472     if (CHECK_SHARED_PTR_IS_NULL(result)) {
473         flag = ark_web_handler_->OnConfirmDialogByJS(stUrl, stMessage, nullptr);
474     } else {
475         flag = ark_web_handler_->OnConfirmDialogByJS(stUrl, stMessage, new ArkWebJsDialogResultImpl(result));
476     }
477 
478     ArkWebStringStructRelease(stUrl);
479     ArkWebStringStructRelease(stMessage);
480     return flag;
481 }
482 
OnHttpAuthRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSHttpAuthResult> result,const std::string & host,const std::string & realm)483 bool ArkWebHandlerWrapper::OnHttpAuthRequestByJS(
484     std::shared_ptr<OHOS::NWeb::NWebJSHttpAuthResult> result, const std::string& host, const std::string& realm)
485 {
486     ArkWebString stHost = ArkWebStringClassToStruct(host);
487     ArkWebString stRealm = ArkWebStringClassToStruct(realm);
488 
489     bool flag = false;
490     if (CHECK_SHARED_PTR_IS_NULL(result)) {
491         flag = ark_web_handler_->OnHttpAuthRequestByJS(nullptr, stHost, stRealm);
492     } else {
493         flag = ark_web_handler_->OnHttpAuthRequestByJS(new ArkWebJsHttpAuthResultImpl(result), stHost, stRealm);
494     }
495 
496     ArkWebStringStructRelease(stHost);
497     ArkWebStringStructRelease(stRealm);
498     return flag;
499 }
500 
OnSslErrorRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSSslErrorResult> result,ArkWebSslError error)501 bool ArkWebHandlerWrapper::OnSslErrorRequestByJS(
502     std::shared_ptr<OHOS::NWeb::NWebJSSslErrorResult> result, ArkWebSslError error)
503 {
504     if (CHECK_SHARED_PTR_IS_NULL(result)) {
505         return ark_web_handler_->OnSslErrorRequestByJS(nullptr, static_cast<int>(error));
506     }
507 
508     return ark_web_handler_->OnSslErrorRequestByJS(new ArkWebJsSslErrorResultImpl(result), static_cast<int>(error));
509 }
510 
OnSslSelectCertRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSSslSelectCertResult> result,const std::string & host,int port,const std::vector<std::string> & key_types,const std::vector<std::string> & issuers)511 bool ArkWebHandlerWrapper::OnSslSelectCertRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSSslSelectCertResult> result,
512     const std::string& host, int port, const std::vector<std::string>& key_types,
513     const std::vector<std::string>& issuers)
514 {
515     ArkWebString stHost = ArkWebStringClassToStruct(host);
516     ArkWebStringVector stIssuers = ArkWebStringVectorClassToStruct(issuers);
517     ArkWebStringVector stKeyTypes = ArkWebStringVectorClassToStruct(key_types);
518 
519     bool flag = false;
520     if (CHECK_SHARED_PTR_IS_NULL(result)) {
521         flag = ark_web_handler_->OnSslSelectCertRequestByJS(nullptr, stHost, port, stKeyTypes, stIssuers);
522     } else {
523         flag = ark_web_handler_->OnSslSelectCertRequestByJS(
524             new ArkWebJsSslSelectCertResultImpl(result), stHost, port, stKeyTypes, stIssuers);
525     }
526 
527     ArkWebStringStructRelease(stHost);
528     ArkWebStringVectorStructRelease(stIssuers);
529     ArkWebStringVectorStructRelease(stKeyTypes);
530     return flag;
531 }
532 
OnScroll(double x_offset,double y_offset)533 void ArkWebHandlerWrapper::OnScroll(double x_offset, double y_offset)
534 {
535     ark_web_handler_->OnScroll(x_offset, y_offset);
536 }
537 
OnOverScroll(float x_offset,float y_offset)538 void ArkWebHandlerWrapper::OnOverScroll(float x_offset, float y_offset)
539 {
540     ark_web_handler_->OnOverScroll(x_offset, y_offset);
541 }
542 
OnScrollState(bool scroll_state)543 void ArkWebHandlerWrapper::OnScrollState(bool scroll_state)
544 {
545     ark_web_handler_->OnScrollState(scroll_state);
546 }
547 
OnPageVisible(const std::string & url)548 void ArkWebHandlerWrapper::OnPageVisible(const std::string& url)
549 {
550     ArkWebString stUrl = ArkWebStringClassToStruct(url);
551 
552     ark_web_handler_->OnPageVisible(stUrl);
553 
554     ArkWebStringStructRelease(stUrl);
555 }
556 
OnPreKeyEvent(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)557 bool ArkWebHandlerWrapper::OnPreKeyEvent(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)
558 {
559     if (CHECK_SHARED_PTR_IS_NULL(event)) {
560         return ark_web_handler_->OnPreKeyEvent(nullptr);
561     }
562 
563     return ark_web_handler_->OnPreKeyEvent(new ArkWebKeyEventImpl(event));
564 }
565 
OnScaleChanged(float old_scale_factor,float new_scale_factor)566 void ArkWebHandlerWrapper::OnScaleChanged(float old_scale_factor, float new_scale_factor)
567 {
568     ark_web_handler_->OnScaleChanged(old_scale_factor, new_scale_factor);
569 }
570 
OnCursorChange(const ArkWebCursorType & type,std::shared_ptr<OHOS::NWeb::NWebCursorInfo> info)571 bool ArkWebHandlerWrapper::OnCursorChange(
572     const ArkWebCursorType& type, std::shared_ptr<OHOS::NWeb::NWebCursorInfo> info)
573 {
574     if (CHECK_SHARED_PTR_IS_NULL(info)) {
575         return ark_web_handler_->OnCursorChange(static_cast<int32_t>(type), nullptr);
576     }
577 
578     return ark_web_handler_->OnCursorChange(static_cast<int32_t>(type), new ArkWebCursorInfoImpl(info));
579 }
580 
OnRenderExited(ArkWebRenderExitReason reason)581 void ArkWebHandlerWrapper::OnRenderExited(ArkWebRenderExitReason reason)
582 {
583     ark_web_handler_->OnRenderExited(static_cast<int>(reason));
584 }
585 
OnResizeNotWork()586 void ArkWebHandlerWrapper::OnResizeNotWork()
587 {
588     ark_web_handler_->OnResizeNotWork();
589 }
590 
OnFullScreenExit()591 void ArkWebHandlerWrapper::OnFullScreenExit()
592 {
593     ark_web_handler_->OnFullScreenExit();
594 }
595 
OnFullScreenEnter(std::shared_ptr<OHOS::NWeb::NWebFullScreenExitHandler> handler)596 void ArkWebHandlerWrapper::OnFullScreenEnter(std::shared_ptr<OHOS::NWeb::NWebFullScreenExitHandler> handler)
597 {
598     if (CHECK_SHARED_PTR_IS_NULL(handler)) {
599         ark_web_handler_->OnFullScreenEnter(nullptr);
600         return;
601     }
602 
603     ark_web_handler_->OnFullScreenEnter(new ArkWebFullScreenExitHandlerImpl(handler));
604 }
605 
OnDragAndDropData(const void * data,size_t len,std::shared_ptr<OHOS::NWeb::NWebImageOptions> opt)606 bool ArkWebHandlerWrapper::OnDragAndDropData(
607     const void* data, size_t len, std::shared_ptr<OHOS::NWeb::NWebImageOptions> opt)
608 {
609     if (CHECK_SHARED_PTR_IS_NULL(opt)) {
610         return ark_web_handler_->OnDragAndDropData(data, len, nullptr);
611     }
612 
613     return ark_web_handler_->OnDragAndDropData(data, len, new ArkWebImageOptionsImpl(opt));
614 }
615 
OnSelectPopupMenu(std::shared_ptr<OHOS::NWeb::NWebSelectPopupMenuParam> params,std::shared_ptr<OHOS::NWeb::NWebSelectPopupMenuCallback> callback)616 void ArkWebHandlerWrapper::OnSelectPopupMenu(std::shared_ptr<OHOS::NWeb::NWebSelectPopupMenuParam> params,
617     std::shared_ptr<OHOS::NWeb::NWebSelectPopupMenuCallback> callback)
618 {
619     ArkWebRefPtr<ArkWebSelectPopupMenuParam> ark_web_params = nullptr;
620     if (!CHECK_SHARED_PTR_IS_NULL(params)) {
621         ark_web_params = new ArkWebSelectPopupMenuParamImpl(params);
622     }
623 
624     ArkWebRefPtr<ArkWebSelectPopupMenuCallback> ark_web_callback = nullptr;
625     if (!CHECK_SHARED_PTR_IS_NULL(callback)) {
626         ark_web_callback = new ArkWebSelectPopupMenuCallbackImpl(callback);
627     }
628 
629     ark_web_handler_->OnSelectPopupMenu(ark_web_params, ark_web_callback);
630 }
631 
OnDataResubmission(std::shared_ptr<OHOS::NWeb::NWebDataResubmissionCallback> handler)632 void ArkWebHandlerWrapper::OnDataResubmission(std::shared_ptr<OHOS::NWeb::NWebDataResubmissionCallback> handler)
633 {
634     if (CHECK_SHARED_PTR_IS_NULL(handler)) {
635         ark_web_handler_->OnDataResubmission(nullptr);
636         return;
637     }
638 
639     ark_web_handler_->OnDataResubmission(new ArkWebDataResubmissionCallbackImpl(handler));
640 }
641 
OnRootLayerChanged(int width,int height)642 void ArkWebHandlerWrapper::OnRootLayerChanged(int width, int height)
643 {
644     ark_web_handler_->OnRootLayerChanged(width, height);
645 }
646 
OnAudioStateChanged(bool playing)647 void ArkWebHandlerWrapper::OnAudioStateChanged(bool playing)
648 {
649     ark_web_handler_->OnAudioStateChanged(playing);
650 }
651 
OnOverScrollFlingEnd()652 void ArkWebHandlerWrapper::OnOverScrollFlingEnd()
653 {
654     ark_web_handler_->OnOverScrollFlingEnd();
655 }
656 
OnUnProcessedKeyEvent(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)657 bool ArkWebHandlerWrapper::OnUnProcessedKeyEvent(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)
658 {
659     if (CHECK_SHARED_PTR_IS_NULL(event)) {
660         return ark_web_handler_->OnUnProcessedKeyEvent(nullptr);
661     }
662 
663     return ark_web_handler_->OnUnProcessedKeyEvent(new ArkWebKeyEventImpl(event));
664 }
665 
OnDragAndDropDataUdmf(std::shared_ptr<OHOS::NWeb::NWebDragData> drag_data)666 bool ArkWebHandlerWrapper::OnDragAndDropDataUdmf(std::shared_ptr<OHOS::NWeb::NWebDragData> drag_data)
667 {
668     if (CHECK_SHARED_PTR_IS_NULL(drag_data)) {
669         return ark_web_handler_->OnDragAndDropDataUdmf(nullptr);
670     }
671 
672     return ark_web_handler_->OnDragAndDropDataUdmf(new ArkWebDragDataImpl(drag_data));
673 }
674 
OnFirstContentfulPaint(int64_t navigation_start_tick,int64_t first_contentful_paint_ms)675 void ArkWebHandlerWrapper::OnFirstContentfulPaint(int64_t navigation_start_tick, int64_t first_contentful_paint_ms)
676 {
677     ark_web_handler_->OnFirstContentfulPaint(navigation_start_tick, first_contentful_paint_ms);
678 }
679 
OnDateTimeChooserPopup(std::shared_ptr<OHOS::NWeb::NWebDateTimeChooser> chooser,const std::vector<std::shared_ptr<OHOS::NWeb::NWebDateTimeSuggestion>> & suggestions,std::shared_ptr<OHOS::NWeb::NWebDateTimeChooserCallback> callback)680 void ArkWebHandlerWrapper::OnDateTimeChooserPopup(std::shared_ptr<OHOS::NWeb::NWebDateTimeChooser> chooser,
681     const std::vector<std::shared_ptr<OHOS::NWeb::NWebDateTimeSuggestion>>& suggestions,
682     std::shared_ptr<OHOS::NWeb::NWebDateTimeChooserCallback> callback)
683 {
684     ArkWebDateTimeSuggestionVector st_date_time_suggestion_vector =
685         ArkWebDateTimeSuggestionVectorClassToStruct(suggestions);
686 
687     ArkWebRefPtr<ArkWebDateTimeChooser> ark_web_date_time_chooser = nullptr;
688     if (!CHECK_SHARED_PTR_IS_NULL(chooser)) {
689         ark_web_date_time_chooser = new ArkWebDateTimeChooserImpl(chooser);
690     }
691 
692     ArkWebRefPtr<ArkWebDateTimeChooserCallback> ark_web_date_time_chooser_callback = nullptr;
693     if (!CHECK_SHARED_PTR_IS_NULL(callback)) {
694         ark_web_date_time_chooser_callback = new ArkWebDateTimeChooserCallbackImpl(callback);
695     }
696 
697     ark_web_handler_->OnDateTimeChooserPopup(
698         ark_web_date_time_chooser, st_date_time_suggestion_vector, ark_web_date_time_chooser_callback);
699 
700     ArkWebDateTimeSuggestionVectorStructRelease(st_date_time_suggestion_vector);
701 }
702 
OnDateTimeChooserClose()703 void ArkWebHandlerWrapper::OnDateTimeChooserClose()
704 {
705     ark_web_handler_->OnDateTimeChooserClose();
706 }
707 
OnScreenCaptureRequest(std::shared_ptr<OHOS::NWeb::NWebScreenCaptureAccessRequest> request)708 void ArkWebHandlerWrapper::OnScreenCaptureRequest(std::shared_ptr<OHOS::NWeb::NWebScreenCaptureAccessRequest> request)
709 {
710     if (CHECK_SHARED_PTR_IS_NULL(request)) {
711         ark_web_handler_->OnScreenCaptureRequest(nullptr);
712         return;
713     }
714 
715     ark_web_handler_->OnScreenCaptureRequest(new ArkWebScreenCaptureAccessRequestImpl(request));
716 }
717 
OnActivityStateChanged(int state,ArkWebActivityType type)718 void ArkWebHandlerWrapper::OnActivityStateChanged(int state, ArkWebActivityType type)
719 {
720     ark_web_handler_->OnActivityStateChanged(state, static_cast<int>(type));
721 }
722 
OnGetTouchHandleHotZone(std::shared_ptr<OHOS::NWeb::NWebTouchHandleHotZone> hot_zone)723 void ArkWebHandlerWrapper::OnGetTouchHandleHotZone(std::shared_ptr<OHOS::NWeb::NWebTouchHandleHotZone> hot_zone)
724 {
725     if (CHECK_SHARED_PTR_IS_NULL(hot_zone)) {
726         ark_web_handler_->OnGetTouchHandleHotZone(nullptr);
727         return;
728     }
729 
730     ark_web_handler_->OnGetTouchHandleHotZone(new ArkWebTouchHandleHotZoneImpl(hot_zone));
731 }
732 
OnCompleteSwapWithNewSize()733 void ArkWebHandlerWrapper::OnCompleteSwapWithNewSize()
734 {
735     ark_web_handler_->OnCompleteSwapWithNewSize();
736 }
737 
OnOverScrollFlingVelocity(float x_velocity,float y_velocity,bool is_fling)738 void ArkWebHandlerWrapper::OnOverScrollFlingVelocity(float x_velocity, float y_velocity, bool is_fling)
739 {
740     ark_web_handler_->OnOverScrollFlingVelocity(x_velocity, y_velocity, is_fling);
741 }
742 
OnNavigationEntryCommitted(std::shared_ptr<OHOS::NWeb::NWebLoadCommittedDetails> details)743 void ArkWebHandlerWrapper::OnNavigationEntryCommitted(std::shared_ptr<OHOS::NWeb::NWebLoadCommittedDetails> details)
744 {
745     if (CHECK_SHARED_PTR_IS_NULL(details)) {
746         ark_web_handler_->OnNavigationEntryCommitted(nullptr);
747         return;
748     }
749 
750     ark_web_handler_->OnNavigationEntryCommitted(new ArkWebLoadCommittedDetailsImpl(details));
751 }
752 
OnNativeEmbedLifecycleChange(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedDataInfo> dataInfo)753 void ArkWebHandlerWrapper::OnNativeEmbedLifecycleChange(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedDataInfo> dataInfo)
754 {
755     if (CHECK_SHARED_PTR_IS_NULL(dataInfo)) {
756         ark_web_handler_->OnNativeEmbedLifecycleChange(nullptr);
757         return;
758     }
759 
760     ark_web_handler_->OnNativeEmbedLifecycleChange(new ArkWebNativeEmbedDataInfoImpl(dataInfo));
761 }
762 
OnNativeEmbedGestureEvent(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedTouchEvent> touchEvent)763 void ArkWebHandlerWrapper::OnNativeEmbedGestureEvent(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedTouchEvent> touchEvent)
764 {
765     if (CHECK_SHARED_PTR_IS_NULL(touchEvent)) {
766         ark_web_handler_->OnNativeEmbedGestureEvent(nullptr);
767         return;
768     }
769 
770     ark_web_handler_->OnNativeEmbedGestureEvent(new ArkWebNativeEmbedTouchEventImpl(touchEvent));
771 }
772 
OnSafeBrowsingCheckResult(int threat_type)773 void ArkWebHandlerWrapper::OnSafeBrowsingCheckResult(int threat_type)
774 {
775     ark_web_handler_->OnSafeBrowsingCheckResult(threat_type);
776 }
777 
OnFullScreenEnterWithVideoSize(std::shared_ptr<OHOS::NWeb::NWebFullScreenExitHandler> handler,int video_natural_width,int video_natural_height)778 void ArkWebHandlerWrapper::OnFullScreenEnterWithVideoSize(
779     std::shared_ptr<OHOS::NWeb::NWebFullScreenExitHandler> handler, int video_natural_width, int video_natural_height)
780 {
781     if (CHECK_SHARED_PTR_IS_NULL(handler)) {
782         ark_web_handler_->OnFullScreenEnterWithVideoSize(nullptr, video_natural_width, video_natural_height);
783         return;
784     }
785 
786     ark_web_handler_->OnFullScreenEnterWithVideoSize(
787         new ArkWebFullScreenExitHandlerImpl(handler), video_natural_width, video_natural_height);
788 }
789 
OnHandleOverrideUrlLoading(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request)790 bool ArkWebHandlerWrapper::OnHandleOverrideUrlLoading(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request)
791 {
792     if (CHECK_SHARED_PTR_IS_NULL(request)) {
793         return ark_web_handler_->OnHandleOverrideUrlLoading(nullptr);
794     }
795 
796     return ark_web_handler_->OnHandleOverrideUrlLoading(new ArkWebUrlResourceRequestImpl(request));
797 }
798 
OnIntelligentTrackingPreventionResult(const std::string & website_host,const std::string & tracker_host)799 void ArkWebHandlerWrapper::OnIntelligentTrackingPreventionResult(
800     const std::string& website_host, const std::string& tracker_host)
801 {
802     ArkWebString stWebsiteHost = ArkWebStringClassToStruct(website_host);
803     ArkWebString stTrackerHost = ArkWebStringClassToStruct(tracker_host);
804 
805     ark_web_handler_->OnIntelligentTrackingPreventionResult(stWebsiteHost, stTrackerHost);
806 
807     ArkWebStringStructRelease(stWebsiteHost);
808     ArkWebStringStructRelease(stTrackerHost);
809 }
810 
OnFirstMeaningfulPaint(std::shared_ptr<OHOS::NWeb::NWebFirstMeaningfulPaintDetails> details)811 void ArkWebHandlerWrapper::OnFirstMeaningfulPaint(std::shared_ptr<OHOS::NWeb::NWebFirstMeaningfulPaintDetails> details)
812 {
813     if (CHECK_SHARED_PTR_IS_NULL(details)) {
814         ark_web_handler_->OnFirstMeaningfulPaint(nullptr);
815         return;
816     }
817 
818     ark_web_handler_->OnFirstMeaningfulPaint(new ArkWebFirstMeaningfulPaintDetailsImpl(details));
819 }
820 
OnLargestContentfulPaint(std::shared_ptr<OHOS::NWeb::NWebLargestContentfulPaintDetails> details)821 void ArkWebHandlerWrapper::OnLargestContentfulPaint(
822     std::shared_ptr<OHOS::NWeb::NWebLargestContentfulPaintDetails> details)
823 {
824     if (CHECK_SHARED_PTR_IS_NULL(details)) {
825         ark_web_handler_->OnLargestContentfulPaint(nullptr);
826         return;
827     }
828 
829     ark_web_handler_->OnLargestContentfulPaint(new ArkWebLargestContentfulPaintDetailsImpl(details));
830 }
831 
OnAllSslErrorRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSAllSslErrorResult> result,ArkWebSslError error,const std::string & url,const std::string & originalUrl,const std::string & referrer,bool isFatalError,bool isMainFrame)832 bool ArkWebHandlerWrapper::OnAllSslErrorRequestByJS(std::shared_ptr<OHOS::NWeb::NWebJSAllSslErrorResult> result,
833     ArkWebSslError error, const std::string& url, const std::string& originalUrl, const std::string& referrer,
834     bool isFatalError, bool isMainFrame)
835 {
836     if (CHECK_SHARED_PTR_IS_NULL(result)) {
837         return ark_web_handler_->OnAllSslErrorRequestByJS(nullptr, static_cast<int>(error),
838             ArkWebStringClassToStruct(url), ArkWebStringClassToStruct(originalUrl), ArkWebStringClassToStruct(referrer),
839             isFatalError, isMainFrame);
840     }
841 
842     return ark_web_handler_->OnAllSslErrorRequestByJS(new ArkWebJsAllSslErrorResultImpl(result),
843         static_cast<int>(error), ArkWebStringClassToStruct(url), ArkWebStringClassToStruct(originalUrl),
844         ArkWebStringClassToStruct(referrer), isFatalError, isMainFrame);
845 }
846 
OnTooltip(const std::string & tooltip)847 void ArkWebHandlerWrapper::OnTooltip(const std::string& tooltip)
848 {
849     ArkWebString stTooltip = ArkWebStringClassToStruct(tooltip);
850 
851     ark_web_handler_->OnTooltip(stTooltip);
852 
853     ArkWebStringStructRelease(stTooltip);
854 }
855 
ReleaseResizeHold()856 void ArkWebHandlerWrapper::ReleaseResizeHold()
857 {
858     ark_web_handler_->ReleaseResizeHold();
859 }
860 
OnShowAutofillPopup(const float offsetX,const float offsetY,const std::vector<std::string> & menu_items)861 void ArkWebHandlerWrapper::OnShowAutofillPopup(
862     const float offsetX, const float offsetY, const std::vector<std::string>& menu_items)
863 {
864     ArkWebStringVector stMenuItems = ArkWebStringVectorClassToStruct(menu_items);
865     ark_web_handler_->OnShowAutofillPopup(offsetX, offsetY, stMenuItems);
866 }
867 
OnHideAutofillPopup()868 void ArkWebHandlerWrapper::OnHideAutofillPopup()
869 {
870     ark_web_handler_->OnHideAutofillPopup();
871 }
872 
GetWordSelection(const std::string & text,int8_t offset)873 std::vector<int8_t> ArkWebHandlerWrapper::GetWordSelection(const std::string& text, int8_t offset)
874 {
875     ArkWebString ark_text = ArkWebStringClassToStruct(text);
876     ArkWebCharVector ark_result = ark_web_handler_->GetWordSelection(ark_text, offset);
877     std::vector<int8_t> result = ArkWebBasicVectorStructToClass<int8_t, ArkWebCharVector>(ark_result);
878 
879     ArkWebBasicVectorStructRelease(ark_result);
880     ArkWebStringStructRelease(ark_text);
881     return result;
882 }
883 
UpdateClippedSelectionBounds(int x,int y,int w,int h)884 void ArkWebHandlerWrapper::UpdateClippedSelectionBounds(int x, int y, int w, int h)
885 {
886     ark_web_handler_->UpdateClippedSelectionBounds(x, y, w, h);
887 }
888 
OnOpenAppLink(const std::string & url,std::shared_ptr<OHOS::NWeb::NWebAppLinkCallback> callback)889 bool ArkWebHandlerWrapper::OnOpenAppLink(
890     const std::string& url, std::shared_ptr<OHOS::NWeb::NWebAppLinkCallback> callback)
891 {
892     if (CHECK_SHARED_PTR_IS_NULL(callback)) {
893         return false;
894     }
895 
896     return ark_web_handler_->OnOpenAppLink(ArkWebStringClassToStruct(url), new ArkWebAppLinkCallbackImpl(callback));
897 }
898 
OnRenderProcessNotResponding(const std::string & js_stack,int pid,ArkWebRenderProcessNotRespondingReason reason)899 void ArkWebHandlerWrapper::OnRenderProcessNotResponding(
900     const std::string& js_stack, int pid, ArkWebRenderProcessNotRespondingReason reason)
901 {
902     ArkWebString js_stack_str = ArkWebStringClassToStruct(js_stack);
903     ark_web_handler_->OnRenderProcessNotResponding(js_stack_str, pid, static_cast<int>(reason));
904 }
905 
OnRenderProcessResponding()906 void ArkWebHandlerWrapper::OnRenderProcessResponding()
907 {
908     ark_web_handler_->OnRenderProcessResponding();
909 }
910 
OnViewportFitChange(ArkWebViewportFit viewportFit)911 void ArkWebHandlerWrapper::OnViewportFitChange(ArkWebViewportFit viewportFit)
912 {
913     ark_web_handler_->OnViewportFitChange(static_cast<int>(viewportFit));
914 }
915 
CreateOverlay(void * data,size_t len,int width,int height,int offset_x,int offset_y,int rect_width,int rect_height,int point_x,int point_y)916 void ArkWebHandlerWrapper::CreateOverlay(void* data, size_t len, int width, int height, int offset_x, int offset_y,
917     int rect_width, int rect_height, int point_x, int point_y)
918 {
919     ark_web_handler_->CreateOverlay(
920         data, len, width, height, offset_x, offset_x, rect_width, rect_height, point_x, point_y);
921 }
922 
OnOverlayStateChanged(int offset_x,int offset_y,int rect_width,int rect_height)923 void ArkWebHandlerWrapper::OnOverlayStateChanged(int offset_x, int offset_y, int rect_width, int rect_height)
924 {
925     ark_web_handler_->OnOverlayStateChanged(offset_x, offset_y, rect_width, rect_height);
926 }
927 
OnFocus(ArkWebFocusSource source)928 bool ArkWebHandlerWrapper::OnFocus(ArkWebFocusSource source)
929 {
930     return ark_web_handler_->OnFocus(static_cast<int>(source));
931 }
932 
OnOverScroll(float xOffset,float yOffset,float xVelocity,float yVelocity)933 bool ArkWebHandlerWrapper::OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity)
934 {
935     return ark_web_handler_->OnOverScroll(xOffset, yOffset, xVelocity, yVelocity);
936 }
937 
KeyboardReDispatch(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event,bool isUsed)938 void ArkWebHandlerWrapper::KeyboardReDispatch(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event, bool isUsed)
939 {
940     if (CHECK_SHARED_PTR_IS_NULL(event)) {
941         ark_web_handler_->KeyboardReDispatch(nullptr, isUsed);
942         return;
943     }
944 
945     ark_web_handler_->KeyboardReDispatch(new ArkWebKeyEventImpl(event), isUsed);
946 }
947 
OnInterceptKeyboardAttach(const std::shared_ptr<OHOS::NWeb::NWebCustomKeyboardHandler> keyboardHandler,const std::map<std::string,std::string> & attributes,bool & useSystemKeyboard,int32_t & enterKeyType)948 void ArkWebHandlerWrapper::OnInterceptKeyboardAttach(
949     const std::shared_ptr<OHOS::NWeb::NWebCustomKeyboardHandler> keyboardHandler,
950     const std::map<std::string, std::string> &attributes, bool &useSystemKeyboard, int32_t &enterKeyType)
951 {
952     if (CHECK_SHARED_PTR_IS_NULL(keyboardHandler)) {
953         return;
954     }
955 
956     ark_web_handler_->OnInterceptKeyboardAttach(new ArkWebCustomKeyboardHandlerImpl(keyboardHandler),
957         ArkWebStringMapClassToStruct(attributes), useSystemKeyboard, enterKeyType);
958 }
959 
OnCustomKeyboardAttach()960 void ArkWebHandlerWrapper::OnCustomKeyboardAttach()
961 {
962     ark_web_handler_->OnCustomKeyboardAttach();
963 }
964 
OnCustomKeyboardClose()965 void ArkWebHandlerWrapper::OnCustomKeyboardClose()
966 {
967     ark_web_handler_->OnCustomKeyboardClose();
968 }
969 
OnAdsBlocked(const std::string & url,const std::vector<std::string> & adsBlocked)970 void ArkWebHandlerWrapper::OnAdsBlocked(
971     const std::string& url,
972     const std::vector<std::string>& adsBlocked) {
973   ArkWebString stUrl = ArkWebStringClassToStruct(url);
974   ArkWebStringVector stAdsBlocked = ArkWebStringVectorClassToStruct(adsBlocked);
975 
976   ark_web_handler_->OnAdsBlocked(stUrl, stAdsBlocked);
977 
978   ArkWebStringVectorStructRelease(stAdsBlocked);
979   ArkWebStringStructRelease(stUrl);
980 }
981 
OnCursorUpdate(double x,double y,double width,double height)982 void ArkWebHandlerWrapper::OnCursorUpdate(double x, double y, double width, double height)
983 {
984     ark_web_handler_->OnCursorUpdate(x, y, width, height);
985 }
986 
ReportDynamicFrameLossEvent(const std::string & sceneId,bool isStart)987 void ArkWebHandlerWrapper::ReportDynamicFrameLossEvent(const std::string& sceneId, bool isStart)
988 {
989     ArkWebString stSceneId = ArkWebStringClassToStruct(sceneId);
990     ark_web_handler_->ReportDynamicFrameLossEvent(stSceneId, isStart);
991     ArkWebStringStructRelease(stSceneId);
992 }
993 
HideHandleAndQuickMenuIfNecessary(bool hide)994 void ArkWebHandlerWrapper::HideHandleAndQuickMenuIfNecessary(bool hide)
995 {
996     ark_web_handler_->HideHandleAndQuickMenuIfNecessary(hide);
997 }
998 
ChangeVisibilityOfQuickMenu()999 void ArkWebHandlerWrapper::ChangeVisibilityOfQuickMenu()
1000 {
1001     ark_web_handler_->ChangeVisibilityOfQuickMenu();
1002 }
1003 
StartVibraFeedback(const std::string & vibratorType)1004 void ArkWebHandlerWrapper::StartVibraFeedback(const std::string& vibratorType)
1005 {
1006     ArkWebString stVibratorType = ArkWebStringClassToStruct(vibratorType);
1007 
1008     ark_web_handler_->StartVibraFeedback(stVibratorType);
1009 
1010     ArkWebStringStructRelease(stVibratorType);
1011 }
1012 
OnPopupSize(int x,int y,int width,int height)1013 void ArkWebHandlerWrapper::OnPopupSize(int x, int y, int width, int height) {
1014     ark_web_handler_->OnPopupSize(x, y, width, height);
1015 }
1016 
OnPopupShow(bool show)1017 void ArkWebHandlerWrapper::OnPopupShow(bool show) {
1018     ark_web_handler_->OnPopupShow(show);
1019 }
1020 
OnNativeEmbedVisibilityChange(const std::string & embed_id,bool visibility)1021 void ArkWebHandlerWrapper::OnNativeEmbedVisibilityChange(const std::string& embed_id, bool visibility)
1022 {
1023     ArkWebString stEmbedId = ArkWebStringClassToStruct(embed_id);
1024     ark_web_handler_->OnNativeEmbedVisibilityChange(stEmbedId, visibility);
1025     ArkWebStringStructRelease(stEmbedId);
1026 }
1027 
CloseImageOverlaySelection()1028 bool ArkWebHandlerWrapper::CloseImageOverlaySelection()
1029 {
1030     return ark_web_handler_->CloseImageOverlaySelection();
1031 }
1032 
OnSslErrorRequestByJSV2(std::shared_ptr<OHOS::NWeb::NWebJSSslErrorResult> result,ArkWebSslError error,const std::vector<std::string> & certChainData)1033 bool ArkWebHandlerWrapper::OnSslErrorRequestByJSV2(
1034     std::shared_ptr<OHOS::NWeb::NWebJSSslErrorResult> result, ArkWebSslError error,
1035     const std::vector<std::string>& certChainData)
1036 {
1037     ArkWebStringVector stCertChainData = ArkWebStringVectorClassToStruct(certChainData);
1038 
1039     bool flag = false;
1040     if (CHECK_SHARED_PTR_IS_NULL(result)) {
1041         flag = ark_web_handler_->OnSslErrorRequestByJSV2(nullptr, static_cast<int>(error), stCertChainData);
1042     } else {
1043         flag = ark_web_handler_->OnSslErrorRequestByJSV2(
1044             new ArkWebJsSslErrorResultImpl(result), static_cast<int>(error), stCertChainData);
1045     }
1046 
1047     ArkWebStringVectorStructRelease(stCertChainData);
1048     return flag;
1049 }
1050 
OnAccessibilityEvent(int64_t accessibilityId,int32_t eventType)1051 void ArkWebHandlerWrapper::OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) {
1052     ark_web_handler_->OnAccessibilityEvent(accessibilityId, eventType);
1053 }
1054 
IsCurrentFocus()1055 bool ArkWebHandlerWrapper::IsCurrentFocus() {
1056     return ark_web_handler_->IsCurrentFocus();
1057 }
1058 
GetVisibleRectToWeb(int & visibleX,int & visibleY,int & visibleWidth,int & visibleHeight)1059 void ArkWebHandlerWrapper::GetVisibleRectToWeb(int& visibleX, int& visibleY, int& visibleWidth, int& visibleHeight)
1060 {
1061     ark_web_handler_->GetVisibleRectToWeb(visibleX, visibleY, visibleWidth, visibleHeight);
1062 }
1063 
OnScrollStart(const float x,const float y)1064 void ArkWebHandlerWrapper::OnScrollStart(const float x, const float y)
1065 {
1066     ark_web_handler_->OnScrollStart(x, y);
1067 }
1068 
OnShowAutofillPopupV2(const float offsetX,const float offsetY,const float height,const float width,const std::vector<std::string> & menu_items)1069 void ArkWebHandlerWrapper::OnShowAutofillPopupV2(
1070     const float offsetX, const float offsetY, const float height, const float width,
1071     const std::vector<std::string>& menu_items)
1072 {
1073     ArkWebStringVector stMenuItems = ArkWebStringVectorClassToStruct(menu_items);
1074     ark_web_handler_->OnShowAutofillPopupV2(offsetX, offsetY, height, width, stMenuItems);
1075     ArkWebStringVectorStructRelease(stMenuItems);
1076 }
1077 
RestoreRenderFit()1078 void ArkWebHandlerWrapper::RestoreRenderFit()
1079 {
1080     ark_web_handler_->RestoreRenderFit();
1081 }
1082 
OnAccessibilityEventV2(int64_t accessibilityId,int32_t eventType,const std::string & argument)1083 void ArkWebHandlerWrapper::OnAccessibilityEventV2(
1084     int64_t accessibilityId, int32_t eventType, const std::string& argument)
1085 {
1086     ArkWebString stArgument = ArkWebStringClassToStruct(argument);
1087     ark_web_handler_->OnAccessibilityEventV2(accessibilityId, eventType, stArgument);
1088     ArkWebStringStructRelease(stArgument);
1089 }
1090 
OnNestedScroll(float & x,float & y,float & xVelocity,float & yVelocity,bool & isAvailable)1091 bool ArkWebHandlerWrapper::OnNestedScroll(float& x, float& y, float& xVelocity, float& yVelocity, bool& isAvailable)
1092 {
1093     return ark_web_handler_->OnNestedScroll(x, y, xVelocity, yVelocity, isAvailable);
1094 }
1095 
EnableSecurityLayer(bool isNeedSecurityLayer)1096 void ArkWebHandlerWrapper::EnableSecurityLayer(bool isNeedSecurityLayer)
1097 {
1098     ark_web_handler_->EnableSecurityLayer(isNeedSecurityLayer);
1099 }
1100 
ChangeVisibilityOfQuickMenuV2()1101 bool ArkWebHandlerWrapper::ChangeVisibilityOfQuickMenuV2()
1102 {
1103     return ark_web_handler_->ChangeVisibilityOfQuickMenuV2();
1104 }
1105 
OnPip(int status,int delegate_id,int child_id,int frame_routing_id,int width,int height)1106 void ArkWebHandlerWrapper::OnPip(int status,
1107                                  int delegate_id,
1108                                  int child_id,
1109                                  int frame_routing_id,
1110                                  int width,
1111                                  int height)
1112 {
1113     ark_web_handler_->OnPip(status, delegate_id, child_id,
1114                             frame_routing_id, width, height);
1115 }
1116 
OnBeforeUnloadByJSV2(const std::string & url,const std::string & message,bool isReload,std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)1117 bool ArkWebHandlerWrapper::OnBeforeUnloadByJSV2(const std::string& url, const std::string& message, bool isReload,
1118     std::shared_ptr<OHOS::NWeb::NWebJSDialogResult> result)
1119 {
1120     ArkWebString stUrl = ArkWebStringClassToStruct(url);
1121     ArkWebString stMessage = ArkWebStringClassToStruct(message);
1122 
1123     bool flag = false;
1124     if (CHECK_SHARED_PTR_IS_NULL(result)) {
1125         flag = ark_web_handler_->OnBeforeUnloadByJSV2(stUrl, stMessage, isReload, nullptr);
1126     } else {
1127         flag = ark_web_handler_->OnBeforeUnloadByJSV2(stUrl, stMessage, isReload, new ArkWebJsDialogResultImpl(result));
1128     }
1129 
1130     ArkWebStringStructRelease(stUrl);
1131     ArkWebStringStructRelease(stMessage);
1132     return flag;
1133 }
1134 
OnNativeEmbedMouseEvent(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedMouseEvent> mouseEvent)1135 void ArkWebHandlerWrapper::OnNativeEmbedMouseEvent(std::shared_ptr<OHOS::NWeb::NWebNativeEmbedMouseEvent> mouseEvent)
1136 {
1137     if (CHECK_SHARED_PTR_IS_NULL(mouseEvent)) {
1138         ark_web_handler_->OnNativeEmbedMouseEvent(nullptr);
1139         return;
1140     }
1141 
1142     ark_web_handler_->OnNativeEmbedMouseEvent(new ArkWebNativeEmbedMouseEventImpl(mouseEvent));
1143 }
1144 
OnActivateContentByJS()1145 void ArkWebHandlerWrapper::OnActivateContentByJS()
1146 {
1147     ark_web_handler_->OnActivateContentByJS();
1148 }
1149 
OnLoadStarted(const std::string & url)1150 void ArkWebHandlerWrapper::OnLoadStarted(const std::string& url) {
1151     ArkWebString stUrl = ArkWebStringClassToStruct(url);
1152 
1153     ark_web_handler_->OnLoadStarted(stUrl);
1154 
1155     ArkWebStringStructRelease(stUrl);
1156 }
1157 
OnLoadFinished(const std::string & url)1158 void ArkWebHandlerWrapper::OnLoadFinished(const std::string& url) {
1159     ArkWebString stUrl = ArkWebStringClassToStruct(url);
1160 
1161     ark_web_handler_->OnLoadFinished(stUrl);
1162 
1163     ArkWebStringStructRelease(stUrl);
1164 }
1165 
OnAllSslErrorRequestByJSV2(std::shared_ptr<OHOS::NWeb::NWebJSAllSslErrorResult> result,ArkWebSslError error,const std::string & url,const std::string & originalUrl,const std::string & referrer,bool isFatalError,bool isMainFrame,const std::vector<std::string> & certChainData)1166 bool ArkWebHandlerWrapper::OnAllSslErrorRequestByJSV2(std::shared_ptr<OHOS::NWeb::NWebJSAllSslErrorResult> result,
1167     ArkWebSslError error, const std::string& url, const std::string& originalUrl, const std::string& referrer,
1168     bool isFatalError, bool isMainFrame, const std::vector<std::string>& certChainData)
1169 {
1170     ArkWebStringVector stCertChainData = ArkWebStringVectorClassToStruct(certChainData);
1171 
1172     bool flag = false;
1173     if (CHECK_SHARED_PTR_IS_NULL(result)) {
1174         flag = ark_web_handler_->OnAllSslErrorRequestByJSV2(nullptr, static_cast<int>(error),
1175             ArkWebStringClassToStruct(url), ArkWebStringClassToStruct(originalUrl), ArkWebStringClassToStruct(referrer),
1176             isFatalError, isMainFrame, stCertChainData);
1177     } else {
1178         flag = ark_web_handler_->OnAllSslErrorRequestByJSV2(new ArkWebJsAllSslErrorResultImpl(result),
1179         static_cast<int>(error), ArkWebStringClassToStruct(url), ArkWebStringClassToStruct(originalUrl),
1180         ArkWebStringClassToStruct(referrer), isFatalError, isMainFrame, stCertChainData);
1181     }
1182 
1183     ArkWebStringVectorStructRelease(stCertChainData);
1184     return flag;
1185 }
1186 
ShowMagnifier()1187 void ArkWebHandlerWrapper::ShowMagnifier()
1188 {
1189     ark_web_handler_->ShowMagnifier();
1190 }
1191 
HideMagnifier()1192 void ArkWebHandlerWrapper::HideMagnifier()
1193 {
1194     ark_web_handler_->HideMagnifier();
1195 }
1196 
OnPageTitleV2(const std::string & title,bool isRealTitle)1197 void ArkWebHandlerWrapper::OnPageTitleV2(const std::string& title, bool isRealTitle)
1198 {
1199     ArkWebString stTitle = ArkWebStringClassToStruct(title);
1200 
1201     ark_web_handler_->OnPageTitleV2(stTitle, isRealTitle);
1202 
1203     ArkWebStringStructRelease(stTitle);
1204 }
1205 
OnInsertBlanklessFrame(const std::string & pathToFrame)1206 void ArkWebHandlerWrapper::OnInsertBlanklessFrame(const std::string& pathToFrame)
1207 {
1208     ArkWebString pathToFrame_ = ArkWebStringClassToStruct(pathToFrame);
1209     ark_web_handler_->OnInsertBlanklessFrame(pathToFrame_);
1210     ArkWebStringStructRelease(pathToFrame_);
1211 }
1212 
OnRemoveBlanklessFrame(int delayTime)1213 void ArkWebHandlerWrapper::OnRemoveBlanklessFrame(int delayTime)
1214 {
1215     ark_web_handler_->OnRemoveBlanklessFrame(delayTime);
1216 }
1217 
OnHandleOverrideErrorPage(std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,std::shared_ptr<OHOS::NWeb::NWebUrlResourceError> error)1218 std::string ArkWebHandlerWrapper::OnHandleOverrideErrorPage(
1219     std::shared_ptr<OHOS::NWeb::NWebUrlResourceRequest> request,
1220     std::shared_ptr<OHOS::NWeb::NWebUrlResourceError> error)
1221 {
1222     ArkWebRefPtr<ArkWebUrlResourceRequest> ark_web_request = nullptr;
1223     if (!CHECK_SHARED_PTR_IS_NULL(request)) {
1224         ark_web_request = new ArkWebUrlResourceRequestImpl(request);
1225     }
1226 
1227     ArkWebRefPtr<ArkWebUrlResourceError> ark_web_error = nullptr;
1228     if (!CHECK_SHARED_PTR_IS_NULL(error)) {
1229         ark_web_error = new ArkWebUrlResourceErrorImpl(error);
1230     }
1231 
1232     ArkWebString result = ark_web_handler_->OnHandleOverrideErrorPage(ark_web_request, ark_web_error);
1233     std::string html = ArkWebStringStructToClass(result);
1234     ArkWebStringStructRelease(result);
1235     return html;
1236 }
1237 
OnPdfScrollAtBottom(const std::string & url)1238 void ArkWebHandlerWrapper::OnPdfScrollAtBottom(const std::string& url)
1239 {
1240     ArkWebString stUrl = ArkWebStringClassToStruct(url);
1241 
1242     ark_web_handler_->OnPdfScrollAtBottom(stUrl);
1243 
1244     ArkWebStringStructRelease(stUrl);
1245 }
1246 
OnPdfLoadEvent(int32_t result,const std::string & url)1247 void ArkWebHandlerWrapper::OnPdfLoadEvent(int32_t result, const std::string& url)
1248 {
1249     ArkWebString stUrl = ArkWebStringClassToStruct(url);
1250 
1251     ark_web_handler_->OnPdfLoadEvent(result, stUrl);
1252 
1253     ArkWebStringStructRelease(stUrl);
1254 }
1255 
OnTakeFocus(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)1256 void ArkWebHandlerWrapper::OnTakeFocus(std::shared_ptr<OHOS::NWeb::NWebKeyEvent> event)
1257 {
1258     if (CHECK_SHARED_PTR_IS_NULL(event)) {
1259         ark_web_handler_->OnTakeFocus(nullptr);
1260         return;
1261     }
1262 
1263     ark_web_handler_->OnTakeFocus(new ArkWebKeyEventImpl(event));
1264 }
1265 } // namespace OHOS::ArkWeb
1266