• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H
17 #define OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H
18 
19 #include "form_edit_extension.h"
20 #include "configuration.h"
21 #include "js_ui_extension_base.h"
22 #include <unordered_set>
23 
24 class NativeReference;
25 
26 namespace OHOS {
27 namespace AbilityRuntime {
28 class JsRuntime;
29 class JsFormEditExtensionImpl;
30 
31 /**
32  * @brief Basic form edit extension components.
33  */
34 class JsFormEditExtension : public FormEditExtension, public std::enable_shared_from_this<JsFormEditExtension> {
35 public:
36     explicit JsFormEditExtension(const std::unique_ptr<Runtime> &runtime);
37     ~JsFormEditExtension() override = default;
38 
39 /**
40      * @brief Init the form edit extension.
41      *
42      * @param record the form edit extension record.
43      * @param application the application info.
44      * @param handler the form edit extension handler.
45      * @param token the remote token.
46      */
47     void Init(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &record,
48         const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
49         std::shared_ptr<AppExecFwk::AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
50 
51     /**
52      * @brief Create JsFormEditExtension.
53      *
54      * @param runtime The runtime.
55      * @return The JsFormEditExtension instance.
56      */
57     static JsFormEditExtension *Create(const std::unique_ptr<Runtime> &runtime);
58 
59 private:
60     std::shared_ptr<JsFormEditExtensionImpl> impl_ = nullptr;
61 };
62 } // namespace AbilityRuntime
63 } // namespace OHOS
64 #endif // OHOS_ABILITY_RUNTIME_JS_FORM_EDIT_EXTENSION_H