1 /* 2 * Copyright (c) 2023 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 FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H 17 #define FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H 18 19 #include <ipc_types.h> 20 #include <iremote_broker.h> 21 22 #include "form_js_info.h" 23 #include "ui/rs_surface_node.h" 24 #include "want.h" 25 26 #include "base/utils/macros.h" 27 28 namespace OHOS { 29 namespace Ace { 30 /** 31 * @class FormRendererDelegate 32 * FormRendererDelegate interface is used to form renderer delegate. 33 */ 34 class ACE_EXPORT IFormRendererDelegate : public OHOS::IRemoteBroker { 35 public: 36 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.ace.FormRendererDelegate") 37 38 IFormRendererDelegate() = default; 39 ~IFormRendererDelegate() override = default; 40 /** 41 * @brief OnSurfaceCreate. 42 * @param surfaceNode The surfaceNode. 43 * @param formJsInfo The formJsInfo. 44 * @param want The want. 45 */ 46 virtual int32_t OnSurfaceCreate(const std::shared_ptr<Rosen::RSSurfaceNode>& surfaceNode, 47 const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want) = 0; 48 /** 49 * @brief OnSurfaceReuse. 50 * @param surfaceId The surfaceNode ID. 51 * @param formJsInfo The formJsInfo. 52 * @param want The want. 53 */ OnSurfaceReuse(uint64_t surfaceId,const OHOS::AppExecFwk::FormJsInfo & formJsInfo,const AAFwk::Want & want)54 virtual int32_t OnSurfaceReuse( 55 uint64_t surfaceId, const OHOS::AppExecFwk::FormJsInfo& formJsInfo, const AAFwk::Want& want) 56 { 57 return ERR_OK; 58 } 59 /** 60 * @brief OnSurfaceRelease. 61 * @param surfaceId The surfaceNode ID. 62 */ OnSurfaceRelease(uint64_t surfaceId)63 virtual int32_t OnSurfaceRelease(uint64_t surfaceId) 64 { 65 return ERR_OK; 66 } 67 /** 68 * @brief OnActionEvent. 69 * @param action The action. 70 */ 71 virtual int32_t OnActionEvent(const std::string& action) = 0; 72 /** 73 * @brief OnError. 74 * @param code The code. 75 * @param msg The msg. 76 */ 77 virtual int32_t OnError(const std::string& code, const std::string& msg) = 0; 78 /** 79 * @brief OnSurfaceChange. 80 * @param width 81 * @param height 82 */ 83 virtual int32_t OnSurfaceChange(float width, float height) = 0; 84 /** 85 * @brief OnFormLinkInfoUpdate. 86 * @param formLinkInfos 87 */ 88 virtual int32_t OnFormLinkInfoUpdate(const std::vector<std::string>& formLinkInfos) = 0; 89 90 enum Message : uint32_t { 91 ON_SURFACE_CREATE = 1, 92 ON_SURFACE_REUSE, 93 ON_SURFACE_RELEASE, 94 ON_ACTION_CREATE, 95 ON_ERROR, 96 ON_SURFACE_CHANGE, 97 ON_FORM_LINK_INFO_UPDATE, 98 }; 99 }; 100 } // namespace Ace 101 } // namespace OHOS 102 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H 103