122736c2fSopenharmony_ci/*
222736c2fSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
322736c2fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
422736c2fSopenharmony_ci * you may not use this file except in compliance with the License.
522736c2fSopenharmony_ci * You may obtain a copy of the License at
622736c2fSopenharmony_ci *
722736c2fSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
822736c2fSopenharmony_ci *
922736c2fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1022736c2fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1122736c2fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1222736c2fSopenharmony_ci * See the License for the specific language governing permissions and
1322736c2fSopenharmony_ci * limitations under the License.
1422736c2fSopenharmony_ci */
1522736c2fSopenharmony_ci
1622736c2fSopenharmony_ci#ifndef FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H
1722736c2fSopenharmony_ci#define FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H
1822736c2fSopenharmony_ci
1922736c2fSopenharmony_ci#include "extension_base.h"
2022736c2fSopenharmony_ci#include "inputmethod_extension_context.h"
2122736c2fSopenharmony_ci#include "runtime.h"
2222736c2fSopenharmony_ci
2322736c2fSopenharmony_cinamespace OHOS {
2422736c2fSopenharmony_cinamespace AbilityRuntime {
2522736c2fSopenharmony_ci/**
2622736c2fSopenharmony_ci * @brief Basic inputmethod components.
2722736c2fSopenharmony_ci */
2822736c2fSopenharmony_ciclass InputMethodExtension : public ExtensionBase<InputMethodExtensionContext> {
2922736c2fSopenharmony_cipublic:
3022736c2fSopenharmony_ci    InputMethodExtension() = default;
3122736c2fSopenharmony_ci    virtual ~InputMethodExtension() = default;
3222736c2fSopenharmony_ci
3322736c2fSopenharmony_ci    /**
3422736c2fSopenharmony_ci   * @brief Create and init context.
3522736c2fSopenharmony_ci   *
3622736c2fSopenharmony_ci   * @param record the extension record.
3722736c2fSopenharmony_ci   * @param application the application info.
3822736c2fSopenharmony_ci   * @param handler the extension handler.
3922736c2fSopenharmony_ci   * @param token the remote token.
4022736c2fSopenharmony_ci   * @return The created context.
4122736c2fSopenharmony_ci   */
4222736c2fSopenharmony_ci    virtual std::shared_ptr<InputMethodExtensionContext>
4322736c2fSopenharmony_ci    CreateAndInitContext(const std::shared_ptr<AbilityLocalRecord> &record,
4422736c2fSopenharmony_ci        const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
4522736c2fSopenharmony_ci        const sptr<IRemoteObject> &token) override;
4622736c2fSopenharmony_ci
4722736c2fSopenharmony_ci    /**
4822736c2fSopenharmony_ci   * @brief Init the extension.
4922736c2fSopenharmony_ci   *
5022736c2fSopenharmony_ci   * @param record the extension record.
5122736c2fSopenharmony_ci   * @param application the application info.
5222736c2fSopenharmony_ci   * @param handler the extension handler.
5322736c2fSopenharmony_ci   * @param token the remote token.
5422736c2fSopenharmony_ci   */
5522736c2fSopenharmony_ci    virtual void Init(const std::shared_ptr<AbilityLocalRecord> &record,
5622736c2fSopenharmony_ci        const std::shared_ptr<OHOSApplication> &application, std::shared_ptr<AbilityHandler> &handler,
5722736c2fSopenharmony_ci        const sptr<IRemoteObject> &token) override;
5822736c2fSopenharmony_ci
5922736c2fSopenharmony_ci    /**
6022736c2fSopenharmony_ci   * @brief Create Extension.
6122736c2fSopenharmony_ci   *
6222736c2fSopenharmony_ci   * @param runtime The runtime.
6322736c2fSopenharmony_ci   * @return The InputMethodExtension instance.
6422736c2fSopenharmony_ci   */
6522736c2fSopenharmony_ci    static InputMethodExtension *Create(const std::unique_ptr<Runtime> &runtime);
6622736c2fSopenharmony_ci
6722736c2fSopenharmony_ci    /**
6822736c2fSopenharmony_ci     * @brief Called when the system configuration is updated.
6922736c2fSopenharmony_ci     *
7022736c2fSopenharmony_ci     * @param configuration Indicates the updated configuration information.
7122736c2fSopenharmony_ci     */
7222736c2fSopenharmony_ci    void OnConfigurationUpdated(const AppExecFwk::Configuration &config) override;
7322736c2fSopenharmony_ci};
7422736c2fSopenharmony_ci} // namespace AbilityRuntime
7522736c2fSopenharmony_ci} // namespace OHOS
7622736c2fSopenharmony_ci#endif // FOUNDATION_ABILITYRUNTIME_OHOS_INPUTMETHOD_EXTENSION_H