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_JS_FORM_STATE_OBSERVER_PROXY_H 17 #define OHOS_FORM_FWK_JS_FORM_STATE_OBSERVER_PROXY_H 18 19 #include "js_form_state_observer_interface.h" 20 #include "iremote_proxy.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 class JsFormStateObserverProxy : public IRemoteProxy<IJsFormStateObserver> { 25 public: JsFormStateObserverProxy(const sptr<IRemoteObject> & impl)26 explicit JsFormStateObserverProxy(const sptr<IRemoteObject> &impl) : IRemoteProxy<IJsFormStateObserver>(impl) 27 {} 28 virtual ~JsFormStateObserverProxy() = default; 29 30 /** 31 * @brief The form added. 32 * @param bundleName The bundle name of the form host. 33 */ 34 virtual int32_t OnAddForm(const std::string &bundleName, const AppExecFwk::RunningFormInfo &runningFormInfo); 35 36 /** 37 * @brief The form removed. 38 * @param bundleName The bundle name of the form host. 39 */ 40 virtual int32_t OnRemoveForm(const std::string &bundleName, const AppExecFwk::RunningFormInfo &runningFormInfo); 41 42 /** 43 * @brief The form click event. 44 * @param bundleName BundleName of the form host. 45 * @param callType The click event type. 46 * @param runningFormInfo The running form info. 47 */ 48 virtual int32_t OnFormClickEvent( 49 const std::string &bundleName, const std::string &callType, const AppExecFwk::RunningFormInfo &runningFormInfo); 50 51 virtual int32_t NotifyWhetherFormsVisible(const AppExecFwk::FormVisibilityType visibleType, 52 const std::string &bundleName, std::vector<AppExecFwk::FormInstance> &runningFormInfos); 53 54 private: 55 static inline BrokerDelegator<JsFormStateObserverProxy> delegator_; 56 int SendTransactCmd(IJsFormStateObserver::Message code, MessageParcel &data, 57 MessageParcel &reply, MessageOption &option); 58 }; 59 } // namespace AbilityRuntime 60 } // namespace OHOS 61 62 #endif // OHOS_FORM_FWK_JS_FORM_STATE_OBSERVER_PROXY_H 63