• 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_FORM_FWK_JS_FORM_AGENT_H
17 #define OHOS_FORM_FWK_JS_FORM_AGENT_H
18 
19 #include "ability.h"
20 #include "form_provider_info.h"
21 #include "napi_form_util.h"
22 #include "napi/native_api.h"
23 #include "napi/native_common.h"
24 #include "napi/native_node_api.h"
25 #include "nlohmann/json.hpp"
26 #include "want.h"
27 #include <vector>
28 
29 namespace OHOS {
30 namespace AbilityRuntime {
31 struct RequestPublishFormCallbackInfo {
32     Want want {};
33     bool withFormBindingData = false;
34     std::unique_ptr<OHOS::AppExecFwk::FormProviderData> formProviderData = nullptr;
35     std::vector<AppExecFwk::FormDataProxy> formDataProxies;
36 };
37 
38 class JsFormAgent {
39 public:
40     JsFormAgent() = default;
41     ~JsFormAgent() = default;
42 
43     static void Finalizer(napi_env env, void* data, void* hint);
44     static napi_value RequestPublishForm(napi_env env, napi_callback_info info);
45 private:
46     napi_value OnRequestPublishForm(napi_env env, size_t argc, napi_value* argv);
47 };
48 }  // namespace AbilityRuntime
49 }  // namespace OHOS
50 #endif /* OHOS_FORM_FWK_JS_FORM_AGENT_H */
51