1 /*
2  * Copyright (c) 2022 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 #ifndef OHOS_FORM_FWK_FORM_BUNDLE_EVENT_CALLBACK_H
16 #define OHOS_FORM_FWK_FORM_BUNDLE_EVENT_CALLBACK_H
17 
18 #include "bundle_event_callback_host.h"
19 #include "common_event_support.h"
20 #include "fms_log_wrapper.h"
21 #include "form_event_handler.h"
22 #include "form_event_util.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 /**
27  * @brief This class is a callback class that will be registered to BundleManager.
28  * This class will be called by BundleManager when install, uninstall, updates of haps happens,
29  * and executes corresponding functionalities of Form.
30  */
31 class FormBundleEventCallback : public BundleEventCallbackHost {
32 public:
33     FormBundleEventCallback();
34 
35     ~FormBundleEventCallback();
36 
37     /**
38      * @brief The main callback function that will be called by BundleManager
39      * when install, uninstall, updates of haps happens to notify FormManger.
40      * @param eventData the data passed from BundleManager that includes bundleName, change type of haps
41      * etc. More can be found from BundleCommonEventMgr::NotifyBundleStatus()
42      */
43     void OnReceiveEvent(const EventFwk::CommonEventData eventData) override;
44 private:
45     DISALLOW_COPY_AND_MOVE(FormBundleEventCallback);
46 };
47 } // namespace OHOS
48 } // namespace AppExecFwk
49 #endif // OHOS_FORM_FWK_FORM_BUNDLE_EVENT_CALLBACK_H