• 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 
16 #ifndef NWEB_NAPI_WEB_DATA_BASE_H
17 #define NWEB_NAPI_WEB_DATA_BASE_H
18 
19 #include <cstddef>
20 #include <iosfwd>
21 #include <string>
22 
23 #include "napi/native_api.h"
24 #include "napi/native_node_api.h"
25 
26 namespace OHOS {
27 namespace NWeb {
28 class NapiWebDataBase {
29 public:
NapiWebDataBase()30     NapiWebDataBase() {}
31 
32     ~NapiWebDataBase() = default;
33 
34     static napi_value Init(napi_env env, napi_value exports);
35 
36 private:
37     static napi_value JsDeleteHttpAuthCredentials(napi_env env, napi_callback_info info);
38 
39     static napi_value JsSaveHttpAuthCredentials(napi_env env, napi_callback_info info);
40 
41     static napi_value JsGetHttpAuthCredentials(napi_env env, napi_callback_info info);
42 
43     static napi_value JsExistHttpAuthCredentials(napi_env env, napi_callback_info info);
44 
45     static napi_value JsConstructor(napi_env env, napi_callback_info info);
46 
47     static bool GetStringPara(napi_env env, napi_value argv, std::string& outValue);
48 
49     static bool GetSize(napi_env env, napi_value argv, size_t& outValue);
50 
51     static bool GetCharPara(napi_env env, napi_value argv, char* buffer, size_t bufferSize);
52 };
53 } // namespace NWeb
54 } // namespace OHOS
55 
56 #endif // NWEB_NAPI_WEB_DATA_BASE_H
57