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_context_menu_params_impl.h"
17
18 #include "base/bridge/ark_web_bridge_macros.h"
19
20 namespace OHOS::ArkWeb {
21
ArkWebContextMenuParamsImpl(std::shared_ptr<OHOS::NWeb::NWebContextMenuParams> nweb_context_menu_params)22 ArkWebContextMenuParamsImpl::ArkWebContextMenuParamsImpl(
23 std::shared_ptr<OHOS::NWeb::NWebContextMenuParams> nweb_context_menu_params)
24 : nweb_context_menu_params_(nweb_context_menu_params)
25 {}
26
GetXCoord()27 int32_t ArkWebContextMenuParamsImpl::GetXCoord()
28 {
29 return nweb_context_menu_params_->GetXCoord();
30 }
31
GetYCoord()32 int32_t ArkWebContextMenuParamsImpl::GetYCoord()
33 {
34 return nweb_context_menu_params_->GetYCoord();
35 }
36
IsEditable()37 bool ArkWebContextMenuParamsImpl::IsEditable()
38 {
39 return nweb_context_menu_params_->IsEditable();
40 }
41
GetLinkUrl()42 ArkWebString ArkWebContextMenuParamsImpl::GetLinkUrl()
43 {
44 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetLinkUrl());
45 }
46
GetPageUrl()47 ArkWebString ArkWebContextMenuParamsImpl::GetPageUrl()
48 {
49 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetPageUrl());
50 }
51
GetSourceUrl()52 ArkWebString ArkWebContextMenuParamsImpl::GetSourceUrl()
53 {
54 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetSourceUrl());
55 }
56
GetTitleText()57 ArkWebString ArkWebContextMenuParamsImpl::GetTitleText()
58 {
59 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetTitleText());
60 }
61
GetSelectionText()62 ArkWebString ArkWebContextMenuParamsImpl::GetSelectionText()
63 {
64 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetSelectionText());
65 }
66
GetMediaType()67 int ArkWebContextMenuParamsImpl::GetMediaType()
68 {
69 return static_cast<int>(nweb_context_menu_params_->GetMediaType());
70 }
71
GetSourceType()72 int ArkWebContextMenuParamsImpl::GetSourceType()
73 {
74 return static_cast<int>(nweb_context_menu_params_->GetSourceType());
75 }
76
GetInputFieldType()77 int ArkWebContextMenuParamsImpl::GetInputFieldType()
78 {
79 return static_cast<int>(nweb_context_menu_params_->GetInputFieldType());
80 }
81
HasImageContents()82 bool ArkWebContextMenuParamsImpl::HasImageContents()
83 {
84 return nweb_context_menu_params_->HasImageContents();
85 }
86
GetEditStateFlags()87 int32_t ArkWebContextMenuParamsImpl::GetEditStateFlags()
88 {
89 return nweb_context_menu_params_->GetEditStateFlags();
90 }
91
GetUnfilteredLinkUrl()92 ArkWebString ArkWebContextMenuParamsImpl::GetUnfilteredLinkUrl()
93 {
94 return ArkWebStringClassToStruct(nweb_context_menu_params_->GetUnfilteredLinkUrl());
95 }
96
GetContextMenuTypeFlags()97 int32_t ArkWebContextMenuParamsImpl::GetContextMenuTypeFlags()
98 {
99 return nweb_context_menu_params_->GetContextMenuTypeFlags();
100 }
101
GetImageRect(int & x,int & y,int & w,int & h)102 void ArkWebContextMenuParamsImpl::GetImageRect(int& x, int& y, int& w, int& h)
103 {
104 nweb_context_menu_params_->GetImageRect(x, y, w, h);
105 }
106
107 } // namespace OHOS::ArkWeb
108