• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H
17 #define FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H
18 
19 #include "extension_base.h"
20 #include "inputmethod_extension_context.h"
21 #include "runtime.h"
22 
23 namespace OHOS {
24 namespace AbilityRuntime {
25 /**
26  * @brief Basic inputmethod components.
27  */
28 class InputMethodExtension : public ExtensionBase<InputMethodExtensionContext>,
29                              public std::enable_shared_from_this<InputMethodExtension> {
30 public:
31     InputMethodExtension() = default;
32     virtual ~InputMethodExtension() = default;
33 
34     /**
35    * @brief Create and init context.
36    *
37    * @param record the extension record.
38    * @param application the application info.
39    * @param handler the extension handler.
40    * @param token the remote token.
41    * @return The created context.
42    */
43     virtual std::shared_ptr<InputMethodExtensionContext> CreateAndInitContext(
44         const std::shared_ptr<AbilityLocalRecord> &record, const std::shared_ptr<OHOSApplication> &application,
45         std::shared_ptr<AbilityHandler> &handler, const sptr<IRemoteObject> &token) override;
46 
47     /**
48    * @brief Init the extension.
49    *
50    * @param record the extension record.
51    * @param application the application info.
52    * @param handler the extension handler.
53    * @param token the remote token.
54    */
55     virtual void Init(const std::shared_ptr<AbilityLocalRecord> &record,
56         const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
57         const sptr<IRemoteObject> &token) override;
58 
59     /**
60    * @brief Create Extension.
61    *
62    * @param runtime The runtime.
63    * @return The InputMethodExtension instance.
64    */
65     static InputMethodExtension *Create(const std::unique_ptr<Runtime> &runtime);
66 };
67 } // namespace AbilityRuntime
68 } // namespace OHOS
69 #endif // FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H