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( 47 const std::shared_ptr<Rosen::RSSurfaceNode>& surfaceNode, 48 const OHOS::AppExecFwk::FormJsInfo& formJsInfo, 49 const AAFwk::Want& want) = 0; 50 /** 51 * @brief OnSurfaceReuse. 52 * @param surfaceId The surfaceNode ID. 53 * @param formJsInfo The formJsInfo. 54 * @param want The want. 55 */ OnSurfaceReuse(uint64_t surfaceId,const OHOS::AppExecFwk::FormJsInfo & formJsInfo,const AAFwk::Want & want)56 virtual int32_t OnSurfaceReuse(uint64_t surfaceId, 57 const OHOS::AppExecFwk::FormJsInfo& formJsInfo, 58 const AAFwk::Want& want) 59 { 60 return ERR_OK; 61 } 62 /** 63 * @brief OnSurfaceRelease. 64 * @param surfaceId The surfaceNode ID. 65 */ OnSurfaceRelease(uint64_t surfaceId)66 virtual int32_t OnSurfaceRelease(uint64_t surfaceId) 67 { 68 return ERR_OK; 69 } 70 /** 71 * @brief OnActionEvent. 72 * @param action The action. 73 */ 74 virtual int32_t OnActionEvent(const std::string& action) = 0; 75 /** 76 * @brief OnError. 77 * @param code The code. 78 * @param msg The msg. 79 */ 80 virtual int32_t OnError(const std::string& code, const std::string& msg) = 0; 81 /** 82 * @brief OnSurfaceChange. 83 * @param width 84 * @param height 85 */ 86 virtual int32_t OnSurfaceChange(float width, float height) = 0; 87 88 enum Message : uint32_t { 89 ON_SURFACE_CREATE = 1, 90 ON_SURFACE_REUSE, 91 ON_SURFACE_RELEASE, 92 ON_ACTION_CREATE, 93 ON_ERROR, 94 ON_SURFACE_CHANGE, 95 }; 96 }; 97 } // namespace Ace 98 } // namespace OHOS 99 #endif // FOUNDATION_ACE_INTERFACE_INNERKITS_FORM_RENDERER_DELEGATE_INTERFACE_H 100