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 ARK_NET_CONNECT_ADAPTER_H 17 #define ARK_NET_CONNECT_ADAPTER_H 18 #pragma once 19 20 #include "base/include/ark_web_base_ref_counted.h" 21 #include "base/include/ark_web_types.h" 22 23 namespace OHOS::ArkWeb { 24 25 /*--ark web(source=webview)--*/ 26 class ArkNetCapabilitiesAdapter : public virtual ArkWebBaseRefCounted { 27 public: 28 /*--ark web()--*/ 29 virtual int32_t GetNetId() = 0; 30 31 /*--ark web()--*/ 32 virtual uint32_t GetConnectType() = 0; 33 34 /*--ark web()--*/ 35 virtual uint32_t GetConnectSubtype() = 0; 36 }; 37 38 /*--ark web(source=webview)--*/ 39 class ArkNetConnectionPropertiesAdapter : public virtual ArkWebBaseRefCounted { 40 public: 41 /*--ark web()--*/ 42 virtual int32_t GetNetId() = 0; 43 }; 44 45 /*--ark web(source=webcore)--*/ 46 class ArkNetConnCallback : public virtual ArkWebBaseRefCounted { 47 public: 48 /*--ark web()--*/ 49 virtual int32_t NetAvailable() = 0; 50 51 /*--ark web()--*/ 52 virtual int32_t NetCapabilitiesChange(const uint32_t& netConnectType, const uint32_t& netConnectSubtype) = 0; 53 54 /*--ark web()--*/ 55 virtual int32_t NetConnectionPropertiesChange() = 0; 56 57 /*--ark web()--*/ 58 virtual int32_t NetUnavailable() = 0; 59 60 /*--ark web()--*/ 61 virtual int32_t OnNetCapabilitiesChanged( 62 const ArkWebRefPtr<ArkNetCapabilitiesAdapter> capabilites) = 0; 63 64 /*--ark web()--*/ 65 virtual int32_t OnNetConnectionPropertiesChanged( 66 const ArkWebRefPtr<ArkNetConnectionPropertiesAdapter> properties) = 0; 67 }; 68 69 /*--ark web(source=webview)--*/ 70 class ArkNetConnectAdapter : public virtual ArkWebBaseRefCounted { 71 public: 72 /*--ark web()--*/ 73 virtual int32_t RegisterNetConnCallback(ArkWebRefPtr<ArkNetConnCallback> cb) = 0; 74 75 /*--ark web()--*/ 76 virtual int32_t UnregisterNetConnCallback(int32_t id) = 0; 77 78 /*--ark web()--*/ 79 virtual int32_t GetDefaultNetConnect(uint32_t& type, uint32_t& netConnectSubtype) = 0; 80 81 /*--ark web()--*/ 82 virtual ArkWebStringVector GetDnsServers() = 0; 83 84 /*--ark web()--*/ 85 virtual ArkWebStringVector GetDnsServersByNetId(int32_t netId) = 0; 86 }; 87 88 } // namespace OHOS::ArkWeb 89 90 #endif // ARK_NET_CONNECT_ADAPTER_H 91