1 /*
2  * Copyright (c) 2023 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 NWEB_LOAD_COMMITTED_DETAILS_H
17 #define NWEB_LOAD_COMMITTED_DETAILS_H
18 
19 #include <map>
20 #include <string>
21 
22 #include "nweb_export.h"
23 
24 namespace OHOS::NWeb {
25 
26 class OHOS_NWEB_EXPORT NWebLoadCommittedDetails {
27 public:
28     enum NavigationType {
29         NAVIGATION_TYPE_UNKNOWN = 0,
30         NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY = 1,
31         NAVIGATION_TYPE_MAIN_FRAME_EXISTING_PAGE = 2,
32         NAVIGATION_TYPE_NEW_SUBFRAME = 4,
33         NAVIGATION_TYPE_AUTO_SUBFRAME = 5,
34     };
35 
36     NWebLoadCommittedDetails() = default;
37 
38     virtual ~NWebLoadCommittedDetails() = default;
39 
40     /**
41      * @brief Check whether the request is for getting the main frame.
42      *
43      * @retval Is main frame.
44      */
45     virtual bool IsMainFrame() = 0;
46 
47     /**
48      * @brief Check whether document and other documents have the same
49      * properties.
50      *
51      * @retval Is the same document.
52      */
53     virtual bool IsSameDocument() = 0;
54 
55     /**
56      * @brief Check whether the entry is replaced.
57      *
58      * @retval The entry is replaced.
59      */
60     virtual bool DidReplaceEntry() = 0;
61 
62     /**
63      * @brief Get the value of the navigation type.
64      *
65      * @retval The value of the navigation type.
66      */
67     virtual NavigationType GetNavigationType() = 0;
68 
69     /**
70      * @brief Gets the url of the current navigation.
71      *
72      * @retval The url of the current navigation.
73      */
74     virtual std::string GetURL() = 0;
75 };
76 
77 } // namespace OHOS::NWeb
78 
79 #endif // NWEB_LOAD_COMMITTED_DETAILS_H
80