1 /*
2  * Copyright (c) 2022-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 FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_STUB_IMPL_H
17 #define FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_STUB_IMPL_H
18 
19 #include <memory>
20 
21 #include "enterprise_admin_stub.h"
22 #include "js_enterprise_admin_extension.h"
23 
24 namespace OHOS {
25 namespace EDM {
26 class EnterpriseAdminStubImpl : public EnterpriseAdminStub {
27 public:
EnterpriseAdminStubImpl(const std::shared_ptr<JsEnterpriseAdminExtension> & extension)28     explicit EnterpriseAdminStubImpl(const std::shared_ptr<JsEnterpriseAdminExtension>& extension)
29         : extension_(extension) {}
30 
~EnterpriseAdminStubImpl()31     virtual ~EnterpriseAdminStubImpl() {}
32 
33     /**
34      * @brief The OnAdminEnabled callback.
35      */
36     void OnAdminEnabled() override;
37 
38     /**
39      * @brief The OnAdminDisabled callback.
40      */
41     void OnAdminDisabled() override;
42 
43     void OnBundleAdded(const std::string &bundleName, int32_t accountId) override;
44 
45     void OnBundleRemoved(const std::string &bundleName, int32_t accountId) override;
46 
47     void OnAppStart(const std::string &bundleName) override;
48 
49     void OnAppStop(const std::string &bundleName) override;
50 
51     void OnSystemUpdate(const UpdateInfo &updateInfo) override;
52 private:
53     std::weak_ptr<JsEnterpriseAdminExtension> extension_;
54 };
55 } // namespace EDM
56 } // namespace OHOS
57 #endif // FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_STUB_IMPL_H
58 
59