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 virtual int32_t NotifyWhetherFormsVisible(const AppExecFwk::FormVisibilityType visibleType, 43 const std::string &bundleName, std::vector<AppExecFwk::FormInstance> &runningFormInfos) = 0; 44 45 enum class Message { 46 FORM_STATE_OBSERVER_ON_ADD_FORM = 4302, 47 FORM_STATE_OBSERVER_ON_REMOVE_FORM = 4303, 48 FORM_STATE_OBSERVER_NOTIFY_WHETHER_FORMS_VISIBLE = 4304 49 }; 50 }; 51 } // namespace AbilityRuntime 52 } // namespace OHOS 53 54 #endif // OHOS_FORM_FWK_JS_FORM_STATE_OBSERVER_INTERFACE_H