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