• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 #ifndef OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H
16 #define OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H
17 
18 #include "form_js_info.h"
19 #include "form_state_info.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 class FormCallbackInterface {
24 public:
25     /**
26      * @brief Update form.
27      *
28      * @param formJsInfo Indicates the obtained {@code FormJsInfo} instance.
29      */
30     virtual void ProcessFormUpdate(const FormJsInfo &formJsInfo) = 0;
31 
32     /**
33      * @brief Uninstall form.
34      *
35      * @param formId Indicates the ID of the form to uninstall.
36      */
37     virtual void ProcessFormUninstall(const int64_t formId) = 0;
38 
39     /**
40      * @brief Form service death event.
41      *
42      */
43     virtual void OnDeathReceived() = 0;
44 
45     /**
46      * @brief Return error.
47      *
48      * @param errorCode Indicates error-code of the form.
49      * @param errorMsg Indicates error-message of the form.
50      */
51     virtual void OnError(const int32_t errorCode, const std::string &errorMsg) = 0;
52 
53     /**
54      * @brief Recycle form.
55      */
ProcessRecycleForm()56     virtual void ProcessRecycleForm() {}
57 
58     /**
59      * @brief Enable form.
60      * @param enable True is enable form, false is disable form.
61      */
ProcessEnableForm(bool enable)62     virtual void ProcessEnableForm(bool enable) {}
63 
64     /**
65      * @brief Lock form.
66      * @param enable True is lock form, false is unlock form.
67      */
ProcessLockForm(bool lock)68     virtual void ProcessLockForm(bool lock) {}
69 };
70 
71 class FormStateCallbackInterface {
72 public:
73 /**
74  * @brief acquire form state.
75  *
76  * @param state Indicates the form state.
77  */
78 virtual void ProcessAcquireState(FormState state) = 0;
79 };
80 
81 class FormDataCallbackInterface {
82 public:
83 /**
84  * @brief acquire form data.
85  *
86  * @param state Indicates the form data.
87  */
88 virtual void ProcessAcquireFormData(AAFwk::WantParams data) = 0;
89 };
90 
91 class ShareFormCallBack {
92 public:
93     /**
94      * @brief share form callback.
95      *
96      * @param result Indicates the result for ShareForm.
97      */
98     virtual void ProcessShareFormResponse(int32_t result) = 0;
99 };
100 }  // namespace AppExecFwk
101 }  // namespace OHOS
102 #endif  // OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H
103