From 99e68a14b61c7f85f0c94417db25f6a38fcfe855 Mon Sep 17 00:00:00 2001 From: wanghui Date: Sat, 30 Nov 2024 22:51:10 +0800 Subject: [PATCH] loadData ndk interface. Signed-off-by: wanghui --- .../interfaces/native/arkweb_error_code.h | 1 + .../native/native_interface_arkweb.h | 28 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/web/webview/interfaces/native/arkweb_error_code.h b/web/webview/interfaces/native/arkweb_error_code.h index 64db3082c..e225750ab 100644 --- a/web/webview/interfaces/native/arkweb_error_code.h +++ b/web/webview/interfaces/native/arkweb_error_code.h @@ -53,6 +53,7 @@ ARKWEB_INVALID_URL = 17100103, /** @error Invalid cookie value. */ ARKWEB_INVALID_COOKIE_VALUE = 17100104, + } ArkWeb_ErrorCode; #endif // ARKWEB_ERROR_CODE_H diff --git a/web/webview/interfaces/native/native_interface_arkweb.h b/web/webview/interfaces/native/native_interface_arkweb.h index 96b779bf4..77175d1d6 100644 --- a/web/webview/interfaces/native/native_interface_arkweb.h +++ b/web/webview/interfaces/native/native_interface_arkweb.h @@ -153,8 +153,34 @@ void OH_NativeArkWeb_SetDestroyCallback(const char* webTag, NativeArkWeb_OnDestr */ NativeArkWeb_OnDestroyCallback OH_NativeArkWeb_GetDestroyCallback(const char* webTag); +/** + * @brief Loads the data or URL. + * This function should be called on main thread. + * + * @param webTag The name of the web component. + * @param data A string encoded according to "Base64" or "URL", should not be NULL. + * @param mimeType Media type. For example: "text/html", should not be NULL. + * @param encoding Encoding type. For example: "UTF-8", should not be NULL. + * @param baseUrl A specified URL path ("http"/"https"/"data" protocol), + * which is assigned to window.origin by the Web component. + * @param historyUrl History URL. When it is not empty, it can be managed by + * history records to realize the back and forth function. + * @return LoadData result code. + * {@link ARKWEB_SUCCESS} load data success. + * {@link ARKWEB_INVALID_PARAM} Mandatory parameters are left unspecified or + * Incorrect parameter types or Parameter verification failed. + * @syscap SystemCapability.Web.Webview.Core + * @since 16 + */ +ArkWeb_ErrorCode OH_NativeArkWeb_LoadData(const char* webTag, + const char* data, + const char* mimeType, + const char* encoding, + const char* baseUrl, + const char* historyUrl); + #ifdef __cplusplus }; #endif #endif // NATIVE_INTERFACE_ARKWEB_H -/** @} */ \ No newline at end of file +/** @} */ -- Gitee