1/*
2 * Copyright (c) 2024 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/**
17 * @addtogroup Web
18 * @{
19 *
20 * @brief Provide the definition of the C interface for the native ArkWeb.
21 * @since 12
22 */
23/**
24 * @file arkweb_interface.h
25 *
26 * @brief Provides a unified entry for the native ArkWeb.
27 * @kit ArkWeb
28 * @library libohweb.so
29 * @syscap SystemCapability.Web.Webview.Core
30 * @since 12
31 */
32
33#ifndef ARKWEB_INTERFACE_H
34#define ARKWEB_INTERFACE_H
35
36#include "arkweb_type.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/**
43 * @brief Defines the native API type of any size.
44 *
45 * @since 12
46 */
47typedef struct {
48    /** Defines the size information of the native API set. */
49    size_t size;
50} ArkWeb_AnyNativeAPI;
51
52/**
53 * @brief Defines the native API set type.
54 *
55 * @since 12
56 */
57typedef enum {
58    /** API type related to ArkWeb component. */
59    ARKWEB_NATIVE_COMPONENT,
60    /** API type related to ArkWeb controller. */
61    ARKWEB_NATIVE_CONTROLLER,
62    /** API type related to ArkWeb WebMessagePort. */
63    ARKWEB_NATIVE_WEB_MESSAGE_PORT,
64    /** API type related to ArkWeb WebMessage. */
65    ARKWEB_NATIVE_WEB_MESSAGE,
66    /** API type related to ArkWeb cookie manager. */
67    ARKWEB_NATIVE_COOKIE_MANAGER,
68} ArkWeb_NativeAPIVariantKind;
69
70/*
71 * @brief Obtains the native API set of a specified type.
72 * @param type Indicates the type of the native API set provided by ArkWeb.
73 * @return Return the pointer to the native API abstract object that carries the size.
74 *
75 * @syscap SystemCapability.Web.Webview.Core
76 * @since 12
77 */
78ArkWeb_AnyNativeAPI* OH_ArkWeb_GetNativeAPI(ArkWeb_NativeAPIVariantKind type);
79
80#ifdef __cplusplus
81};
82#endif
83#endif // ARKWEB_INTERFACE_H