• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #include <unistd.h>
16 
17 #include "napi/native_api.h"
18 #include "napi/native_node_api.h"
19 #include "napi_geolocation_permission.h"
20 #include "napi_web_async_controller.h"
21 #include "napi_webview_controller.h"
22 #include "napi_webview_function.h"
23 #include "napi_web_cookie_manager.h"
24 #include "napi_web_data_base.h"
25 #include "napi_web_storage.h"
26 
27 namespace OHOS {
28 namespace NWeb {
29 EXTERN_C_START
WebViewExport(napi_env env,napi_value exports)30 static napi_value WebViewExport(napi_env env, napi_value exports)
31 {
32     NapiWebDataBase::Init(env, exports);
33     NapiWebStorage::Init(env, exports);
34     NapiWebAsyncController::Init(env, exports);
35     NapiWebviewController::Init(env, exports);
36     NapiWebCookieManager::Init(env, exports);
37     NapiGeolocationPermission::Init(env, exports);
38     WebFunctionInit(env, exports);
39     return exports;
40 }
41 EXTERN_C_END
42 
43 /*
44  * module define
45  */
46 static napi_module _module = {
47     .nm_version = 1,
48     .nm_flags = 0,
49     .nm_filename = nullptr,
50     .nm_register_func = WebViewExport,
51     .nm_modname = "web.webview",
52     .nm_priv = ((void *)0),
53     .reserved = {0}
54 };
55 
56 /*
57  * module register
58  */
Register()59 extern "C" __attribute__((constructor)) void Register()
60 {
61     napi_module_register(&_module);
62 }
63 } // namespace NWeb
64 } // namesapce OHOS
65