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 
16 #ifndef FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_EXTENSION_H
17 #define FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_EXTENSION_H
18 
19 #include "enterprise_admin_extension_context.h"
20 #include "extension_base.h"
21 #include "extension_context.h"
22 
23 namespace OHOS {
24 namespace EDM {
25 class EnterpriseAdminExtension : public AbilityRuntime::ExtensionBase<EnterpriseAdminExtensionContext> {
26 public:
27     EnterpriseAdminExtension() = default;
28     virtual ~EnterpriseAdminExtension() = default;
29 
30     /**
31      * @brief Create and init context.
32      *
33      * @param record The record info.
34      * @param application The application info.
35      * @param handler The handler.
36      * @param token The remote object token.
37      * @return The context
38      */
39     std::shared_ptr<EnterpriseAdminExtensionContext> CreateAndInitContext(
40         const std::shared_ptr<AppExecFwk::AbilityLocalRecord>& record,
41         const std::shared_ptr<AppExecFwk::OHOSApplication>& application,
42         std::shared_ptr<AppExecFwk::AbilityHandler>& handler,
43         const sptr<IRemoteObject>& token) override;
44 
45     /**
46      * @brief The Init.
47      *
48      * @param record The record.
49      * @param application The application.
50      * @param handler The handler.
51      * @param token The remmote object token.
52      */
53     void Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord>& record,
54         const std::shared_ptr<AppExecFwk::OHOSApplication>& application,
55         std::shared_ptr<AppExecFwk::AbilityHandler>& handler,
56         const sptr<IRemoteObject>& token) override;
57 
58     static EnterpriseAdminExtension* Create(const std::unique_ptr<AbilityRuntime::Runtime>& runtime);
59 };
60 }  // namespace EDM
61 }  // namespace OHOS
62 #endif  // FRAMEWORK_EXTENSION_INCLUDE_ENTERPRISE_ADMIN_EXTENSION_H