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 #include "ohos_nweb/bridge/ark_web_native_embed_data_info_wrapper.h" 17 18 #include "ohos_nweb/bridge/ark_web_native_embed_info_wrapper.h" 19 20 #include "base/bridge/ark_web_bridge_macros.h" 21 22 namespace OHOS::ArkWeb { 23 ArkWebNativeEmbedDataInfoWrapper(ArkWebRefPtr<ArkWebNativeEmbedDataInfo> ark_web_native_embed_data_info)24ArkWebNativeEmbedDataInfoWrapper::ArkWebNativeEmbedDataInfoWrapper( 25 ArkWebRefPtr<ArkWebNativeEmbedDataInfo> ark_web_native_embed_data_info) 26 : ark_web_native_embed_data_info_(ark_web_native_embed_data_info) 27 {} 28 GetStatus()29ArkWebNativeEmbedStatus ArkWebNativeEmbedDataInfoWrapper::GetStatus() 30 { 31 return static_cast<ArkWebNativeEmbedStatus>(ark_web_native_embed_data_info_->GetStatus()); 32 } 33 GetEmbedId()34std::string ArkWebNativeEmbedDataInfoWrapper::GetEmbedId() 35 { 36 ArkWebString stEmbedId = ark_web_native_embed_data_info_->GetEmbedId(); 37 38 std::string objEmbedId = ArkWebStringStructToClass(stEmbedId); 39 ArkWebStringStructRelease(stEmbedId); 40 return objEmbedId; 41 } 42 GetSurfaceId()43std::string ArkWebNativeEmbedDataInfoWrapper::GetSurfaceId() 44 { 45 ArkWebString stSurfaceId = ark_web_native_embed_data_info_->GetSurfaceId(); 46 47 std::string objSurfaceId = ArkWebStringStructToClass(stSurfaceId); 48 ArkWebStringStructRelease(stSurfaceId); 49 return objSurfaceId; 50 } 51 GetNativeEmbedInfo()52std::shared_ptr<OHOS::NWeb::NWebNativeEmbedInfo> ArkWebNativeEmbedDataInfoWrapper::GetNativeEmbedInfo() 53 { 54 ArkWebRefPtr<ArkWebNativeEmbedInfo> ark_web_native_embed_info = 55 ark_web_native_embed_data_info_->GetNativeEmbedInfo(); 56 if (CHECK_REF_PTR_IS_NULL(ark_web_native_embed_info)) { 57 return nullptr; 58 } 59 60 return std::make_shared<ArkWebNativeEmbedInfoWrapper>(ark_web_native_embed_info); 61 } 62 63 } // namespace OHOS::ArkWeb 64