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_INTERFACE_H 17 #define OHOS_FORM_FWK_JS_FORM_STATE_OBSERVER_INTERFACE_H 18 19 #include <string> 20 #include "form_instance.h" 21 #include "iremote_broker.h" 22 #include "running_form_info.h" 23 24 namespace OHOS { 25 namespace AbilityRuntime { 26 class IJsFormStateObserver : public OHOS::IRemoteBroker { 27 public: 28 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.IJsFormStateObserver"); 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) = 0; 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) = 0; 41 42 /** 43 * @brief The form click event. 44 * @param bundleName BundleName of the form host. 45 * @param formEventType The click event type. 46 * @param runningFormInfo The running form info. 47 */ 48 virtual int32_t OnFormClickEvent(const std::string &bundleName, const std::string &formEventType, 49 const AppExecFwk::RunningFormInfo &runningFormInfo) = 0; 50 51 virtual int32_t NotifyWhetherFormsVisible(const AppExecFwk::FormVisibilityType visibleType, 52 const std::string &bundleName, std::vector<AppExecFwk::FormInstance> &runningFormInfos) = 0; 53 54 enum class Message { 55 FORM_STATE_OBSERVER_ON_ADD_FORM = 4302, 56 FORM_STATE_OBSERVER_ON_REMOVE_FORM = 4303, 57 FORM_STATE_OBSERVER_NOTIFY_WHETHER_FORMS_VISIBLE = 4304, 58 FORM_STATE_OBSERVER_ON_FORM_CLICK = 4305 59 }; 60 }; 61 } // namespace AbilityRuntime 62 } // namespace OHOS 63 64 #endif // OHOS_FORM_FWK_JS_FORM_STATE_OBSERVER_INTERFACE_H