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_LOAD_COMMITTED_DETAILS_WRAPPER_H_
17 #define ARK_WEB_LOAD_COMMITTED_DETAILS_WRAPPER_H_
18 #pragma once
19 
20 #include "include/nweb_load_committed_details.h"
21 #include "ohos_nweb/include/ark_web_load_committed_details.h"
22 
23 namespace OHOS::ArkWeb {
24 
25 using ArkWebNavigationType = OHOS::NWeb::NWebLoadCommittedDetails::NavigationType;
26 
27 class ArkWebLoadCommittedDetailsWrapper : public OHOS::NWeb::NWebLoadCommittedDetails {
28 public:
29     ArkWebLoadCommittedDetailsWrapper(ArkWebRefPtr<ArkWebLoadCommittedDetails> ark_web_load_committed_details);
30     ~ArkWebLoadCommittedDetailsWrapper() = default;
31 
32     /**
33      * @brief Check whether the request is for getting the main frame.
34      *
35      * @return Is main frame.
36      */
37     bool IsMainFrame() override;
38 
39     /**
40      * @brief Check whether document and other documents have the same
41      * properties.
42      *
43      * @return Is the same document.
44      */
45     bool IsSameDocument() override;
46 
47     /**
48      * @brief Check whether the entry is replaced.
49      *
50      * @return The entry is replaced.
51      */
52     bool DidReplaceEntry() override;
53 
54     /**
55      * @brief Get the value of the navigation type.
56      *
57      * @return The value of the navigation type.
58      */
59     ArkWebNavigationType GetNavigationType() override;
60 
61     /**
62      * @brief Gets the url of the current navigation.
63      *
64      * @return The url of the current navigation.
65      */
66     std::string GetURL() override;
67 
68 private:
69     ArkWebRefPtr<ArkWebLoadCommittedDetails> ark_web_load_committed_details_;
70 };
71 
72 } // namespace OHOS::ArkWeb
73 
74 #endif // ARK_WEB_LOAD_COMMITTED_DETAILS_WRAPPER_H_
75