161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"),
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit AbilityKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport ExtensionAbility from './@ohos.app.ability.ExtensionAbility';
2261847f8eSopenharmony_ciimport type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
2361847f8eSopenharmony_ciimport type AutoFillExtensionContext from './application/AutoFillExtensionContext';
2461847f8eSopenharmony_ciimport type { FillRequest, SaveRequest, UpdateRequest, FillRequestCallback, SaveRequestCallback } from './application/AutoFillRequest';
2561847f8eSopenharmony_ci
2661847f8eSopenharmony_ci/**
2761847f8eSopenharmony_ci * The class of auto fill extension ability.
2861847f8eSopenharmony_ci *
2961847f8eSopenharmony_ci * @extends ExtensionAbility
3061847f8eSopenharmony_ci * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
3161847f8eSopenharmony_ci * @systemapi
3261847f8eSopenharmony_ci * @StageModelOnly
3361847f8eSopenharmony_ci * @since 11
3461847f8eSopenharmony_ci */
3561847f8eSopenharmony_ciexport default class AutoFillExtensionAbility extends ExtensionAbility {
3661847f8eSopenharmony_ci  /**
3761847f8eSopenharmony_ci   * Indicates configuration information about an auto fill extension ability context.
3861847f8eSopenharmony_ci   *
3961847f8eSopenharmony_ci   * @type { AutoFillExtensionContext }
4061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
4161847f8eSopenharmony_ci   * @systemapi
4261847f8eSopenharmony_ci   * @StageModelOnly
4361847f8eSopenharmony_ci   * @since 11
4461847f8eSopenharmony_ci   */
4561847f8eSopenharmony_ci  context: AutoFillExtensionContext;
4661847f8eSopenharmony_ci
4761847f8eSopenharmony_ci  /**
4861847f8eSopenharmony_ci   * Called back when an auto fill extension is started for initialization.
4961847f8eSopenharmony_ci   *
5061847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
5161847f8eSopenharmony_ci   * @systemapi
5261847f8eSopenharmony_ci   * @StageModelOnly
5361847f8eSopenharmony_ci   * @since 11
5461847f8eSopenharmony_ci   */
5561847f8eSopenharmony_ci  onCreate(): void;
5661847f8eSopenharmony_ci
5761847f8eSopenharmony_ci  /**
5861847f8eSopenharmony_ci   * Called back when a fill request is coming.
5961847f8eSopenharmony_ci   *
6061847f8eSopenharmony_ci   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
6161847f8eSopenharmony_ci   * @param { FillRequest } request - Indicates the fill request.
6261847f8eSopenharmony_ci   * @param { FillRequestCallback } callback - Indicates the fill request callback.
6361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
6461847f8eSopenharmony_ci   * @systemapi
6561847f8eSopenharmony_ci   * @StageModelOnly
6661847f8eSopenharmony_ci   * @since 11
6761847f8eSopenharmony_ci   */
6861847f8eSopenharmony_ci  onFillRequest(session: UIExtensionContentSession, request: FillRequest, callback: FillRequestCallback): void;
6961847f8eSopenharmony_ci
7061847f8eSopenharmony_ci  /**
7161847f8eSopenharmony_ci   * Called back when a save request is coming.
7261847f8eSopenharmony_ci   *
7361847f8eSopenharmony_ci   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
7461847f8eSopenharmony_ci   * @param { SaveRequest } request - Indicates the fill request.
7561847f8eSopenharmony_ci   * @param { SaveRequestCallback } callback - Indicates the fill request callback.
7661847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
7761847f8eSopenharmony_ci   * @systemapi
7861847f8eSopenharmony_ci   * @StageModelOnly
7961847f8eSopenharmony_ci   * @since 11
8061847f8eSopenharmony_ci   */
8161847f8eSopenharmony_ci  onSaveRequest(session: UIExtensionContentSession, request: SaveRequest, callback: SaveRequestCallback): void;
8261847f8eSopenharmony_ci
8361847f8eSopenharmony_ci  /**
8461847f8eSopenharmony_ci   * Called back when an update request is coming.
8561847f8eSopenharmony_ci   *
8661847f8eSopenharmony_ci   * @param { UpdateRequest } request - Indicates the update request.
8761847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
8861847f8eSopenharmony_ci   * @systemapi
8961847f8eSopenharmony_ci   * @StageModelOnly
9061847f8eSopenharmony_ci   * @since 12
9161847f8eSopenharmony_ci   */
9261847f8eSopenharmony_ci  onUpdateRequest(request: UpdateRequest): void;
9361847f8eSopenharmony_ci
9461847f8eSopenharmony_ci  /**
9561847f8eSopenharmony_ci   * Called back when an auto fill extension session is destroyed.
9661847f8eSopenharmony_ci   *
9761847f8eSopenharmony_ci   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
9861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
9961847f8eSopenharmony_ci   * @systemapi
10061847f8eSopenharmony_ci   * @StageModelOnly
10161847f8eSopenharmony_ci   * @since 11
10261847f8eSopenharmony_ci   */
10361847f8eSopenharmony_ci  onSessionDestroy(session: UIExtensionContentSession): void;
10461847f8eSopenharmony_ci
10561847f8eSopenharmony_ci  /**
10661847f8eSopenharmony_ci   * Called back when the state of an auto fill extension changes to foreground.
10761847f8eSopenharmony_ci   *
10861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
10961847f8eSopenharmony_ci   * @systemapi
11061847f8eSopenharmony_ci   * @StageModelOnly
11161847f8eSopenharmony_ci   * @since 11
11261847f8eSopenharmony_ci   */
11361847f8eSopenharmony_ci  onForeground(): void;
11461847f8eSopenharmony_ci
11561847f8eSopenharmony_ci  /**
11661847f8eSopenharmony_ci   * Called back when the state of an auto fill extension changes to background.
11761847f8eSopenharmony_ci   *
11861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
11961847f8eSopenharmony_ci   * @systemapi
12061847f8eSopenharmony_ci   * @StageModelOnly
12161847f8eSopenharmony_ci   * @since 11
12261847f8eSopenharmony_ci   */
12361847f8eSopenharmony_ci  onBackground(): void;
12461847f8eSopenharmony_ci
12561847f8eSopenharmony_ci  /**
12661847f8eSopenharmony_ci   * Called back before an auto fill extension is destroyed.
12761847f8eSopenharmony_ci   *
12861847f8eSopenharmony_ci   * @returns { void | Promise<void> } the promise returned by the function.
12961847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
13061847f8eSopenharmony_ci   * @systemapi
13161847f8eSopenharmony_ci   * @StageModelOnly
13261847f8eSopenharmony_ci   * @since 11
13361847f8eSopenharmony_ci   */
13461847f8eSopenharmony_ci  onDestroy(): void | Promise<void>;
13561847f8eSopenharmony_ci}