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_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
7 | 7 |
8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, | 55 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, |
56 const bool is_main_frame, | 56 const bool is_main_frame, |
57 NavigatorDelegate* delegate); | 57 NavigatorDelegate* delegate); |
58 | 58 |
59 ~NavigationHandleImpl() override; | 59 ~NavigationHandleImpl() override; |
60 | 60 |
61 // NavigationHandle implementation: | 61 // NavigationHandle implementation: |
62 const GURL& GetURL() const override; | 62 const GURL& GetURL() const override; |
63 net::Error GetNetErrorCode() const override; | 63 net::Error GetNetErrorCode() const override; |
64 bool IsInMainFrame() const override; | 64 bool IsInMainFrame() const override; |
| 65 bool IsSamePage() override; |
65 bool HasCommittedDocument() const override; | 66 bool HasCommittedDocument() const override; |
66 bool HasCommittedErrorPage() const override; | 67 bool HasCommittedErrorPage() const override; |
67 | 68 |
68 void set_net_error_code(net::Error net_error_code) { | 69 void set_net_error_code(net::Error net_error_code) { |
69 net_error_code_ = net_error_code; | 70 net_error_code_ = net_error_code; |
70 } | 71 } |
71 | 72 |
72 // Returns whether the navigation is currently being transferred from one | 73 // Returns whether the navigation is currently being transferred from one |
73 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC | 74 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC |
74 // for the navigation URL, received in the new RenderFrameHost, should not | 75 // for the navigation URL, received in the new RenderFrameHost, should not |
75 // indicate the start of a new navigation in that case. | 76 // indicate the start of a new navigation in that case. |
76 bool is_transferring() const { return is_transferring_; } | 77 bool is_transferring() const { return is_transferring_; } |
77 void set_is_transferring(bool is_transferring) { | 78 void set_is_transferring(bool is_transferring) { |
78 is_transferring_ = is_transferring; | 79 is_transferring_ = is_transferring; |
79 } | 80 } |
80 | 81 |
81 // Called when the navigation was redirected. This will update the |url_| and | 82 // Called when the navigation was redirected. This will update the |url_| and |
82 // inform the delegate. | 83 // inform the delegate. |
83 void DidRedirectNavigation(const GURL& new_url); | 84 void DidRedirectNavigation(const GURL& new_url); |
84 | 85 |
85 // Called when the navigation was committed. This will update the |state_| | 86 // Called when the navigation was committed. This will update the |state_| |
86 // and inform the delegate, | 87 // and inform the delegate, |
87 void DidCommitNavigation(); | 88 void DidCommitNavigation(bool same_page); |
88 | 89 |
89 private: | 90 private: |
90 // Used to track the state the navigation is currently in. | 91 // Used to track the state the navigation is currently in. |
91 enum State { | 92 enum State { |
92 DID_START = 0, | 93 DID_START = 0, |
93 DID_COMMIT, | 94 DID_COMMIT, |
94 DID_COMMIT_ERROR_PAGE, | 95 DID_COMMIT_ERROR_PAGE, |
95 }; | 96 }; |
96 | 97 |
97 NavigationHandleImpl(const GURL& url, | 98 NavigationHandleImpl(const GURL& url, |
98 const bool is_main_frame, | 99 const bool is_main_frame, |
99 NavigatorDelegate* delegate); | 100 NavigatorDelegate* delegate); |
100 | 101 |
101 // See NavigationHandle for a description of those member variables. | 102 // See NavigationHandle for a description of those member variables. |
102 GURL url_; | 103 GURL url_; |
103 net::Error net_error_code_; | 104 net::Error net_error_code_; |
104 State state_; | 105 State state_; |
105 const bool is_main_frame_; | 106 const bool is_main_frame_; |
| 107 bool is_same_page_; |
106 | 108 |
107 // Whether the navigation is in the middle of a transfer. Set to false when | 109 // Whether the navigation is in the middle of a transfer. Set to false when |
108 // the DidStartProvisionalLoad is received from the new renderer. | 110 // the DidStartProvisionalLoad is received from the new renderer. |
109 bool is_transferring_; | 111 bool is_transferring_; |
110 | 112 |
111 // The delegate that should be notified about events related to this | 113 // The delegate that should be notified about events related to this |
112 // navigation. | 114 // navigation. |
113 NavigatorDelegate* delegate_; | 115 NavigatorDelegate* delegate_; |
114 | 116 |
115 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 117 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
116 }; | 118 }; |
117 | 119 |
118 } // namespace content | 120 } // namespace content |
119 | 121 |
120 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 122 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |