• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2024 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/**
17 * @file
18 * @kit AbilityKit
19 */
20
21import ExtensionAbility from './@ohos.app.ability.ExtensionAbility';
22import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
23import type AutoFillExtensionContext from './application/AutoFillExtensionContext';
24import type { FillRequest, SaveRequest, UpdateRequest, FillRequestCallback, SaveRequestCallback } from './application/AutoFillRequest';
25
26/**
27 * The class of auto fill extension ability.
28 *
29 * @extends ExtensionAbility
30 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
31 * @systemapi
32 * @StageModelOnly
33 * @since 11
34 */
35export default class AutoFillExtensionAbility extends ExtensionAbility {
36  /**
37   * Indicates configuration information about an auto fill extension ability context.
38   *
39   * @type { AutoFillExtensionContext }
40   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
41   * @systemapi
42   * @StageModelOnly
43   * @since 11
44   */
45  context: AutoFillExtensionContext;
46
47  /**
48   * Called back when an auto fill extension is started for initialization.
49   *
50   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
51   * @systemapi
52   * @StageModelOnly
53   * @since 11
54   */
55  onCreate(): void;
56
57  /**
58   * Called back when a fill request is coming.
59   *
60   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
61   * @param { FillRequest } request - Indicates the fill request.
62   * @param { FillRequestCallback } callback - Indicates the fill request callback.
63   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
64   * @systemapi
65   * @StageModelOnly
66   * @since 11
67   */
68  onFillRequest(session: UIExtensionContentSession, request: FillRequest, callback: FillRequestCallback): void;
69
70  /**
71   * Called back when a save request is coming.
72   *
73   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
74   * @param { SaveRequest } request - Indicates the fill request.
75   * @param { SaveRequestCallback } callback - Indicates the fill request callback.
76   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
77   * @systemapi
78   * @StageModelOnly
79   * @since 11
80   */
81  onSaveRequest(session: UIExtensionContentSession, request: SaveRequest, callback: SaveRequestCallback): void;
82
83  /**
84   * Called back when an update request is coming.
85   *
86   * @param { UpdateRequest } request - Indicates the update request.
87   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
88   * @systemapi
89   * @StageModelOnly
90   * @since 12
91   */
92  onUpdateRequest(request: UpdateRequest): void;
93
94  /**
95   * Called back when an auto fill extension session is destroyed.
96   *
97   * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page.
98   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
99   * @systemapi
100   * @StageModelOnly
101   * @since 11
102   */
103  onSessionDestroy(session: UIExtensionContentSession): void;
104
105  /**
106   * Called back when the state of an auto fill extension changes to foreground.
107   *
108   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
109   * @systemapi
110   * @StageModelOnly
111   * @since 11
112   */
113  onForeground(): void;
114
115  /**
116   * Called back when the state of an auto fill extension changes to background.
117   *
118   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
119   * @systemapi
120   * @StageModelOnly
121   * @since 11
122   */
123  onBackground(): void;
124
125  /**
126   * Called back before an auto fill extension is destroyed.
127   *
128   * @returns { void | Promise<void> } the promise returned by the function.
129   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
130   * @systemapi
131   * @StageModelOnly
132   * @since 11
133   */
134  onDestroy(): void | Promise<void>;
135}