From e93f1079f5d79d70dcbaa1f250d9aec796ea6e54 Mon Sep 17 00:00:00 2001 From: z30026177 Date: Sat, 9 Aug 2025 18:50:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=84=E8=93=9D=E4=B8=80=E8=87=B4=E6=80=A7?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: z30026177 --- .../napi_web_scheme_handler_request.cpp | 2 +- ...rk_web_custom_keyboard_handler_wrapper.cpp | 17 +- .../ark_web_custom_keyboard_handler_wrapper.h | 7 +- .../bridge/webview/ark_web_engine_wrapper.cpp | 18 +- .../bridge/webview/ark_web_engine_wrapper.h | 4 +- .../bridge/webview/ark_web_handler_impl.cpp | 189 +++++------ .../bridge/webview/ark_web_handler_impl.h | 99 +++--- .../webview/ark_web_js_proxy_method_impl.cpp | 41 ++- .../webview/ark_web_js_proxy_method_impl.h | 55 ++- .../ark_web_mouse_event_result_wrapper.cpp | 2 +- .../ark_web_mouse_event_result_wrapper.h | 2 +- ...k_web_native_embed_mouse_event_wrapper.cpp | 2 +- ...ark_web_native_embed_mouse_event_wrapper.h | 2 +- .../bridge/webview/ark_web_nweb_wrapper.cpp | 312 +++++++++--------- .../bridge/webview/ark_web_nweb_wrapper.h | 292 ++++++++-------- .../webview/ark_web_preference_wrapper.cpp | 13 +- .../webview/ark_web_preference_wrapper.h | 8 +- .../ark_web_print_attributes_adapter_impl.cpp | 2 +- .../ark_web_print_attributes_adapter_impl.h | 6 +- ...print_document_adapter_adapter_wrapper.cpp | 2 +- ...b_print_document_adapter_adapter_wrapper.h | 6 +- .../ohos_nweb/include/ark_web_engine.h | 4 +- .../ohos_nweb/include/ark_web_handler.h | 252 +++++++------- .../include/ark_web_js_proxy_method.h | 50 +-- .../cert_mgr_adapter_test.cpp | 21 +- 25 files changed, 697 insertions(+), 711 deletions(-) diff --git a/interfaces/kits/napi/webviewcontroller/napi_web_scheme_handler_request.cpp b/interfaces/kits/napi/webviewcontroller/napi_web_scheme_handler_request.cpp index aeef6fc6b..3ed5c2639 100644 --- a/interfaces/kits/napi/webviewcontroller/napi_web_scheme_handler_request.cpp +++ b/interfaces/kits/napi/webviewcontroller/napi_web_scheme_handler_request.cpp @@ -1367,7 +1367,7 @@ napi_value NapiWebResourceHandler::JS_DidFailWithError(napi_env env, napi_callba } bool completeIfNoResponse = false; - if (!NapiParseUtils::ParseBoolean(env, argv[1], completeIfNoResponse)) { + if (argc >= 2 && !NapiParseUtils::ParseBoolean(env, argv[1], completeIfNoResponse)) { WVLOG_E("JS_DidFailWithError unwrap error completeIfNoResponse failed"); } diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.cpp index 4371ad5fd..60233a7ba 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.cpp @@ -19,24 +19,29 @@ namespace OHOS::ArkWeb { -void ArkWebCustomKeyboardHandlerWrapper::InsertText(const std::string &text) { +void ArkWebCustomKeyboardHandlerWrapper::InsertText(const std::string &text) +{ ark_web_custom_keyboard_handler_->InsertText(ArkWebStringClassToStruct(text)); } -void ArkWebCustomKeyboardHandlerWrapper::DeleteForward(int32_t length) { +void ArkWebCustomKeyboardHandlerWrapper::DeleteForward(int32_t length) +{ ark_web_custom_keyboard_handler_->DeleteForward(length); } -void ArkWebCustomKeyboardHandlerWrapper::DeleteBackward(int32_t length) { +void ArkWebCustomKeyboardHandlerWrapper::DeleteBackward(int32_t length) +{ ark_web_custom_keyboard_handler_->DeleteBackward(length); } -void ArkWebCustomKeyboardHandlerWrapper::SendFunctionKey(int32_t key) { +void ArkWebCustomKeyboardHandlerWrapper::SendFunctionKey(int32_t key) +{ ark_web_custom_keyboard_handler_->SendFunctionKey(key); } -void ArkWebCustomKeyboardHandlerWrapper::Close() { +void ArkWebCustomKeyboardHandlerWrapper::Close() +{ ark_web_custom_keyboard_handler_->Close(); } -} // namespace OHOS::ArkWeb \ No newline at end of file +} // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.h index 6e8868184..703dfb666 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_custom_keyboard_handler_wrapper.h @@ -26,8 +26,9 @@ namespace OHOS::ArkWeb { class ArkWebCustomKeyboardHandlerWrapper : public OHOS::NWeb::NWebCustomKeyboardHandler { public: - ArkWebCustomKeyboardHandlerWrapper(ArkWebRefPtr ark_web_custom_keyboard_handler) : - ark_web_custom_keyboard_handler_(ark_web_custom_keyboard_handler) {} + ArkWebCustomKeyboardHandlerWrapper(ArkWebRefPtr ark_web_custom_keyboard_handler) + : ark_web_custom_keyboard_handler_(ark_web_custom_keyboard_handler) {} + ~ArkWebCustomKeyboardHandlerWrapper() = default; void InsertText(const std::string &text) override; @@ -46,4 +47,4 @@ private: } // namespace OHOS::ArkWeb -#endif // ARK_WEB_CUSTOM_KEYBOARD_HANDLER_WRAPPER_H_ \ No newline at end of file +#endif // ARK_WEB_CUSTOM_KEYBOARD_HANDLER_WRAPPER_H_ diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.cpp index de32186f1..0ffda1e33 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.cpp @@ -217,15 +217,6 @@ void ArkWebEngineWrapper::ClearPrefetchedResource(const std::vector ArkWebStringVectorStructRelease(stCacheKeyList); } -void ArkWebEngineWrapper::WarmupServiceWorker(const std::string& url) -{ - ArkWebString stUrl = ArkWebStringClassToStruct(url); - - ark_web_engine_->WarmupServiceWorker(stUrl); - - ArkWebStringStructRelease(stUrl); -} - void ArkWebEngineWrapper::SetHostIP(const std::string& hostName, const std::string& address, int32_t aliveTime) { ark_web_engine_->SetHostIP(ArkWebStringClassToStruct(hostName), ArkWebStringClassToStruct(address), aliveTime); @@ -246,6 +237,15 @@ void ArkWebEngineWrapper::SetUserAgentForHosts(const std::string& userAgent, con ark_web_engine_->SetUserAgentForHosts(ArkWebStringClassToStruct(userAgent), ArkWebStringVectorClassToStruct(hosts)); } +void ArkWebEngineWrapper::WarmupServiceWorker(const std::string& url) +{ + ArkWebString stUrl = ArkWebStringClassToStruct(url); + + ark_web_engine_->WarmupServiceWorker(stUrl); + + ArkWebStringStructRelease(stUrl); +} + void ArkWebEngineWrapper::EnableWholeWebPageDrawing() { ark_web_engine_->EnableWholeWebPageDrawing(); diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.h index ae3301b38..cc8d263a2 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_engine_wrapper.h @@ -71,12 +71,12 @@ public: void ClearPrefetchedResource(const std::vector& cache_key_list) override; - void WarmupServiceWorker(const std::string& url) override; - void SetHostIP(const std::string& hostName, const std::string& address, int32_t aliveTime) override; void ClearHostIP(const std::string& hostName) override; + void WarmupServiceWorker(const std::string& url) override; + void SetAppCustomUserAgent(const std::string& userAgent) override; void SetUserAgentForHosts(const std::string& userAgent, const std::vector& hosts) override; diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp index e48c5c199..5884e3dfa 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.cpp @@ -16,6 +16,7 @@ #include "ohos_nweb/bridge/ark_web_handler_impl.h" #include "ohos_nweb/bridge/ark_web_access_request_wrapper.h" +#include "ohos_nweb/bridge/ark_web_all_ssl_error_info_wrapper.h" #include "ohos_nweb/bridge/ark_web_app_link_callback_wrapper.h" #include "ohos_nweb/bridge/ark_web_console_log_wrapper.h" #include "ohos_nweb/bridge/ark_web_context_menu_callback_wrapper.h" @@ -772,15 +773,6 @@ void ArkWebHandlerImpl::UpdateClippedSelectionBounds(int x, int y, int w, int h) nweb_handler_->UpdateClippedSelectionBounds(x, y, w, h); } -bool ArkWebHandlerImpl::OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) -{ - if (CHECK_REF_PTR_IS_NULL(callback)) { - return nweb_handler_->OnOpenAppLink(ArkWebStringStructToClass(url), nullptr); - } - - return nweb_handler_->OnOpenAppLink( - ArkWebStringStructToClass(url), std::make_shared(callback)); -} void ArkWebHandlerImpl::OnRenderProcessNotResponding(const ArkWebString& js_stack, int pid, int reason) { nweb_handler_->OnRenderProcessNotResponding( @@ -792,6 +784,16 @@ void ArkWebHandlerImpl::OnRenderProcessResponding() nweb_handler_->OnRenderProcessResponding(); } +bool ArkWebHandlerImpl::OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) +{ + if (CHECK_REF_PTR_IS_NULL(callback)) { + return nweb_handler_->OnOpenAppLink(ArkWebStringStructToClass(url), nullptr); + } + + return nweb_handler_->OnOpenAppLink( + ArkWebStringStructToClass(url), std::make_shared(callback)); +} + void ArkWebHandlerImpl::OnShowAutofillPopup( const float offsetX, const float offsetY, const ArkWebStringVector& menu_items) { @@ -808,35 +810,31 @@ void ArkWebHandlerImpl::OnViewportFitChange(int viewportFit) nweb_handler_->OnViewportFitChange(static_cast(viewportFit)); } -void ArkWebHandlerImpl::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) +bool ArkWebHandlerImpl::OnFocus(int source) { - nweb_handler_->CreateOverlay( - data, len, width, height, offset_x, offset_y, rect_width, rect_height, point_x, point_y); + return nweb_handler_->OnFocus(static_cast(source)); } -void ArkWebHandlerImpl::OnOverlayStateChanged(int offset_x, int offset_y, int rect_width, int rect_height) +bool ArkWebHandlerImpl::OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) { - nweb_handler_->OnOverlayStateChanged(offset_x, offset_y, rect_width, rect_height); + return nweb_handler_->OnOverScroll(xOffset, yOffset, xVelocity, yVelocity); } -bool ArkWebHandlerImpl::OnFocus(int source) +void ArkWebHandlerImpl::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) { - return nweb_handler_->OnFocus(static_cast(source)); + nweb_handler_->CreateOverlay( + data, len, width, height, offset_x, offset_y, rect_width, rect_height, point_x, point_y); } -bool ArkWebHandlerImpl::OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) +void ArkWebHandlerImpl::OnOverlayStateChanged(int offset_x, int offset_y, int rect_width, int rect_height) { - return nweb_handler_->OnOverScroll(xOffset, yOffset, xVelocity, yVelocity); + nweb_handler_->OnOverlayStateChanged(offset_x, offset_y, rect_width, rect_height); } -void ArkWebHandlerImpl::KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) +void ArkWebHandlerImpl::OnAdsBlocked(const ArkWebString& url, const ArkWebStringVector& adsBlocked) { - if (CHECK_REF_PTR_IS_NULL(event)) { - nweb_handler_->KeyboardReDispatch(nullptr, isUsed); - } - - nweb_handler_->KeyboardReDispatch(std::make_shared(event), isUsed); + nweb_handler_->OnAdsBlocked(ArkWebStringStructToClass(url), ArkWebStringVectorStructToClass(adsBlocked)); } void ArkWebHandlerImpl::OnInterceptKeyboardAttach(ArkWebRefPtr keyboardHandler, @@ -861,24 +859,24 @@ void ArkWebHandlerImpl::OnCustomKeyboardClose() nweb_handler_->OnCustomKeyboardClose(); } -void ArkWebHandlerImpl::OnAdsBlocked(const ArkWebString& url, const ArkWebStringVector& adsBlocked) +void ArkWebHandlerImpl::KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) { - nweb_handler_->OnAdsBlocked(ArkWebStringStructToClass(url), ArkWebStringVectorStructToClass(adsBlocked)); -} + if (CHECK_REF_PTR_IS_NULL(event)) { + nweb_handler_->KeyboardReDispatch(nullptr, isUsed); + return; + } -void ArkWebHandlerImpl::OnCursorUpdate(double x, double y, double width, double height) -{ - nweb_handler_->OnCursorUpdate(x, y, width, height); + nweb_handler_->KeyboardReDispatch(std::make_shared(event), isUsed); } -void ArkWebHandlerImpl::ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) +void ArkWebHandlerImpl::HideHandleAndQuickMenuIfNecessary(bool hide) { - nweb_handler_->ReportDynamicFrameLossEvent(ArkWebStringStructToClass(sceneId), isStart); + nweb_handler_->HideHandleAndQuickMenuIfNecessary(hide); } -void ArkWebHandlerImpl::HideHandleAndQuickMenuIfNecessary(bool hide) +void ArkWebHandlerImpl::OnCursorUpdate(double x, double y, double width, double height) { - nweb_handler_->HideHandleAndQuickMenuIfNecessary(hide); + nweb_handler_->OnCursorUpdate(x, y, width, height); } void ArkWebHandlerImpl::ChangeVisibilityOfQuickMenu() @@ -891,6 +889,16 @@ void ArkWebHandlerImpl::StartVibraFeedback(const ArkWebString& vibratorType) nweb_handler_->StartVibraFeedback(ArkWebStringStructToClass(vibratorType)); } +void ArkWebHandlerImpl::OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) +{ + nweb_handler_->OnNativeEmbedVisibilityChange(ArkWebStringStructToClass(embed_id), visibility); +} + +bool ArkWebHandlerImpl::CloseImageOverlaySelection() +{ + return nweb_handler_->CloseImageOverlaySelection(); +} + void ArkWebHandlerImpl::OnPopupSize(int x, int y, int width, int height) { nweb_handler_->OnPopupSize(x, y, width, height); @@ -901,37 +909,36 @@ void ArkWebHandlerImpl::OnPopupShow(bool show) nweb_handler_->OnPopupShow(show); } -void ArkWebHandlerImpl::OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) +void ArkWebHandlerImpl::OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) { - nweb_handler_->OnNativeEmbedVisibilityChange(ArkWebStringStructToClass(embed_id), visibility); + nweb_handler_->OnAccessibilityEvent(accessibilityId, eventType); } -bool ArkWebHandlerImpl::CloseImageOverlaySelection() +void ArkWebHandlerImpl::ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) { - return nweb_handler_->CloseImageOverlaySelection(); + nweb_handler_->ReportDynamicFrameLossEvent(ArkWebStringStructToClass(sceneId), isStart); } -bool ArkWebHandlerImpl::OnSslErrorRequestByJSV2(ArkWebRefPtr result, int error, - const ArkWebStringVector& certChainData) +bool ArkWebHandlerImpl::IsCurrentFocus() { - if (CHECK_REF_PTR_IS_NULL(result)) { - return nweb_handler_->OnSslErrorRequestByJSV2(nullptr, static_cast(error), - ArkWebStringVectorStructToClass(certChainData)); - } - - return nweb_handler_->OnSslErrorRequestByJSV2( - std::make_shared(result), static_cast(error), - ArkWebStringVectorStructToClass(certChainData)); + return nweb_handler_->IsCurrentFocus(); } -void ArkWebHandlerImpl::OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) +bool ArkWebHandlerImpl::ChangeVisibilityOfQuickMenuV2() { - nweb_handler_->OnAccessibilityEvent(accessibilityId, eventType); + return nweb_handler_->ChangeVisibilityOfQuickMenuV2(); } -bool ArkWebHandlerImpl::IsCurrentFocus() +bool ArkWebHandlerImpl::OnSslErrorRequestByJSV2( + ArkWebRefPtr result, int error, const ArkWebStringVector& certChainData) { - return nweb_handler_->IsCurrentFocus(); + if (CHECK_REF_PTR_IS_NULL(result)) { + return nweb_handler_->OnSslErrorRequestByJSV2( + nullptr, static_cast(error), ArkWebStringVectorStructToClass(certChainData)); + } + + return nweb_handler_->OnSslErrorRequestByJSV2(std::make_shared(result), + static_cast(error), ArkWebStringVectorStructToClass(certChainData)); } void ArkWebHandlerImpl::GetVisibleRectToWeb(int& visibleX, int& visibleY, int& visibleWidth, int& visibleHeight) @@ -966,25 +973,19 @@ bool ArkWebHandlerImpl::OnNestedScroll(float& x, float& y, float& xVelocity, flo return nweb_handler_->OnNestedScroll(x, y, xVelocity, yVelocity, isAvailable); } -void ArkWebHandlerImpl::EnableSecurityLayer(bool isNeedSecurityLayer) +void ArkWebHandlerImpl::OnActivateContentByJS() { - nweb_handler_->EnableSecurityLayer(isNeedSecurityLayer); + nweb_handler_->OnActivateContentByJS(); } -bool ArkWebHandlerImpl::ChangeVisibilityOfQuickMenuV2() +void ArkWebHandlerImpl::OnLoadStarted(const ArkWebString& url) { - return nweb_handler_->ChangeVisibilityOfQuickMenuV2(); + nweb_handler_->OnLoadStarted(ArkWebStringStructToClass(url)); } -void ArkWebHandlerImpl::OnPip(int status, - int delegate_id, - int child_id, - int frame_routing_id, - int width, - int height) +void ArkWebHandlerImpl::OnLoadFinished(const ArkWebString& url) { - nweb_handler_->OnPip(status, delegate_id, child_id, - frame_routing_id, width, height); + nweb_handler_->OnLoadFinished(ArkWebStringStructToClass(url)); } bool ArkWebHandlerImpl::OnBeforeUnloadByJSV2( @@ -995,8 +996,8 @@ bool ArkWebHandlerImpl::OnBeforeUnloadByJSV2( ArkWebStringStructToClass(url), ArkWebStringStructToClass(message), isReload, nullptr); } - return nweb_handler_->OnBeforeUnloadByJSV2(ArkWebStringStructToClass(url), ArkWebStringStructToClass(message), - isReload, std::make_shared(result)); + return nweb_handler_->OnBeforeUnloadByJSV2(ArkWebStringStructToClass(url), ArkWebStringStructToClass(message), isReload, + std::make_shared(result)); } void ArkWebHandlerImpl::OnNativeEmbedMouseEvent(ArkWebRefPtr mouse_event) @@ -1009,59 +1010,59 @@ void ArkWebHandlerImpl::OnNativeEmbedMouseEvent(ArkWebRefPtrOnNativeEmbedMouseEvent(std::make_shared(mouse_event)); } -void ArkWebHandlerImpl::OnActivateContentByJS() -{ - nweb_handler_->OnActivateContentByJS(); -} - -void ArkWebHandlerImpl::OnLoadStarted(const ArkWebString& url) +void ArkWebHandlerImpl::OnPip(int status, + int delegate_id, + int child_id, + int frame_routing_id, + int width, + int height) { - nweb_handler_->OnLoadStarted(ArkWebStringStructToClass(url)); + nweb_handler_->OnPip(status, delegate_id, child_id, + frame_routing_id, width, height); } -void ArkWebHandlerImpl::OnLoadFinished(const ArkWebString& url) +void ArkWebHandlerImpl::EnableSecurityLayer(bool isNeedSecurityLayer) { - nweb_handler_->OnLoadFinished(ArkWebStringStructToClass(url)); + nweb_handler_->EnableSecurityLayer(isNeedSecurityLayer); } -bool ArkWebHandlerImpl::OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, int error, - const ArkWebString& url, const ArkWebString& originalUrl, const ArkWebString& referrer, bool isFatalError, - bool isMainFrame, const ArkWebStringVector& certChainData) +bool ArkWebHandlerImpl::OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, + ArkWebRefPtr info) { + if (CHECK_REF_PTR_IS_NULL(info)) { + return false; + } if (CHECK_REF_PTR_IS_NULL(result)) { - return nweb_handler_->OnAllSslErrorRequestByJSV2(nullptr, static_cast(error), - ArkWebStringStructToClass(url), ArkWebStringStructToClass(originalUrl), ArkWebStringStructToClass(referrer), - isFatalError, isMainFrame, ArkWebStringVectorStructToClass(certChainData)); + return nweb_handler_->OnAllSslErrorRequestByJSV2(nullptr, std::make_shared(info)); } return nweb_handler_->OnAllSslErrorRequestByJSV2(std::make_shared(result), - static_cast(error), ArkWebStringStructToClass(url), ArkWebStringStructToClass(originalUrl), - ArkWebStringStructToClass(referrer), isFatalError, isMainFrame, ArkWebStringVectorStructToClass(certChainData)); + std::make_shared(info)); } -void ArkWebHandlerImpl::ShowMagnifier() +void ArkWebHandlerImpl::OnInsertBlanklessFrame(const ArkWebString& pathToFrame) { - nweb_handler_->ShowMagnifier(); + nweb_handler_->OnInsertBlanklessFrame(ArkWebStringStructToClass(pathToFrame)); } -void ArkWebHandlerImpl::HideMagnifier() +void ArkWebHandlerImpl::OnRemoveBlanklessFrame(int delayTime) { - nweb_handler_->HideMagnifier(); + nweb_handler_->OnRemoveBlanklessFrame(delayTime); } -void ArkWebHandlerImpl::OnPageTitleV2(const ArkWebString& title, bool isRealTitle) +void ArkWebHandlerImpl::ShowMagnifier() { - nweb_handler_->OnPageTitleV2(ArkWebStringStructToClass(title), isRealTitle); + nweb_handler_->ShowMagnifier(); } -void ArkWebHandlerImpl::OnInsertBlanklessFrame(const ArkWebString& pathToFrame) +void ArkWebHandlerImpl::HideMagnifier() { - nweb_handler_->OnInsertBlanklessFrame(ArkWebStringStructToClass(pathToFrame)); + nweb_handler_->HideMagnifier(); } -void ArkWebHandlerImpl::OnRemoveBlanklessFrame(int delayTime) +void ArkWebHandlerImpl::OnPageTitleV2(const ArkWebString& title, bool isRealTitle) { - nweb_handler_->OnRemoveBlanklessFrame(delayTime); + nweb_handler_->OnPageTitleV2(ArkWebStringStructToClass(title), isRealTitle); } ArkWebString ArkWebHandlerImpl::OnHandleOverrideErrorPage( diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h index bd471997b..8c9debf79 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_handler_impl.h @@ -527,27 +527,27 @@ public: void UpdateClippedSelectionBounds(int x, int y, int w, int h) override; - bool OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) override; - void OnRenderProcessNotResponding(const ArkWebString& js_stack, int pid, int reason) override; void OnRenderProcessResponding() override; + bool OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) override; + void OnShowAutofillPopup(const float offsetX, const float offsetY, const ArkWebStringVector& menu_items) override; void OnHideAutofillPopup() override; void OnViewportFitChange(int viewportFit) override; + bool OnFocus(int source) override; + + bool OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) override; + void 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) override; void OnOverlayStateChanged(int offset_x, int offset_y, int rect_width, int rect_height) override; - bool OnFocus(int source) override; - - bool OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) override; - - void KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) override; + void OnAdsBlocked(const ArkWebString& url, const ArkWebStringVector& adsBlocked) override; void OnInterceptKeyboardAttach(ArkWebRefPtr keyboardHandler, const ArkWebStringMap &attributes, bool &useSystemKeyboard, int32_t &enterKeyType) override; @@ -556,32 +556,34 @@ public: void OnCustomKeyboardClose() override; - void OnAdsBlocked(const ArkWebString &url, const ArkWebStringVector &adsBlocked) override; - - void OnCursorUpdate(double x, double y, double width, double height) override; - - void ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) override; + void KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) override; void HideHandleAndQuickMenuIfNecessary(bool hide) override; + void OnCursorUpdate(double x, double y, double width, double height) override; + void ChangeVisibilityOfQuickMenu() override; void StartVibraFeedback(const ArkWebString& vibratorType) override; + void OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) override; + + bool CloseImageOverlaySelection() override; + void OnPopupSize(int x, int y, int width, int height) override; void OnPopupShow(bool show) override; - void OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) override; + void OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) override; - bool CloseImageOverlaySelection() override; + void ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) override; + + bool IsCurrentFocus() override; + + bool ChangeVisibilityOfQuickMenuV2() override; bool OnSslErrorRequestByJSV2(ArkWebRefPtr result, int error, const ArkWebStringVector& certChainData) override; - - void OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) override; - - bool IsCurrentFocus() override; void GetVisibleRectToWeb(int& visibleX, int& visibleY, int& visibleWidth, int& visibleHeight) override; @@ -596,16 +598,14 @@ public: bool OnNestedScroll(float& x, float& y, float& xVelocity, float& yVelocity, bool& isAvailable) override; - void EnableSecurityLayer(bool isNeedSecurityLayer) override; + /** + * @brief called when the web page is active for window.open called by other web component. + */ + void OnActivateContentByJS() override; - bool ChangeVisibilityOfQuickMenuV2() override; + void OnLoadStarted(const ArkWebString& url) override; - void OnPip(int status, - int delegate_id, - int child_id, - int frame_routing_id, - int width, - int height) override; + void OnLoadFinished(const ArkWebString& url) override; /** * @brief Notify the host application that the web page wants to handle @@ -625,22 +625,35 @@ public: void OnNativeEmbedMouseEvent(ArkWebRefPtr mouse_event) override; - /** - * @brief called when the web page is active for window.open called by other web component. - */ - void OnActivateContentByJS() override; + void OnPip(int status, + int delegate_id, + int child_id, + int frame_routing_id, + int width, + int height) override; + + void EnableSecurityLayer(bool isNeedSecurityLayer) override; - void OnLoadStarted(const ArkWebString& url) override; + bool OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, + ArkWebRefPtr info) override; - void OnLoadFinished(const ArkWebString& url) override; + /** + * @brief Notify the web client to do something for blankless. + * + * @param pathToFrame The file used to insert frame. If empty, means remove frame. + */ + void OnInsertBlanklessFrame(const ArkWebString& pathToFrame) override; - bool OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, int error, const ArkWebString& url, - const ArkWebString& originalUrl, const ArkWebString& referrer, bool isFatalError, bool isMainFrame, - const ArkWebStringVector& certChainData) override; + /** + * @brief Notify the web client to remove blankless frame. + * + * @param delayTime The delayTime for web client to remove blankless frame. + */ + void OnRemoveBlanklessFrame(int delayTime) override; /** * @brief Called when you need to show magnifier. - */ + */ void ShowMagnifier() override; /** @@ -657,20 +670,6 @@ public: */ void OnPageTitleV2(const ArkWebString& title, bool isRealTitle) override; - /** - * @brief Notify the web client to do something for blankless. - * - * @param pathToFrame The file used to insert frame. If empty, means remove frame. - */ - void OnInsertBlanklessFrame(const ArkWebString& pathToFrame) override; - - /** - * @brief Notify the web client to remove blankless frame. - * - * @param delayTime The delayTime for web client to remove blankless frame. - */ - void OnRemoveBlanklessFrame(int delayTime) override; - /** * @brief Triggered when the web page's document resource error * diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.cpp index be963d698..aa92a1491 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.cpp @@ -13,25 +13,24 @@ * limitations under the License. */ - #include "ohos_nweb/bridge/ark_web_js_proxy_method_impl.h" +#include "ohos_nweb/bridge/ark_web_js_proxy_method_impl.h" - #include "base/bridge/ark_web_bridge_macros.h" - - namespace OHOS::ArkWeb { - - ArkWebJsProxyMethodImpl::ArkWebJsProxyMethodImpl(std::shared_ptr data) - : nweb_data_(data) {} - - - int32_t ArkWebJsProxyMethodImpl::GetSize() - { - return nweb_data_->GetSize(); - } - - void ArkWebJsProxyMethodImpl::OnHandle(int32_t number, const ArkWebStringVector& param) - { - return nweb_data_->OnHandle(number, ArkWebStringVectorStructToClass(param)); - } - - } // namespace OHOS::ArkWeb - \ No newline at end of file +#include "base/bridge/ark_web_bridge_macros.h" + +namespace OHOS::ArkWeb { + +ArkWebJsProxyMethodImpl::ArkWebJsProxyMethodImpl(std::shared_ptr data) + :nweb_data_(data) +{} + +int ArkWebJsProxyMethodImpl::GetSize() +{ + return nweb_data_->GetSize(); +} + +void ArkWebJsProxyMethodImpl::OnHandle(int number, const ArkWebStringVector& param) +{ + return nweb_data_->OnHandle(number, ArkWebStringVectorStructToClass(param)); +} + +} // namespace OHOS::ArkWeb \ No newline at end of file diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.h index 02b950c2d..c1e19def0 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_js_proxy_method_impl.h @@ -13,31 +13,30 @@ * limitations under the License. */ - #ifndef ARK_WEB_JS_PROXY_METHOD_IMPL_H_ - #define ARK_WEB_JS_PROXY_METHOD_IMPL_H_ - #pragma once - - #include "include/nweb.h" - #include "ohos_nweb/include/ark_web_js_proxy_method.h" - - namespace OHOS::ArkWeb { - - class ArkWebJsProxyMethodImpl : public ArkWebJsProxyMethod { - IMPLEMENT_REFCOUNTING(ArkWebJsProxyMethodImpl); - - public: - ArkWebJsProxyMethodImpl(std::shared_ptr data); - ~ArkWebJsProxyMethodImpl() = default; - - int32_t GetSize() override; - - void OnHandle(int32_t number, const ArkWebStringVector& param) override; - - private: - std::shared_ptr nweb_data_; - }; - - } // namespace OHOS::ArkWeb - - #endif // ARK_WEB_JS_PROXY_METHOD_IMPL_H_ - \ No newline at end of file +#ifndef ARK_WEB_JS_PROXY_METHOD_IMPL_H_ +#define ARK_WEB_JS_PROXY_METHOD_IMPL_H_ +#pragma once + +#include "include/nweb.h" +#include "ohos_nweb/include/ark_web_js_proxy_method.h" + +namespace OHOS::ArkWeb { + +class ArkWebJsProxyMethodImpl : public ArkWebJsProxyMethod { + IMPLEMENT_REFCOUNTING(ArkWebJsProxyMethodImpl); + +public: + ArkWebJsProxyMethodImpl(std::shared_ptr data); + ~ArkWebJsProxyMethodImpl() = default; + + virtual int GetSize() override; + + virtual void OnHandle(int number, const ArkWebStringVector& param) override; + +private: + std::shared_ptr nweb_data_; +}; + +} // namespace OHOS::ArkWeb + +#endif // ARK_WEB_JS_PROXY_METHOD_IMPL_H_ \ No newline at end of file diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.cpp index f28a930ab..1915357d6 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.h index 2cc0c00e8..8f62dabcc 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_mouse_event_result_wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.cpp index 2ebfb8c1d..561f3bdd1 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.h index 763bda0df..99588fcf0 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_native_embed_mouse_event_wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp index bfdfecba3..59b172e1e 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.cpp @@ -38,6 +38,7 @@ #include "ohos_nweb/bridge/ark_web_release_surface_callback_impl.h" #include "ohos_nweb/bridge/ark_web_rom_value_impl.h" #include "ohos_nweb/bridge/ark_web_screen_lock_callback_impl.h" +#include "ohos_nweb/bridge/ark_web_snapshot_callback_impl.h" #include "ohos_nweb/bridge/ark_web_spanstring_convert_html_callback_impl.h" #include "ohos_nweb/bridge/ark_web_string_value_callback_impl.h" #include "ohos_nweb/bridge/ark_web_system_configuration_impl.h" @@ -1118,17 +1119,6 @@ void ArkWebNWebWrapper::SendTouchpadFlingEvent(double x, double y, double vx, do { ark_web_nweb_->SendTouchpadFlingEvent(x, y, vx, vy); } - -void ArkWebNWebWrapper::DragResize(uint32_t width, uint32_t height, uint32_t pre_height, uint32_t pre_width) -{ - ark_web_nweb_->DragResize(width, height, pre_height, pre_width); -} - -void ArkWebNWebWrapper::OnTouchCancelById(int32_t id, double x, double y, bool from_overlay) -{ - ark_web_nweb_->OnTouchCancelById(id, x, y, from_overlay); -} - void ArkWebNWebWrapper::InjectOfflineResource(const std::string& url, const std::string& origin, const std::vector& resource, const std::map& responseHeaders, const int type) { @@ -1393,24 +1383,6 @@ void ArkWebNWebWrapper::SendAccessibilityHoverEvent(int32_t x, int32_t y) ark_web_nweb_->SendAccessibilityHoverEvent(x, y); } -void ArkWebNWebWrapper::GetScrollOffset(float* offset_x, float* offset_y) -{ - ark_web_nweb_->GetScrollOffset(offset_x, offset_y); -} - -void ArkWebNWebWrapper::ExecuteCreatePDFExt(std::shared_ptr pdfConfig, - std::shared_ptr callback) -{ - if (CHECK_SHARED_PTR_IS_NULL(callback)) { - ark_web_nweb_->ExecuteCreatePDFExt( - new ArkWebPDFConfigArgsImpl(CHECK_SHARED_PTR_IS_NULL(pdfConfig) ? nullptr : pdfConfig), nullptr); - } else { - ark_web_nweb_->ExecuteCreatePDFExt( - new ArkWebPDFConfigArgsImpl(CHECK_SHARED_PTR_IS_NULL(pdfConfig) ? nullptr : pdfConfig), - new ArkWebArrayBufferValueCallbackImpl(callback)); - } -} - bool ArkWebNWebWrapper::ScrollByWithResult(float delta_x, float delta_y) { return ark_web_nweb_->ScrollByWithResult(delta_x, delta_y); @@ -1431,6 +1403,11 @@ void ArkWebNWebWrapper::ScrollByWithAnime(float delta_x, float delta_y, int32_t ark_web_nweb_->ScrollByWithAnime(delta_x, delta_y, duration); } +void ArkWebNWebWrapper::GetScrollOffset(float* offset_x, float* offset_y) +{ + ark_web_nweb_->GetScrollOffset(offset_x, offset_y); +} + void ArkWebNWebWrapper::SetPopupSurface(void* popupSurface) { ark_web_nweb_->SetPopupSurface(popupSurface); @@ -1446,6 +1423,24 @@ void ArkWebNWebWrapper::WebSendMouseEvent(const std::shared_ptrWebSendMouseEvent(new ArkWebMouseEventImpl(mouseEvent)); } +void ArkWebNWebWrapper::SetSurfaceDensity(const double& density) +{ + ark_web_nweb_->SetSurfaceDensity(density); +} + +void ArkWebNWebWrapper::ExecuteCreatePDFExt(std::shared_ptr pdfConfig, + std::shared_ptr callback) +{ + if (CHECK_SHARED_PTR_IS_NULL(callback)) { + ark_web_nweb_->ExecuteCreatePDFExt( + new ArkWebPDFConfigArgsImpl(CHECK_SHARED_PTR_IS_NULL(pdfConfig) ? nullptr : pdfConfig), nullptr); + } else { + ark_web_nweb_->ExecuteCreatePDFExt( + new ArkWebPDFConfigArgsImpl(CHECK_SHARED_PTR_IS_NULL(pdfConfig) ? nullptr : pdfConfig), + new ArkWebArrayBufferValueCallbackImpl(callback)); + } +} + bool ArkWebNWebWrapper::GetAccessibilityVisible(int64_t accessibility_id) { return ark_web_nweb_->GetAccessibilityVisible(accessibility_id); @@ -1461,11 +1456,6 @@ void ArkWebNWebWrapper::WebComponentsBlur() ark_web_nweb_->WebComponentsBlur(); } -float ArkWebNWebWrapper::DumpGpuInfo() -{ - return ark_web_nweb_->DumpGpuInfo(); -} - int ArkWebNWebWrapper::ScaleGestureChangeV2(int type, double scale, double originScale, @@ -1485,16 +1475,6 @@ bool ArkWebNWebWrapper::SendKeyboardEvent(const std::shared_ptrSendKeyboardEvent(new ArkWebKeyboardEventImpl(keyboardEvent)); } -bool ArkWebNWebWrapper::PerformActionV2(int64_t accessibility_id, uint32_t action, - const std::map& actionArguments) -{ - ArkWebStringMap stArguments = ArkWebStringMapClassToStruct(actionArguments); - bool res = ark_web_nweb_->PerformActionV2(accessibility_id, action, stArguments); - - ArkWebStringMapStructRelease(stArguments); - return res; -} - bool ArkWebNWebWrapper::IsActivePolicyDisable() { return ark_web_nweb_->IsActivePolicyDisable(); @@ -1505,12 +1485,35 @@ void ArkWebNWebWrapper::PutOptimizeParserBudgetEnabled(bool enable) ark_web_nweb_->PutOptimizeParserBudgetEnabled(enable); } +void ArkWebNWebWrapper::DragResize(uint32_t width, + uint32_t height, + uint32_t pre_height, + uint32_t pre_width) +{ + ark_web_nweb_->DragResize(width, height, pre_height, pre_width); +} + +bool ArkWebNWebWrapper::PerformActionV2(int64_t accessibility_id, uint32_t action, + const std::map& actionArguments) +{ + ArkWebStringMap stArguments = ArkWebStringMapClassToStruct(actionArguments); + bool res = ark_web_nweb_->PerformActionV2(accessibility_id, action, stArguments); + + ArkWebStringMapStructRelease(stArguments); + return res; +} + bool ArkWebNWebWrapper::GetAccessibilityNodeRectById( int64_t accessibilityId, int32_t* width, int32_t* height, int32_t* offsetX, int32_t* offsetY) { return ark_web_nweb_->GetAccessibilityNodeRectById(accessibilityId, width, height, offsetX, offsetY); } +float ArkWebNWebWrapper::DumpGpuInfo() +{ + return ark_web_nweb_->DumpGpuInfo(); +} + std::shared_ptr ArkWebNWebWrapper::GetLastHitTestResult() { ArkWebRefPtr ark_web_last_hit_test_result = ark_web_nweb_->GetLastHitTestResult(); @@ -1521,12 +1524,47 @@ std::shared_ptr ArkWebNWebWrapper::GetLastHitTestResu return std::make_shared(ark_web_last_hit_test_result); } +void ArkWebNWebWrapper::MaximizeResize() +{ + ark_web_nweb_->MaximizeResize(); +} + +void ArkWebNWebWrapper::RegisterNativeJavaScriptProxy(const std::string& objName, + const std::vector& methodName, + std::shared_ptr data, + bool isAsync, + const std::string& permission) +{ + ArkWebString stObjName = ArkWebStringClassToStruct(objName); + ArkWebStringVector stMethodName = ArkWebStringVectorClassToStruct(methodName); + ArkWebString stPermission = ArkWebStringClassToStruct(permission); + + if (CHECK_SHARED_PTR_IS_NULL(data)) { + ark_web_nweb_->RegisterNativeJavaScriptProxy(stObjName, + stMethodName, + nullptr, + isAsync, + stPermission); + } else { + ark_web_nweb_->RegisterNativeJavaScriptProxy(stObjName, + stMethodName, + new ArkWebJsProxyMethodImpl(data), + isAsync, + stPermission); + } + + ArkWebStringStructRelease(stObjName); + ArkWebStringVectorStructRelease(stMethodName); + ArkWebStringStructRelease(stPermission); +} + std::string ArkWebNWebWrapper::GetCurrentLanguage() { return ArkWebStringStructToClass(ark_web_nweb_->GetCurrentLanguage()); } + bool ArkWebNWebWrapper::WebSendMouseWheelEventV2( - double x, double y, double delta_x, double delta_y, const std::vector &pressedCodes, int32_t source) + double x, double y, double delta_x, double delta_y, const std::vector &pressedCodes, int32_t source) { ArkWebInt32Vector pCodes = ArkWebBasicVectorClassToStruct(pressedCodes); @@ -1536,6 +1574,11 @@ bool ArkWebNWebWrapper::WebSendMouseWheelEventV2( return result; } +void ArkWebNWebWrapper::OnDragAttach() +{ + ark_web_nweb_->OnDragAttach(); +} + bool ArkWebNWebWrapper::IsNWebEx() { return ark_web_nweb_->IsNWebEx(); @@ -1546,85 +1589,86 @@ void ArkWebNWebWrapper::SetEnableHalfFrameRate(bool enabled) ark_web_nweb_->SetEnableHalfFrameRate(enabled); } -void ArkWebNWebWrapper::MaximizeResize() +bool ArkWebNWebWrapper::SetFocusByPosition(float x, float y) { - ark_web_nweb_->MaximizeResize(); + return ark_web_nweb_->SetFocusByPosition(x, y); } -void ArkWebNWebWrapper::OnDragAttach() +void ArkWebNWebWrapper::SetNativeInnerWeb(bool isInnerWeb) { - ark_web_nweb_->OnDragAttach(); + ark_web_nweb_->SetNativeInnerWeb(isInnerWeb); } -bool ArkWebNWebWrapper::SetFocusByPosition(float x, float y) +void ArkWebNWebWrapper::SendAccessibilityHoverEventV2(int32_t x, int32_t y, bool isHoverEnter) { - return ark_web_nweb_->SetFocusByPosition(x, y); + ark_web_nweb_->SendAccessibilityHoverEventV2(x, y, isHoverEnter); } -void ArkWebNWebWrapper::SetSurfaceDensity(const double& density) +void ArkWebNWebWrapper::OnBrowserForeground() { - ark_web_nweb_->SetSurfaceDensity(density); + ark_web_nweb_->OnBrowserForeground(); } -void ArkWebNWebWrapper::SetBorderRadiusFromWeb(double borderRadiusTopLeft, double borderRadiusTopRight, - double borderRadiusBottomLeft, double borderRadiusBottomRight) +void ArkWebNWebWrapper::OnBrowserBackground() { - ark_web_nweb_->SetBorderRadiusFromWeb( - borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomLeft, borderRadiusBottomRight); + ark_web_nweb_->OnBrowserBackground(); } -void ArkWebNWebWrapper::SetNativeInnerWeb(bool isInnerWeb) +void ArkWebNWebWrapper::SetFocusWindowId(uint32_t focus_window_id) { - ark_web_nweb_->SetNativeInnerWeb(isInnerWeb); + ark_web_nweb_->SetFocusWindowId(focus_window_id); } -void ArkWebNWebWrapper::SendAccessibilityHoverEventV2(int32_t x, int32_t y, bool isHoverEnter) +int ArkWebNWebWrapper::GetSelectStartIndex() { - ark_web_nweb_->SendAccessibilityHoverEventV2(x, y, isHoverEnter); + return ark_web_nweb_->GetSelectStartIndex(); } -void ArkWebNWebWrapper::OnBrowserForeground() +int ArkWebNWebWrapper::GetSelectEndIndex() { - ark_web_nweb_->OnBrowserForeground(); + return ark_web_nweb_->GetSelectEndIndex(); } -void ArkWebNWebWrapper::OnBrowserBackground() +std::string ArkWebNWebWrapper::GetAllTextInfo() { - ark_web_nweb_->OnBrowserBackground(); + ArkWebString allTextInfo = ark_web_nweb_->GetAllTextInfo(); + std::string allText = ArkWebStringStructToClass(allTextInfo); + ArkWebStringStructRelease(allTextInfo); + return allText; } -void ArkWebNWebWrapper::RegisterNativeJavaScriptProxy(const std::string& objName, - const std::vector& methodName, std::shared_ptr data, - bool isAsync, const std::string& permission) +void ArkWebNWebWrapper::CallH5FunctionV2(int32_t routing_id, int32_t h5_object_id, const std::string& h5_method_name, + const std::vector>& args) { - ArkWebString stObjName = ArkWebStringClassToStruct(objName); - ArkWebStringVector stMethodName = ArkWebStringVectorClassToStruct(methodName); - ArkWebString stPermission = ArkWebStringClassToStruct(permission); + ArkWebString stH5MethodName = ArkWebStringClassToStruct(h5_method_name); + ArkWebRomValueVector stArgs = ArkWebRomValueVectorClassToStruct(args); + ark_web_nweb_->CallH5FunctionV2(routing_id, h5_object_id, stH5MethodName, stArgs); + ArkWebStringStructRelease(stH5MethodName); + ArkWebRomValueVectorStructRelease(stArgs); +} +void ArkWebNWebWrapper::PostPortMessageV2(const std::string& portHandle, std::shared_ptr data) +{ + ArkWebString stPortHandle = ArkWebStringClassToStruct(portHandle); if (CHECK_SHARED_PTR_IS_NULL(data)) { - ark_web_nweb_->RegisterNativeJavaScriptProxy(stObjName, - stMethodName, - nullptr, - isAsync, - stPermission); + ark_web_nweb_->PostPortMessageV2(stPortHandle, nullptr); } else { - ark_web_nweb_->RegisterNativeJavaScriptProxy(stObjName, - stMethodName, - new ArkWebJsProxyMethodImpl(data), - isAsync, - stPermission); + ark_web_nweb_->PostPortMessageV2(stPortHandle, new ArkWebRomValueImpl(data)); } - - ArkWebStringStructRelease(stObjName); - ArkWebStringVectorStructRelease(stMethodName); - ArkWebStringStructRelease(stPermission); + ArkWebStringStructRelease(stPortHandle); } -void ArkWebNWebWrapper::SetFocusWindowId(uint32_t focus_window_id) +void ArkWebNWebWrapper::FillAutofillDataV2(std::shared_ptr data) { - ark_web_nweb_->SetFocusWindowId(focus_window_id); + if (CHECK_SHARED_PTR_IS_NULL(data)) { + ark_web_nweb_->FillAutofillDataV2(nullptr); + return; + } + + ark_web_nweb_->FillAutofillDataV2(new ArkWebRomValueImpl(data)); } + void ArkWebNWebWrapper::RunDataDetectorJS() { ark_web_nweb_->RunDataDetectorJS(); @@ -1647,6 +1691,13 @@ void ArkWebNWebWrapper::OnDataDetectorCopy(const std::vector& recor ArkWebStringVectorStructRelease(cRecordMix); } +void ArkWebNWebWrapper::SetBorderRadiusFromWeb(double borderRadiusTopLeft, double borderRadiusTopRight, + double borderRadiusBottomLeft, double borderRadiusBottomRight) +{ + ark_web_nweb_->SetBorderRadiusFromWeb( + borderRadiusTopLeft, borderRadiusTopRight, borderRadiusBottomLeft, borderRadiusBottomRight); +} + void ArkWebNWebWrapper::SetPipNativeWindow(int delegate_id, int child_id, int frame_routing_id, @@ -1678,25 +1729,7 @@ void ArkWebNWebWrapper::SetPrivacyStatus(bool isPrivate) { ark_web_nweb_->SetPrivacyStatus(isPrivate); } - -int ArkWebNWebWrapper::GetSelectStartIndex() -{ - return ark_web_nweb_->GetSelectStartIndex(); -} - -int ArkWebNWebWrapper::GetSelectEndIndex() -{ - return ark_web_nweb_->GetSelectEndIndex(); -} - -std::string ArkWebNWebWrapper::GetAllTextInfo() -{ - ArkWebString allTextInfo = ark_web_nweb_->GetAllTextInfo(); - std::string allText = ArkWebStringStructToClass(allTextInfo); - ArkWebStringStructRelease(allTextInfo); - return allText; -} - + void ArkWebNWebWrapper::SetAudioSessionType(int32_t audio_session_type) { ark_web_nweb_->SetAudioSessionType(audio_session_type); @@ -1730,6 +1763,19 @@ int32_t ArkWebNWebWrapper::SetBlanklessLoadingWithKey(const std::string& key, bo return errCode; } +bool ArkWebNWebWrapper::TriggerBlanklessForUrl(const std::string& url) +{ + ArkWebString url_ = ArkWebStringClassToStruct(url); + bool ret = ark_web_nweb_->TriggerBlanklessForUrl(url_); + ArkWebStringStructRelease(url_); + return ret; +} + +void ArkWebNWebWrapper::SetVisibility(bool isVisible) +{ + ark_web_nweb_->SetVisibility(isVisible); +} + void ArkWebNWebWrapper::UpdateSingleHandleVisible(bool isVisible) { ark_web_nweb_->UpdateSingleHandleVisible(isVisible); @@ -1740,6 +1786,11 @@ void ArkWebNWebWrapper::SetTouchHandleExistState(bool touchHandleExist) ark_web_nweb_->SetTouchHandleExistState(touchHandleExist); } +void ArkWebNWebWrapper::GetPageOffset(float* offset_x, float* offset_y) +{ + ark_web_nweb_->GetPageOffset(offset_x, offset_y); +} + void ArkWebNWebWrapper::AvoidVisibleViewportBottom(int32_t avoidHeight) { ark_web_nweb_->AvoidVisibleViewportBottom(avoidHeight); @@ -1750,29 +1801,11 @@ int32_t ArkWebNWebWrapper::GetVisibleViewportAvoidHeight() return ark_web_nweb_->GetVisibleViewportAvoidHeight(); } -bool ArkWebNWebWrapper::TriggerBlanklessForUrl(const std::string& url) -{ - ArkWebString url_ = ArkWebStringClassToStruct(url); - bool ret = ark_web_nweb_->TriggerBlanklessForUrl(url_); - ArkWebStringStructRelease(url_); - return ret; -} - -void ArkWebNWebWrapper::SetVisibility(bool isVisible) -{ - ark_web_nweb_->SetVisibility(isVisible); -} - void ArkWebNWebWrapper::SetViewportScaleState() { ark_web_nweb_->SetViewportScaleState(); } -void ArkWebNWebWrapper::GetPageOffset(float* offset_x, float* offset_y) -{ - ark_web_nweb_->GetPageOffset(offset_x, offset_y); -} - void ArkWebNWebWrapper::SetErrorPageEnabled(bool enable) { ark_web_nweb_->SetErrorPageEnabled(enable); @@ -1788,35 +1821,4 @@ ArkWebDestroyMode ArkWebNWebWrapper::GetWebDestroyMode() int res = ark_web_nweb_->GetWebDestroyMode(); return static_cast(res); } - -void ArkWebNWebWrapper::CallH5FunctionV2(int32_t routing_id, int32_t h5_object_id, const std::string& h5_method_name, - const std::vector>& args) -{ - ArkWebString stH5MethodName = ArkWebStringClassToStruct(h5_method_name); - ArkWebRomValueVector stArgs = ArkWebRomValueVectorClassToStruct(args); - ark_web_nweb_->CallH5FunctionV2(routing_id, h5_object_id, stH5MethodName, stArgs); - ArkWebStringStructRelease(stH5MethodName); - ArkWebRomValueVectorStructRelease(stArgs); -} - -void ArkWebNWebWrapper::PostPortMessageV2(const std::string& portHandle, std::shared_ptr data) -{ - ArkWebString stPortHandle = ArkWebStringClassToStruct(portHandle); - if (CHECK_SHARED_PTR_IS_NULL(data)) { - ark_web_nweb_->PostPortMessageV2(stPortHandle, nullptr); - } else { - ark_web_nweb_->PostPortMessageV2(stPortHandle, new ArkWebRomValueImpl(data)); - } - ArkWebStringStructRelease(stPortHandle); -} - -void ArkWebNWebWrapper::FillAutofillDataV2(std::shared_ptr data) -{ - if (CHECK_SHARED_PTR_IS_NULL(data)) { - ark_web_nweb_->FillAutofillDataV2(nullptr); - return; - } - - ark_web_nweb_->FillAutofillDataV2(new ArkWebRomValueImpl(data)); -} } // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h index c5e593afc..9fb9adc36 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_nweb_wrapper.h @@ -18,6 +18,7 @@ #pragma once #include "include/nweb.h" +#include "include/nweb_snapshot_callback.h" #include "ohos_nweb/include/ark_web_nweb.h" namespace OHOS::ArkWeb { @@ -1023,14 +1024,6 @@ public: /*--ark web()--*/ void SendTouchpadFlingEvent(double x, double y, double vx, double vy) override; - /** - * @brief Web drag resize optimize. - */ - /*--ark web()--*/ - void DragResize(uint32_t width, uint32_t height, uint32_t pre_height, uint32_t pre_width) override; - - void OnTouchCancelById(int32_t id, double x, double y, bool from_overlay) override; - /** * @brief Inject offline resource into MemoryCache. * @@ -1300,24 +1293,6 @@ public: /*--ark web()--*/ void SendAccessibilityHoverEvent(int32_t x, int32_t y) override; - /** - * @brief Get the current scroll offset of the webpage. - * @param offset_x The current horizontal scroll offset of the webpage. - * @param offset_y The current vertical scroll offset of the webpage. - */ - /*--ark web()--*/ - void GetScrollOffset(float* offset_x, float* offset_y) override; - - /** - * @brief ExecuteCreatePDF - * - * @param pdfConfig The current configuration when creating pdf. - * @param callback NWebArrayBufferValueCallback: CreatePDF running result. - */ - /*--ark web()--*/ - void ExecuteCreatePDFExt(std::shared_ptr pdfConfig, - std::shared_ptr callback) override; - /** * @brief Scroll by the delta distance. * @param delta_x: horizontal offset. @@ -1353,6 +1328,14 @@ public: /*--ark web()--*/ void ScrollByWithAnime(float delta_x, float delta_y, int32_t duration) override; + /** + * @brief Get the current scroll offset of the webpage. + * @param offset_x The current horizontal scroll offset of the webpage. + * @param offset_y The current vertical scroll offset of the webpage. + */ + /*--ark web()--*/ + void GetScrollOffset(float* offset_x, float* offset_y) override; + /** * @brief set a popupSurface to draw popup content * @param popupSurface popupSurface. @@ -1368,11 +1351,27 @@ public: /*--ark web()--*/ void WebSendMouseEvent(const std::shared_ptr& mouseEvent) override; + /** + * @brief set surface density when DPI is changed + * @param density density. + */ + /*--ark web()--*/ + void SetSurfaceDensity(const double& density) override; + + /** + * @brief ExecuteCreatePDF + * + * @param pdfConfig The current configuration when creating pdf. + * @param callback NWebArrayBufferValueCallback: CreatePDF running result. + */ + /*--ark web()--*/ + void ExecuteCreatePDFExt(std::shared_ptr pdfConfig, + std::shared_ptr callback) override; + /** * @Description: Get the accessibility visibility of the accessibility node by its accessibility id in the browser. * @Input accessibility_id: The accessibility id of the accessibility node. * @Return: The accessibility visibility of the accessibility node. - * @Since: 12005 */ /*--ark web()--*/ bool GetAccessibilityVisible(int64_t accessibility_id) override; @@ -1391,13 +1390,6 @@ public: /*--ark web()--*/ void WebComponentsBlur() override; - /** - * @Description: Get the GPU memory size used by web. - * @Return: Total size of web GPU. - */ - /*--ark web()--*/ - float DumpGpuInfo() override; - /** * @brief Set the params when the scale of WebView changed by pinch gestrue. * @@ -1422,19 +1414,11 @@ public: /*--ark web()--*/ bool SendKeyboardEvent(const std::shared_ptr& keyboardEvent) override; - /** - * @Description: Execute an accessibility action on an accessibility node in the browser. - * @Input accessibilityId: The id of the accessibility node. - * @Input action: The action to be performed on the accessibility node. - * @Input actionArguments: Data related to the current action. - * @Return: Whether the action is performed successfully. - */ - /*--ark web()--*/ - bool PerformActionV2(int64_t accessibilityId, uint32_t action, - const std::map& actionArguments) override; - /** * @brief Inject the JavaScript before WebView load the DOM tree. + * + * @param script_items: Multiple injected JavaScript codes are stored in a map in lexicographical order. + * @param script_items_by_order: Multiple injected JavaScript codes are stored in the order of injection. */ void JavaScriptOnDocumentStartByOrder(const std::map>& script_items, const std::vector& script_items_by_order) override; @@ -1442,6 +1426,9 @@ public: /** * @brief Inject the JavaScript after WebView loads the DOM tree and run * JavaScripts. + * + * @param script_items: Multiple injected JavaScript codes are stored in a map in lexicographical order. + * @param script_items_by_order: Multiple injected JavaScript codes are stored in the order of injection. */ void JavaScriptOnDocumentEndByOrder(const std::map>& script_items, const std::vector& script_items_by_order) override; @@ -1453,6 +1440,21 @@ public: /*--ark web()--*/ virtual bool IsActivePolicyDisable() override; + /** + * @Description: Optimize HTML parser budget to reduce FCP time. + * @Input enable: Set whether to use optimized parser budget. + */ + void PutOptimizeParserBudgetEnabled(bool enable) override; + + /** + * @brief Web drag resize optimize. + */ + /*--ark web()--*/ + void DragResize(uint32_t width, + uint32_t height, + uint32_t pre_height, + uint32_t pre_width) override; + /** * @Description: Inject the JavaScript when the head element has been created. * @Input scriptItems: The injected JavaScript code is stored in lexicographical order. @@ -1463,10 +1465,15 @@ public: const std::vector& script_items_by_order) override; /** - * @Description: Optimize HTML parser budget to reduce FCP time. - * @Input enable: Set whether to use optimized parser budget. + * @Description: Execute an accessibility action on an accessibility node in the browser. + * @Input accessibilityId: The id of the accessibility node. + * @Input action: The action to be performed on the accessibility node. + * @Input actionArguments: Data related to the current action. + * @Return: Whether the action is performed successfully. */ - void PutOptimizeParserBudgetEnabled(bool enable) override; + /*--ark web()--*/ + bool PerformActionV2(int64_t accessibilityId, uint32_t action, + const std::map& actionArguments) override; /** * @Description: Get the bounding rectangle of the accessibility node of the given id. @@ -1481,6 +1488,12 @@ public: bool GetAccessibilityNodeRectById( int64_t accessibilityId, int32_t* width, int32_t* height, int32_t* offsetX, int32_t* offsetY) override; + /** @Description: Get the GPU memory size used by web. + * @Return: Total size of web GPU. + */ + /*--ark web()--*/ + float DumpGpuInfo() override; + /** * @brief Gets the last hit test result. * @@ -1489,33 +1502,34 @@ public: std::shared_ptr GetLastHitTestResult() override; /** - * @Description: Get the current language in the webview. - * @Return: The current language in the webview. - */ - std::string GetCurrentLanguage() override; - - /* - * @brief Send mouse wheel event with sourceTool info. + * @brief Web maximize resize optimize. */ /*--ark web()--*/ - bool WebSendMouseWheelEventV2(double x, double y, double delta_x, double delta_y, - const std::vector &pressedCodes, int32_t source) override; + void MaximizeResize() override; /** - * @brief judge if browser use drag resize. + * @Description: register javascript proxy. */ - bool IsNWebEx() override; + /*--ark web()--*/ + void RegisterNativeJavaScriptProxy(const std::string& objName, + const std::vector& methodName, + std::shared_ptr data, + bool isAsync, + const std::string& permission) override; /** - * @brief Set enable Half the frame rate. + * @Description: Get the current language in the webview. + * @Return: The current language in the webview. */ - void SetEnableHalfFrameRate(bool enabled) override; + /*--ark web()--*/ + std::string GetCurrentLanguage() override; /** - * @brief Web maximize resize optimize. + * @brief Send mouse wheel event with sourceTool info. */ /*--ark web()--*/ - void MaximizeResize() override; + bool WebSendMouseWheelEventV2(double x, double y, double delta_x, double delta_y, + const std::vector &pressedCodes, int32_t source) override; /** * @brief Try to attach web inputmethod after drag. @@ -1523,29 +1537,21 @@ public: void OnDragAttach() override; /** - * Set focus by position - * - * @Return: if hit node editable. + * @brief judge if browser use drag resize */ - bool SetFocusByPosition(float x, float y) override; + bool IsNWebEx() override; /** - * @brief set DPI when DPI changes. - * @param density The new density value. + * @brief Set enable Half the frame rate. */ - /*--ark web()--*/ - void SetSurfaceDensity(const double& density) override; + void SetEnableHalfFrameRate(bool enabled) override; /** - * @brief When the user sets the webpage's border radius, - * update Chromium with this radius value for repaint the scrollbar. - * @param borderRadiusTopLeft: Radius value of the rounded corner in the top-left of the webpage. - * @param borderRadiusTopRight: Radius value of the rounded corner in the top-right of the webpage. - * @param borderRadiusBottomLeft: Radius value of the rounded corner in the bottom-left of the webpage. - * @param borderRadiusBottomRight: Radius value of the rounded corner in the bottom-right of the webpage. + * Set focus by position + * + * @Return: if hit node editable. */ - void SetBorderRadiusFromWeb(double borderRadiusTopLeft, double borderRadiusTopRight, double borderRadiusBottomLeft, - double borderRadiusBottomRight) override; + bool SetFocusByPosition(float x, float y) override; /** * @brief Set the native inner web @@ -1573,24 +1579,31 @@ public: void OnBrowserBackground() override; /** - * @brief: register native javaScriptProxy. - * - * @param objName object name. - * @param methodName methodName list - * @param data The ptr of NWebJsProxyMethod. - * @param isAsync True mean. - * @param permission permission. + * @brief Set the window id. */ - virtual void RegisterNativeJavaScriptProxy(const std::string& objName, - const std::vector& methodName, - std::shared_ptr data, - bool isAsync, - const std::string& permission) override; + void SetFocusWindowId(uint32_t focus_window_id) override; /** - * @brief Set the window id. + * @brief Get select startIndex. */ - void SetFocusWindowId(uint32_t focus_window_id) override; + int GetSelectStartIndex() override; + + /** + * @brief Get select endIndex. + */ + int GetSelectEndIndex() override; + + /** + * @brief Get all text info. + */ + std::string GetAllTextInfo() override; + + void CallH5FunctionV2(int32_t routing_id, int32_t h5_object_id, const std::string& h5_method_name, + const std::vector>& args) override; + + void PostPortMessageV2(const std::string& portHandle, std::shared_ptr data) override; + + void FillAutofillDataV2(std::shared_ptr data) override; /** * @brief Run data detector JS @@ -1612,6 +1625,17 @@ public: */ void OnDataDetectorCopy(const std::vector& recordMix) override; + /** + * @brief When the user sets the webpage's border radius, + * update Chromium with this radius value for repaint the scrollbar. + * @param borderRadiusTopLeft: Radius value of the rounded corner in the top-left of the webpage. + * @param borderRadiusTopRight: Radius value of the rounded corner in the top-right of the webpage. + * @param borderRadiusBottomLeft: Radius value of the rounded corner in the bottom-left of the webpage. + * @param borderRadiusBottomRight: Radius value of the rounded corner in the bottom-right of the webpage. + */ + void SetBorderRadiusFromWeb(double borderRadiusTopLeft, double borderRadiusTopRight, double borderRadiusBottomLeft, + double borderRadiusBottomRight) override; + /** * @brief Set the native window of picture in picture. */ @@ -1628,6 +1652,12 @@ public: int frame_routing_id, int event) override; + /** + * @brief Create web print document adapter V2. + */ + std::unique_ptr CreateWebPrintDocumentAdapterV2( + const std::string& job_name) override; + /* * @brief Set unique key of current page for insert frame. * @@ -1642,21 +1672,6 @@ public: */ void SetPrivacyStatus(bool isPrivate) override; - /** - * @brief Get select startIndex. - */ - int GetSelectStartIndex() override; - - /** - * @brief Get select endIndex. - */ - int GetSelectEndIndex() override; - - /** - * @brief Get all text info. - */ - std::string GetAllTextInfo() override; - /** * @brief Set audio session type. * @@ -1664,7 +1679,7 @@ public: */ void SetAudioSessionType(int32_t audio_session_type) override; - /** + /** * @brief Get accessibility id by its html element id in the browser. * @param htmlElementId The html element id of the Same-layer rendering. * @return The accessibility id of the accessibility node with Same-layer rendering. @@ -1690,9 +1705,22 @@ public: */ int32_t SetBlanklessLoadingWithKey(const std::string& key, bool isStart) override; + /** + * @brief Try to trigger blankless for url. + * @param url The url to use for blankless. + * @return Blankless is triggered for this url. + */ + bool TriggerBlanklessForUrl(const std::string& url) override; + + /** + * @brief Set visibility of the web. + * @param isVisible The visibility to be set. + */ + void SetVisibility(bool isVisible) override; + /** * @brief Update the single handle visible. - * @param isVisible The single handle visible. + * @param isVisible True means the single handle has been hidden, and false means the single handle has been shown. */ void UpdateSingleHandleVisible(bool isVisible) override; @@ -1702,6 +1730,14 @@ public: */ void SetTouchHandleExistState(bool touchHandleExist) override; + /** + * @brief Get the current scroll offset of the webpage. + * @param offset_x The current horizontal scroll offset of the webpage. + * @param offset_y The current vertical scroll offset of the webpage. + */ + /*--ark web()--*/ + void GetPageOffset(float* offset_x, float* offset_y) override; + /** * @brief Sets the bottom avoidance height of the web visible viewport. * @param avoidHeight The height value of the visible viewport avoidance. Unit: px. @@ -1710,36 +1746,15 @@ public: /** * @brief Get the bottom avoidance height of the web visible viewport. - * @return The bottom avoidance height of the visible viewport. + * @return The bottom avoidance height of the web visible viewport. */ int32_t GetVisibleViewportAvoidHeight() override; - /** - * @brief Try to trigger blankless for url. - * @param url The url to use for blankless. - * @return Blankless is triggered for this url. - */ - bool TriggerBlanklessForUrl(const std::string& url) override; - - /** - * @brief Set visibility of the web. - * @param isVisible The visibility to be set. - */ - void SetVisibility(bool isVisible) override; - /** * @brief Current viewport is being scaled. */ void SetViewportScaleState() override; - /** - * @brief Get the current scroll offset of the webpage. - * @param offset_x The current horizontal scroll offset of the webpage. - * @param offset_y The current vertical scroll offset of the webpage. - */ - /*--ark web()--*/ - void GetPageOffset(float* offset_x, float* offset_y) override; - /** * @brief Set whether enable the error page. onOverrideErrorPage will be triggered when the page error. * @@ -1758,19 +1773,6 @@ public: */ ArkWebDestroyMode GetWebDestroyMode() override; - void CallH5FunctionV2(int32_t routing_id, int32_t h5_object_id, const std::string& h5_method_name, - const std::vector>& args) override; - - void PostPortMessageV2(const std::string& portHandle, std::shared_ptr data) override; - - void FillAutofillDataV2(std::shared_ptr data) override; - - /** - * @brief Create web print document adapter V2. - */ - std::unique_ptr CreateWebPrintDocumentAdapterV2( - const std::string& job_name) override; - private: ArkWebRefPtr ark_web_nweb_; }; diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.cpp index 79e93cb52..5c1f7b854 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.cpp @@ -574,17 +574,18 @@ void ArkWebPreferenceWrapper::SetBlurOnKeyboardHideMode(int enable) } } -void ArkWebPreferenceWrapper::PutWebMediaAVSessionEnabled(bool enable) +void ArkWebPreferenceWrapper::SetFontWeightScale(float size) { - ark_web_preference_->PutWebMediaAVSessionEnabled(enable); + if (ark_web_preference_) { + ark_web_preference_->SetFontWeightScale(size); + } } -void ArkWebPreferenceWrapper::SetFontWeightScale(float scale) +void ArkWebPreferenceWrapper::PutWebMediaAVSessionEnabled(bool enable) { - if (ark_web_preference_) { - ark_web_preference_->SetFontWeightScale(scale); - } + ark_web_preference_->PutWebMediaAVSessionEnabled(enable); } + void ArkWebPreferenceWrapper::SetIntrinsicSizeEnable(bool enable) { if (ark_web_preference_) { diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.h index 71819085b..d9debfe34 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_preference_wrapper.h @@ -660,14 +660,14 @@ public: void SetBlurOnKeyboardHideMode(int enable) override; /** - * @brief Set whether to connect to media avsession. + * @brief Set the scale of the font-weight.The default is 1.0f. */ - void PutWebMediaAVSessionEnabled(bool enable) override; + void SetFontWeightScale(float size) override; /** - * @brief Set the scale of the font-weight.The default is 1.0f. + * @brief Set whether to connect to media avsession. */ - void SetFontWeightScale(float scale) override; + void PutWebMediaAVSessionEnabled(bool enable) override; /** * @brief Set whether to use the intrinsic size. The default is false. diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.cpp index 66cfbbf12..ccbf35365 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.cpp @@ -51,4 +51,4 @@ ArkWebUint32Vector ArkWebPrintAttributesAdapterImpl::GetUint32Vector(uint32_t at return ArkWebBasicVectorClassToStruct(std::vector()); } -} // namespace OHOS::ArkWeb \ No newline at end of file +} // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.h index 04a02b356..df495d74c 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_attributes_adapter_impl.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H_ -#define ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H_ +#ifndef ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H +#define ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H #pragma once #include "ohos_nweb/include/ark_web_print_document_adapter_adapter.h" @@ -39,4 +39,4 @@ private: } // namespace OHOS::ArkWeb -#endif // ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H_ \ No newline at end of file +#endif // ARK_WEB_PRINT_ATTRIBUTES_ADAPTER_IMPL_H diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.cpp b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.cpp index 21a272369..d85b0e14c 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.cpp +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.cpp @@ -47,4 +47,4 @@ void ArkWebPrintDocumentAdapterAdapterWrapper::OnJobStateChanged(const std::stri ArkWebStringStructRelease(str); } -} // namespace OHOS::ArkWeb \ No newline at end of file +} // namespace OHOS::ArkWeb diff --git a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.h b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.h index 22c293cde..cb1f9f468 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.h +++ b/ohos_interface/ohos_glue/ohos_nweb/bridge/webview/ark_web_print_document_adapter_adapter_wrapper.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H_ -#define ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H_ +#ifndef ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H +#define ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H #pragma once #include "ohos_nweb/include/ark_web_print_document_adapter_adapter.h" @@ -38,4 +38,4 @@ private: } // namespace OHOS::ArkWeb -#endif // ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H_ \ No newline at end of file +#endif // ARK_WEB_PRINT_DOCUMENT_ADAPTER_ADAPTER_WRAPPER_H diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_engine.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_engine.h index b3d800637..e90c291e8 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_engine.h +++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_engine.h @@ -116,7 +116,7 @@ public: /** * @Description: set api level of rom to core * @Input apiLevel: api level - * @Since: 12005 + * @Since: 13001 */ /*--ark web()--*/ virtual void SetArkWebRomApiLevel(int apiLevel) = 0; @@ -124,7 +124,7 @@ public: /** * @Description: get api level of core * @Return: api level of core - * @Since: 12005 + * @Since: 13001 */ /*--ark web()--*/ virtual int GetArkWebCoreApiLevel() = 0; diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h index eb9199b79..294228eb5 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h +++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_handler.h @@ -18,6 +18,7 @@ #pragma once #include "ohos_nweb/include/ark_web_access_request.h" +#include "ohos_nweb/include/ark_web_all_ssl_error_info.h" #include "ohos_nweb/include/ark_web_applink_callback.h" #include "ohos_nweb/include/ark_web_console_log.h" #include "ohos_nweb/include/ark_web_context_menu_callback.h" @@ -627,26 +628,16 @@ public: /*--ark web()--*/ virtual void ReleaseResizeHold() = 0; - /*--ark web()--*/ - virtual void OnShowAutofillPopup( - const float offsetX, const float offsetY, const ArkWebStringVector& menu_items) = 0; - - /*--ark web()--*/ - virtual void OnHideAutofillPopup() = 0; - /*--ark web()--*/ virtual ArkWebCharVector GetWordSelection(const ArkWebString& text, int8_t offset) = 0; /*--ark web()--*/ virtual void UpdateClippedSelectionBounds(int x, int y, int w, int h) = 0; - /*--ark web()--*/ - virtual bool OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) = 0; - /** * @brief Called when the render process not responding. * - * @param js_stack Javascript stack info of webpage when render process not + * @param js_stack JavaScript stack info of webpage when render process not * responding. * @param pid Process id of the render process not responding. * @param reason Reason of the render process not responding. @@ -661,6 +652,16 @@ public: /*--ark web()--*/ virtual void OnRenderProcessResponding() = 0; + /*--ark web()--*/ + virtual bool OnOpenAppLink(const ArkWebString& url, ArkWebRefPtr callback) = 0; + + /*--ark web()--*/ + virtual void OnShowAutofillPopup( + const float offsetX, const float offsetY, const ArkWebStringVector& menu_items) = 0; + + /*--ark web()--*/ + virtual void OnHideAutofillPopup() = 0; + /** * @brief Called when the viewport-fit meta is detected for web page. * @@ -669,6 +670,27 @@ public: /*--ark web()--*/ virtual void OnViewportFitChange(int viewportFit) = 0; + /** + * @brief Request display and focus for a new nweb. + * + * @param source The Focus Source. + * @return Return true if request focus success, false if request focus fail. + */ + /*--ark web()--*/ + virtual bool OnFocus(int source) = 0; + + /** + * @brief Called when the page is over scroll. + * + * @param xOffset The offset of x axis. + * @param yOffset The offset of y axis. + * @param xVelocity The velocity of x axis. + * @param yVelocity The velocity of y axis. + * @return Return true if value is consumed, false if value is unconsumed. + */ + /*--ark web()--*/ + virtual bool OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) = 0; + /** * @brief Called when creating overlay. * @@ -699,34 +721,13 @@ public: virtual void OnOverlayStateChanged(int offset_x, int offset_y, int rect_width, int rect_height) = 0; /** - * @brief Request display and focus for a new nweb. - * - * @param source The Focus Source. - * @return Return true if request focus success, false if request focus fail. - */ - /*--ark web()--*/ - virtual bool OnFocus(int source) = 0; - - /** - * @brief Called when the page is over scroll. - * - * @param xOffset The offset of x axis. - * @param yOffset The offset of y axis. - * @param xVelocity The velocity of x axis. - * @param yVelocity The velocity of y axis. - * @return Return true if value is consumed, false if value is unconsumed. - */ - /*--ark web()--*/ - virtual bool OnOverScroll(float xOffset, float yOffset, float xVelocity, float yVelocity) = 0; - - /** - * @brief Called when the key board redispatch. + * @brief Called when ads blocked. * - * @param event Key information. - * @param isUsed Whether the key is used by the kernel. + * @param url the url of main frame. + * @param adsBlocked the url of ads. */ /*--ark web()--*/ - virtual void KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) = 0; + virtual void OnAdsBlocked(const ArkWebString& url, const ArkWebStringVector& adsBlocked) = 0; /*--ark web()--*/ virtual void OnInterceptKeyboardAttach(ArkWebRefPtr keyboardHandler, @@ -737,14 +738,17 @@ public: /*--ark web()--*/ virtual void OnCustomKeyboardClose() = 0; + + /*--ark web()--*/ + virtual void KeyboardReDispatch(ArkWebRefPtr event, bool isUsed) = 0; + /** - * @brief Called when ads blocked. + * @brief Called when you need to temporarily hide/restore the handle menu. * - * @param url the url of main frame. - * @param adsBlocked the url of ads. + * @param hide hide. */ /*--ark web()--*/ - virtual void OnAdsBlocked(const ArkWebString &url, const ArkWebStringVector &adsBlocked) = 0; + virtual void HideHandleAndQuickMenuIfNecessary(bool hide) = 0; /** * @brief called when the cursor info is updated. @@ -755,23 +759,6 @@ public: /*--ark web()--*/ virtual void OnCursorUpdate(double x, double y, double width, double height) = 0; - /** - * @brief Called when web occurs frame loss event. - * - * @param sceneId The id of event scene. - * @param isStart True if is start. - */ - /*--ark web()--*/ - virtual void ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) = 0; - - /** - * @brief Called when you need to temporarily hide/restore the handle menu. - * - * @param hide hide. - */ - /*--ark web()--*/ - virtual void HideHandleAndQuickMenuIfNecessary(bool hide) = 0; - /** * @brief Called When you click on the selected area. * @@ -785,6 +772,12 @@ public: /*--ark web()--*/ virtual void StartVibraFeedback(const ArkWebString& vibratorType) = 0; + /*--ark web()--*/ + virtual void OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) = 0; + + /*--ark web()--*/ + virtual bool CloseImageOverlaySelection() = 0; + /** * @brief Called when a popup is shown with the given size. * @@ -806,23 +799,6 @@ public: /*--ark web()--*/ virtual void OnPopupShow(bool show) = 0; - /*--ark web()--*/ - virtual void OnNativeEmbedVisibilityChange(const ArkWebString& embed_id, bool visibility) = 0; - - /*--ark web()--*/ - virtual bool CloseImageOverlaySelection() = 0; - - /** - * @Description: Called when web occurs ssl error event. - * @Input result: handler of result. - * @Input error: error code. - * @Input certChainData: cert chain data. - * @Return: true/false - */ - /*--ark web()--*/ - virtual bool OnSslErrorRequestByJSV2(ArkWebRefPtr result, int error, - const ArkWebStringVector& certChainData) = 0; - /** * @Description: Called when an accessibility event occurs. * @Input accessibilityId: the accessibility id of the accessibility node of the accessibility event. @@ -831,6 +807,15 @@ public: /*--ark web()--*/ virtual void OnAccessibilityEvent(int64_t accessibilityId, int32_t eventType) = 0; + /** + * @brief Called when web occurs frame loss event. + * + * @param sceneId The id of event scene. + * @param isStart True if is start. + */ + /*--ark web()--*/ + virtual void ReportDynamicFrameLossEvent(const ArkWebString& sceneId, bool isStart) = 0; + /** * @Description: Web gets focus on the framework. * @Return: true/false @@ -838,6 +823,17 @@ public: /*--ark web()--*/ virtual bool IsCurrentFocus() = 0; + /** + * @Description: Called when web occurs ssl error event. + * @Input result: handler of result. + * @Input error: error code. + * @Input certChainData: cert chain data. + * @Return: true/false + */ + /*--ark web()--*/ + virtual bool OnSslErrorRequestByJSV2(ArkWebRefPtr result, int error, + const ArkWebStringVector& certChainData) = 0; + /** * @brief Get the visible area relative to the web. */ @@ -870,22 +866,41 @@ public: /*--ark web()--*/ virtual bool OnNestedScroll(float& x, float& y, float& xVelocity, float& yVelocity, bool& isAvailable) = 0; + /** + * @brief called when the web page is active for window.open called by other web component. + */ /*--ark web()--*/ - virtual void EnableSecurityLayer(bool isNeedSecurityLayer) = 0; + virtual void OnActivateContentByJS() = 0; /** - * @brief Called When you click on the selected area. + * @Description Notify the SDK that a web site has started loading. This method is + * called once for each main frame load. Embedded frame changes, i.e. clicking + * a link whose target is an iframe and fragment navigations (navigations to + * #fragment_id) will not trigger this callback. + * + * @Input url The url to be loaded. */ /*--ark web()--*/ - virtual bool ChangeVisibilityOfQuickMenuV2() = 0; + virtual void OnLoadStarted(const ArkWebString& url) = 0; + + /** + * @Description Notify the SDK that a web site has finished loading. This method is + * called only for main frame. Different from onPageEnd, onLoadFinished is + * triggered only once if the mainframe is automatically redirected before the + * page is completely loaded. OnPageEnd is triggered every navigation. + * fragment navigation also triggers onLoadFinished. + * + * @Input url The url of the web site. + */ + /*--ark web()--*/ + virtual void OnLoadFinished(const ArkWebString& url) = 0; + /** + * @brief Called When you click on the selected area. + * + */ /*--ark web()--*/ - virtual void OnPip(int status, - int delegate_id, - int child_id, - int frame_routing_id, - int width, - int height) = 0; + virtual bool ChangeVisibilityOfQuickMenuV2() = 0; /** * @brief Notify the host application that the web page wants to handle @@ -910,51 +925,44 @@ public: /*--ark web()--*/ virtual void OnNativeEmbedMouseEvent(ArkWebRefPtr mouse_event) = 0; - /** - * @brief called when the web page is active for window.open called by other web component. - */ /*--ark web()--*/ - virtual void OnActivateContentByJS() = 0; + virtual void OnPip(int status, + int delegate_id, + int child_id, + int frame_routing_id, + int width, + int height) = 0; + + /*--ark web()--*/ + virtual void EnableSecurityLayer(bool isNeedSecurityLayer) = 0; /** - * @Description Notify the SDK that a web site has started loading. This method is - * called once for each main frame load. Embedded frame changes, i.e. clicking - * a link whose target is an iframe and fragment navigations (navigations to - * #fragment_id) will not trigger this callback. - * - * @Input url The url to be loaded. + * @Description: Called when web occurs ssl error event (for the main frame and subframes). + * @Input result: handler of result. + * @Input info: info of ssl error. Include of error code, url, originalUrl, referrer url, + * isFatalError(whether the request is made for the main frame), isMainFrame(whether + * the request is made for the main frame) and cert chain data. + * @Return: true/false */ /*--ark web()--*/ - virtual void OnLoadStarted(const ArkWebString& url) = 0; + virtual bool OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, + ArkWebRefPtr info) = 0; /** - * @Description Notify the SDK that a web site has finished loading. This method is - * called only for main frame. Different from onPageEnd, onLoadFinished is - * triggered only once if the mainframe is automatically redirected before the - * page is completely loaded. OnPageEnd is triggered every navigation. - * fragment navigation also triggers onLoadFinished. + * @brief Notify the web client to do something for blankless. * - * @Input url The url of the web site. + * @param pathToFrame The file used to insert frame. If empty, means remove frame. */ /*--ark web()--*/ - virtual void OnLoadFinished(const ArkWebString& url) = 0; + virtual void OnInsertBlanklessFrame(const ArkWebString& pathToFrame) = 0; /** - * @Description Called when an SSL error occurs during the loading of resources (for the main frame and subframes). - * @Input result: handler of result. - * @Input error: error code. - * @Input url: request url - * @Input originalUrl: original url. - * @Input referrer: referrer url. - * @Input isFatalError: whether the error is a fatal error. - * @Input isMainFrame: whether the request is made for the main frame. - * @Input certChainData: cert chain data. - * @Return: true/false + * @brief Notify the web client to remove blankless frame. + * + * @param delayTime The delayTime for web client to remove blankless frame. */ /*--ark web()--*/ - virtual bool OnAllSslErrorRequestByJSV2(ArkWebRefPtr result, int error, - const ArkWebString& url, const ArkWebString& originalUrl, const ArkWebString& referrer, bool isFatalError, - bool isMainFrame, const ArkWebStringVector& certChainData) = 0; + virtual void OnRemoveBlanklessFrame(int delayTime) = 0; /** * @brief Called when you need to show magnifier. @@ -978,22 +986,6 @@ public: /*--ark web()--*/ virtual void OnPageTitleV2(const ArkWebString& title, bool isRealTitle) = 0; - /** - * @brief Notify the web client to do something for blankless. - * - * @param pathToFrame The file used to insert frame. If empty, means remove frame. - */ - /*--ark web()--*/ - virtual void OnInsertBlanklessFrame(const ArkWebString& pathToFrame) = 0; - - /** - * @brief Notify the web client to remove blankless frame. - * - * @param delayTime The delayTime for web client to remove blankless frame. - */ - /*--ark web()--*/ - virtual void OnRemoveBlanklessFrame(int delayTime) = 0; - /** * @brief Triggered when the web page's document resource error * diff --git a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_js_proxy_method.h b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_js_proxy_method.h index 6aafc2495..a2f70e434 100644 --- a/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_js_proxy_method.h +++ b/ohos_interface/ohos_glue/ohos_nweb/include/ark_web_js_proxy_method.h @@ -13,28 +13,28 @@ * limitations under the License. */ - #ifndef ARK_WEB_JS_PROXY_METHOD_H_ - #define ARK_WEB_JS_PROXY_METHOD_H_ - #pragma once - - #include "ohos_nweb/include/ark_web_nweb_structs.h" - - #include "base/include/ark_web_base_ref_counted.h" - #include "base/include/ark_web_types.h" - - namespace OHOS::ArkWeb { - - /*--ark web(source=webview)--*/ - class ArkWebJsProxyMethod : public virtual ArkWebBaseRefCounted { - public: - /*--ark web()--*/ - virtual int32_t GetSize() = 0; - - /*--ark web()--*/ - virtual void OnHandle(int32_t number, const ArkWebStringVector& param) = 0; - }; - - } // namespace OHOS::ArkWeb - - #endif // ARK_WEB_JS_PROXY_METHOD_H_ - \ No newline at end of file +#ifndef ARK_WEB_JS_PROXY_METHOD_H_ +#define ARK_WEB_JS_PROXY_METHOD_H_ +#pragma once + +#include "base/include/ark_web_base_ref_counted.h" +#include "base/include/ark_web_types.h" + +#include "ohos_nweb/include/ark_web_nweb_structs.h" + +namespace OHOS::ArkWeb { + +/*--ark web(source=webview)--*/ +class ArkWebJsProxyMethod : public virtual ArkWebBaseRefCounted { +public: + + /*--ark web()--*/ + virtual int GetSize() = 0; + + /*--ark web()--*/ + virtual void OnHandle(int number, const ArkWebStringVector& param) = 0; +}; + +} // namespace OHOS::ArkWeb + +#endif // ARK_WEB_JS_PROXY_METHOD_H_ \ No newline at end of file diff --git a/test/unittest/ohos_adapter/cert_mgr_adapter_test/cert_mgr_adapter_test.cpp b/test/unittest/ohos_adapter/cert_mgr_adapter_test/cert_mgr_adapter_test.cpp index 6dce52603..eb6c1c72b 100644 --- a/test/unittest/ohos_adapter/cert_mgr_adapter_test/cert_mgr_adapter_test.cpp +++ b/test/unittest/ohos_adapter/cert_mgr_adapter_test/cert_mgr_adapter_test.cpp @@ -284,12 +284,7 @@ HWTEST_F(CertMgrAdapterTest, CertMgrAdapterTest_GetCertMaxSize_001, TestSize.Lev g_appMaxSize = adapter.GetAppCertMaxSize(); EXPECT_NE(g_appMaxSize, TEST_FAILURE); g_certSum = adapter.GetSytemRootCertSum(); - std::string deviceType = OHOS::system::GetDeviceType(); - if (deviceType == "phone" || deviceType == "default") { - EXPECT_NE(g_certSum, TEST_OK); - } else { - EXPECT_EQ(g_certSum, TEST_OK); - } + EXPECT_EQ(g_certSum, TEST_OK); } /** @@ -304,12 +299,7 @@ HWTEST_F(CertMgrAdapterTest, CertMgrAdapterTest_GetAppCert_002, TestSize.Level1) uint8_t* certData = static_cast(malloc(g_cerSize)); EXPECT_NE(certData, nullptr); int32_t result = adapter.GetSytemRootCertData(0, certData); - std::string deviceType = OHOS::system::GetDeviceType(); - if (deviceType == "phone" || deviceType == "default") { - EXPECT_NE(result, -1); - } else { - EXPECT_EQ(result, -1); - } + EXPECT_EQ(result, -1); free(certData); certData = nullptr; } @@ -385,12 +375,7 @@ HWTEST_F(CertMgrAdapterTest, CertMgrAdapterTest_Sign_006, TestSize.Level1) uint8_t signData[DEFAULT_SIGNATURE_LEN] = {0}; result = adapter.Sign(uriData, messageData, sizeof(messageData), signData, sizeof(signData)); - std::string deviceType = OHOS::system::GetDeviceType(); - if (deviceType == "phone" || deviceType == "default") { - EXPECT_NE(result, -1); - } else { - EXPECT_EQ(result, -1); - } + EXPECT_EQ(result, -1); result = adapter.Sign(uriData, messageData, sizeof(messageData), nullptr, 0); EXPECT_EQ(result, -1); result = adapter.Sign(uriData, nullptr, 0, signData, sizeof(signData)); -- Gitee