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 #ifndef ARK_WEB_CONTEXT_MENU_PARAMS_WRAPPER_H_
17 #define ARK_WEB_CONTEXT_MENU_PARAMS_WRAPPER_H_
18 #pragma once
19 
20 #include "include/nweb_context_menu_params.h"
21 #include "ohos_nweb/include/ark_web_context_menu_params.h"
22 
23 namespace OHOS::ArkWeb {
24 
25 using ArkWebMediaType = OHOS::NWeb::NWebContextMenuParams::ContextMenuMediaType;
26 using ArkWebSourceType = OHOS::NWeb::NWebContextMenuParams::ContextMenuSourceType;
27 using ArkWebInputFieldType = OHOS::NWeb::NWebContextMenuParams::ContextMenuInputFieldType;
28 
29 class ArkWebContextMenuParamsWrapper : public OHOS::NWeb::NWebContextMenuParams {
30 public:
31     ArkWebContextMenuParamsWrapper(ArkWebRefPtr<ArkWebContextMenuParams> ark_web_context_menu_params);
32     ~ArkWebContextMenuParamsWrapper() = default;
33 
34     int32_t GetXCoord() override;
35 
36     int32_t GetYCoord() override;
37 
38     bool IsEditable() override;
39 
40     std::string GetLinkUrl() override;
41 
42     std::string GetPageUrl() override;
43 
44     std::string GetSourceUrl() override;
45 
46     std::string GetTitleText() override;
47 
48     std::string GetSelectionText() override;
49 
50     ArkWebMediaType GetMediaType() override;
51 
52     ArkWebSourceType GetSourceType() override;
53 
54     ArkWebInputFieldType GetInputFieldType() override;
55 
56     bool HasImageContents() override;
57 
58     int32_t GetEditStateFlags() override;
59 
60     std::string GetUnfilteredLinkUrl() override;
61 
62     int32_t GetContextMenuTypeFlags() override;
63 
64     void GetImageRect(int& x, int& y, int& w, int& h) override;
65 
66 private:
67     ArkWebRefPtr<ArkWebContextMenuParams> ark_web_context_menu_params_;
68 };
69 
70 } // namespace OHOS::ArkWeb
71 
72 #endif // ARK_WEB_CONTEXT_MENU_PARAMS_WRAPPER_H_
73