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 #ifndef ARK_WEB_JS_RESULT_CALLBACK_H_ 17 #define ARK_WEB_JS_RESULT_CALLBACK_H_ 18 #pragma once 19 20 #include "ohos_nweb/include/ark_web_value.h" 21 #include "ohos_nweb/include/ark_web_value_vector.h" 22 23 #include "base/include/ark_web_base_ref_counted.h" 24 #include "base/include/ark_web_types.h" 25 26 namespace OHOS::ArkWeb { 27 28 /*--ark web(source=webview)--*/ 29 class ArkWebJsResultCallback : public virtual ArkWebBaseRefCounted { 30 public: 31 /*--ark web()--*/ 32 virtual ArkWebValue GetJavaScriptResult(ArkWebValueVector args, const ArkWebString& method, 33 const ArkWebString& object_name, int32_t routing_id, int32_t object_id) = 0; 34 35 /** 36 * @brief GetJavaScriptObjectMethods 37 * 38 * @param object_id: means the JavaScript object id 39 * @param object_id: means the method name 40 */ 41 /*--ark web()--*/ 42 virtual bool HasJavaScriptObjectMethods(int32_t object_id, const ArkWebString& method_name) = 0; 43 44 /** 45 * @brief GetJavaScriptObjectMethods 46 * 47 * @param object_id: means the JavaScript object id 48 */ 49 /*--ark web()--*/ 50 virtual ArkWebValue GetJavaScriptObjectMethods(int32_t object_id) = 0; 51 52 /** 53 * @brief RemoveJavaScriptObjectHolder 54 * 55 * @param holder: means the JavaScript object is holded by 56 * it(routing_id) 57 * @param object_id: means the JavaScript object id 58 */ 59 /*--ark web()--*/ 60 virtual void RemoveJavaScriptObjectHolder(int32_t holder, int32_t object_id) = 0; 61 62 /** 63 * @brief Remove Transient JavaScript Object 64 */ 65 /*--ark web()--*/ 66 virtual void RemoveTransientJavaScriptObject() = 0; 67 68 /*--ark web()--*/ 69 virtual ArkWebValue GetJavaScriptResultFlowbuf(ArkWebValueVector args, const ArkWebString& method, 70 const ArkWebString& object_name, int fd, int32_t routing_id, int32_t object_id) = 0; 71 }; 72 73 } // namespace OHOS::ArkWeb 74 75 #endif // ARK_WEB_JS_RESULT_CALLBACK_H_ 76