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 OHOS_FORM_FWK_FORM_RENDER_STUB_H 17 #define OHOS_FORM_FWK_FORM_RENDER_STUB_H 18 19 #include <unordered_map> 20 21 #include "form_render_interface.h" 22 #include "iremote_object.h" 23 #include "iremote_stub.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 /** 28 * @class FormRenderStub 29 * form render service stub. 30 */ 31 class FormRenderStub : public IRemoteStub<IFormRender> { 32 public: 33 FormRenderStub(); 34 virtual ~FormRenderStub(); 35 /** 36 * @brief handle remote request. 37 * @param data input param. 38 * @param reply output param. 39 * @param option message option. 40 * @return Returns ERR_OK on success, others on failure. 41 */ 42 virtual int32_t OnRemoteRequest( 43 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 44 45 private: 46 /** 47 * @brief handle render form message. 48 * @param data input param. 49 * @param reply output param. 50 * @return Returns ERR_OK on success, others on failure. 51 */ 52 int32_t HandleRenderForm(MessageParcel &data, MessageParcel &reply); 53 54 /** 55 * @brief Stop rendering form. This is sync API. 56 * @param formJsInfo The form js info. 57 * @param want Indicates the {@link Want} structure containing form info. 58 * @param callerToken Caller ability token. 59 * @return Returns ERR_OK on success, others on failure. 60 */ 61 int32_t HandleStopRenderingForm(MessageParcel &data, MessageParcel &reply); 62 63 /** 64 * @brief When host is died, clean resources. This is async API. 65 * @param hostToken Caller ability token. 66 * @return Returns ERR_OK on success, others on failure. 67 */ 68 int32_t HandleCleanFormHost(MessageParcel &data, MessageParcel &reply); 69 70 int32_t HandleReleaseRenderer(MessageParcel &data, MessageParcel &reply); 71 72 int32_t HandleReloadForm(MessageParcel &data, MessageParcel &reply); 73 74 int32_t HandleOnUnlock(MessageParcel &data, MessageParcel &reply); 75 76 int32_t HandleSetVisibleChange(MessageParcel &data, MessageParcel &reply); 77 78 int32_t HandleRecycleForm(MessageParcel &data, MessageParcel &reply); 79 80 int32_t HandleRecoverForm(MessageParcel &data, MessageParcel &reply); 81 82 int32_t HandleUpdateFormSize(MessageParcel &data, MessageParcel &reply); 83 private: 84 template<typename T> 85 int32_t GetParcelableInfos(MessageParcel &reply, std::vector<T> &parcelableInfos); 86 87 DISALLOW_COPY_AND_MOVE(FormRenderStub); 88 }; 89 } // namespace AppExecFwk 90 } // namespace OHOS 91 #endif // OHOS_FORM_FWK_FORM_RENDER_STUB_H 92