• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CALLBACK_H
17 #define OHOS_ABILITY_RUNTIME_AUTO_FILL_EXTENSION_CALLBACK_H
18 
19 #include "fill_request_callback_interface.h"
20 #include "save_request_callback_interface.h"
21 #include "ui_content.h"
22 #include "want.h"
23 
24 namespace OHOS {
25 namespace AbilityRuntime {
26 class AutoFillExtensionCallback {
27 public:
28     AutoFillExtensionCallback() = default;
29     ~AutoFillExtensionCallback() = default;
30 
31     void OnResult(int32_t errCode, const AAFwk::Want &want);
32     void OnRelease(int32_t errCode);
33     void OnError(int32_t errCode, const std::string &name, const std::string &message);
34     void OnReceive(const AAFwk::WantParams &wantParams);
35 
36     void SetFillRequestCallback(const std::shared_ptr<IFillRequestCallback> &callback);
37     void SetSaveRequestCallback(const std::shared_ptr<ISaveRequestCallback> &callback);
38 
39     void SetSessionId(int32_t sessionId);
40     void SetUIContent(Ace::UIContent *uiContent);
41     void SetEventId(uint32_t eventId);
42     void HandleTimeOut();
43 
44 private:
45     void SendAutoFillSucess(const AAFwk::Want &want);
46     void SendAutoFillFailed(int32_t errCode);
47     void CloseModalUIExtension();
48 
49     std::shared_ptr<IFillRequestCallback> fillCallback_;
50     std::shared_ptr<ISaveRequestCallback> saveCallback_;
51     int32_t sessionId_;
52     Ace::UIContent *uiContent_ = nullptr;
53     uint32_t eventId_ = 0;
54 };
55 } // AbilityRuntime
56 } // OHOS
57 #endif // OHOS_ABILITY_RUNTIME_AUTO_FILL_EXTENSION_CALLBACK_H