OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
7 | 7 |
8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 | 10 |
11 class GURL; | 11 class GURL; |
12 | 12 |
13 namespace content { | 13 namespace content { |
| 14 class RenderFrameHost; |
14 | 15 |
15 // A NavigationHandle tracks information related to a single navigation. | 16 // A NavigationHandle tracks information related to a single navigation. |
16 class CONTENT_EXPORT NavigationHandle { | 17 class CONTENT_EXPORT NavigationHandle { |
17 public: | 18 public: |
18 virtual ~NavigationHandle() {} | 19 virtual ~NavigationHandle() {} |
19 | 20 |
20 // The URL the frame is navigating to. This may change during the navigation | 21 // The URL the frame is navigating to. This may change during the navigation |
21 // when encountering a server redirect. | 22 // when encountering a server redirect. |
22 virtual const GURL& GetURL() const = 0; | 23 virtual const GURL& GetURL() const = 0; |
23 | 24 |
24 // The net error code if an error happened prior to commit. Otherwise it will | 25 // The net error code if an error happened prior to commit. Otherwise it will |
25 // be net::OK. | 26 // be net::OK. |
26 virtual net::Error GetNetErrorCode() const = 0; | 27 virtual net::Error GetNetErrorCode() const = 0; |
27 | 28 |
28 // Whether the navigation is taking place in the main frame or in a subframe. | 29 // Whether the navigation is taking place in the main frame or in a subframe. |
29 virtual bool IsInMainFrame() const = 0; | 30 virtual bool IsInMainFrame() const = 0; |
30 | 31 |
| 32 // Returns the RenderFrameHost this navigation is taking place in. This can |
| 33 // only be accessed after the navigation is ready to commit. |
| 34 virtual RenderFrameHost* GetRenderFrameHost() = 0; |
| 35 |
31 // Whether the navigation happened in the same page. This is only known | 36 // Whether the navigation happened in the same page. This is only known |
32 // after the navigation has committed. It is an error to call this method | 37 // after the navigation has committed. It is an error to call this method |
33 // before the navigation has committed. | 38 // before the navigation has committed. |
34 virtual bool IsSamePage() = 0; | 39 virtual bool IsSamePage() = 0; |
35 | 40 |
36 // Whether the navigation has successfully committed a document. | 41 // Whether the navigation has committed. This returns true for either |
37 virtual bool HasCommittedDocument() const = 0; | 42 // successful commits or error pages that replace the previous page |
| 43 // (distinguished by |IsErrorPage|), and false for errors that leave the user |
| 44 // on the previous page. |
| 45 virtual bool HasCommitted() = 0; |
38 | 46 |
39 // Whether an error page has committed for the navigation. | 47 // Whether the navigation resulted in an error page. |
40 virtual bool HasCommittedErrorPage() const = 0; | 48 virtual bool IsErrorPage() = 0; |
41 }; | 49 }; |
42 | 50 |
43 } // namespace content | 51 } // namespace content |
44 | 52 |
45 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ | 53 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_HANDLE_H_ |
OLD | NEW |