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/callback.h" | 10 #include "base/callback.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 | 71 |
72 // NavigationHandle implementation: | 72 // NavigationHandle implementation: |
73 const GURL& GetURL() override; | 73 const GURL& GetURL() override; |
74 bool IsInMainFrame() override; | 74 bool IsInMainFrame() override; |
75 const base::TimeTicks& NavigationStart() override; | 75 const base::TimeTicks& NavigationStart() override; |
76 bool IsPost() override; | 76 bool IsPost() override; |
77 const Referrer& GetReferrer() override; | 77 const Referrer& GetReferrer() override; |
78 bool HasUserGesture() override; | 78 bool HasUserGesture() override; |
79 ui::PageTransition GetPageTransition() override; | 79 ui::PageTransition GetPageTransition() override; |
80 bool IsExternalProtocol() override; | 80 bool IsExternalProtocol() override; |
81 const net::HttpResponseHeaders* GetResponseHeaders() override; | |
81 net::Error GetNetErrorCode() override; | 82 net::Error GetNetErrorCode() override; |
82 RenderFrameHostImpl* GetRenderFrameHost() override; | 83 RenderFrameHostImpl* GetRenderFrameHost() override; |
83 bool IsSamePage() override; | 84 bool IsSamePage() override; |
84 bool HasCommitted() override; | 85 bool HasCommitted() override; |
85 bool IsErrorPage() override; | 86 bool IsErrorPage() override; |
86 void Resume() override; | 87 void Resume() override; |
87 void CancelDeferredNavigation( | 88 void CancelDeferredNavigation( |
88 NavigationThrottle::ThrottleCheckResult result) override; | 89 NavigationThrottle::ThrottleCheckResult result) override; |
89 void RegisterThrottleForTesting( | 90 void RegisterThrottleForTesting( |
90 scoped_ptr<NavigationThrottle> navigation_throttle) override; | 91 scoped_ptr<NavigationThrottle> navigation_throttle) override; |
91 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 92 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
92 bool is_post, | 93 bool is_post, |
93 const Referrer& sanitized_referrer, | 94 const Referrer& sanitized_referrer, |
94 bool has_user_gesture, | 95 bool has_user_gesture, |
95 ui::PageTransition transition, | 96 ui::PageTransition transition, |
96 bool is_external_protocol) override; | 97 bool is_external_protocol) override; |
97 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( | 98 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( |
98 const GURL& new_url, | 99 const GURL& new_url, |
99 bool new_method_is_post, | 100 bool new_method_is_post, |
100 const GURL& new_referrer_url, | 101 const GURL& new_referrer_url, |
101 bool new_is_external_protocol) override; | 102 bool new_is_external_protocol) override; |
102 | 103 |
103 NavigatorDelegate* GetDelegate() const; | 104 NavigatorDelegate* GetDelegate() const; |
104 | 105 |
105 // Returns the response headers for the request. This can only be accessed | |
106 // after a redirect was encountered or after the the navigation is ready to | |
107 // commit. It should not be modified, as modifications will not be reflected | |
108 // in the network stack. | |
109 const net::HttpResponseHeaders* GetResponseHeaders(); | |
Mike West
2015/12/17 13:09:15
This moved up to 'NavigationHandle'.
| |
110 | |
111 void set_net_error_code(net::Error net_error_code) { | 106 void set_net_error_code(net::Error net_error_code) { |
112 net_error_code_ = net_error_code; | 107 net_error_code_ = net_error_code; |
113 } | 108 } |
114 | 109 |
115 // Returns whether the navigation is currently being transferred from one | 110 // Returns whether the navigation is currently being transferred from one |
116 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC | 111 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC |
117 // for the navigation URL, received in the new RenderFrameHost, should not | 112 // for the navigation URL, received in the new RenderFrameHost, should not |
118 // indicate the start of a new navigation in that case. | 113 // indicate the start of a new navigation in that case. |
119 bool is_transferring() const { return is_transferring_; } | 114 bool is_transferring() const { return is_transferring_; } |
120 void set_is_transferring(bool is_transferring) { | 115 void set_is_transferring(bool is_transferring) { |
(...skipping 30 matching lines...) Expand all Loading... | |
151 // |callback| will be called when all throttles check have completed. This | 146 // |callback| will be called when all throttles check have completed. This |
152 // will allow the caller to cancel the navigation or let it proceed. | 147 // will allow the caller to cancel the navigation or let it proceed. |
153 void WillRedirectRequest( | 148 void WillRedirectRequest( |
154 const GURL& new_url, | 149 const GURL& new_url, |
155 bool new_method_is_post, | 150 bool new_method_is_post, |
156 const GURL& new_referrer_url, | 151 const GURL& new_referrer_url, |
157 bool new_is_external_protocol, | 152 bool new_is_external_protocol, |
158 scoped_refptr<net::HttpResponseHeaders> response_headers, | 153 scoped_refptr<net::HttpResponseHeaders> response_headers, |
159 const ThrottleChecksFinishedCallback& callback); | 154 const ThrottleChecksFinishedCallback& callback); |
160 | 155 |
156 // Called when the URLRequest has response data, and is ready to be | |
157 // committed. |callback| will be called if the throttle checks indicate | |
158 // that the request should be cancelled. Otherwise, 'ReadyToCommitNavigation' | |
159 // will be called. | |
160 void WillProcessResponse( | |
161 RenderFrameHostImpl* render_frame_host, | |
162 scoped_refptr<net::HttpResponseHeaders> response_headers, | |
163 const ThrottleChecksFinishedCallback& callback); | |
164 | |
161 // Returns the FrameTreeNode this navigation is happening in. | 165 // Returns the FrameTreeNode this navigation is happening in. |
162 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 166 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
163 | 167 |
164 // Called when the navigation was redirected. This will update the |url_| and | 168 // Called when the navigation was redirected. This will update the |url_| and |
165 // inform the delegate. | 169 // inform the delegate. |
166 void DidRedirectNavigation(const GURL& new_url); | 170 void DidRedirectNavigation(const GURL& new_url); |
167 | 171 |
168 // Called when the navigation is ready to be committed in | 172 // Called when the navigation is ready to be committed in |
169 // |render_frame_host|. This will update the |state_| and inform the | 173 // |render_frame_host|. This will update the |state_| and inform the |
170 // delegate. | 174 // delegate. |
(...skipping 21 matching lines...) Expand all Loading... | |
192 DID_COMMIT, | 196 DID_COMMIT, |
193 DID_COMMIT_ERROR_PAGE, | 197 DID_COMMIT_ERROR_PAGE, |
194 }; | 198 }; |
195 | 199 |
196 NavigationHandleImpl(const GURL& url, | 200 NavigationHandleImpl(const GURL& url, |
197 FrameTreeNode* frame_tree_node, | 201 FrameTreeNode* frame_tree_node, |
198 const base::TimeTicks& navigation_start); | 202 const base::TimeTicks& navigation_start); |
199 | 203 |
200 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 204 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
201 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 205 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
206 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | |
202 | 207 |
203 // Helper function to run and reset the |complete_callback_|. This marks the | 208 // Helper function to run and reset the |complete_callback_|. This marks the |
204 // end of a round of NavigationThrottleChecks. | 209 // end of a round of NavigationThrottleChecks. |
205 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 210 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
206 | 211 |
207 // Used in tests. | 212 // Used in tests. |
208 State state() const { return state_; } | 213 State state() const { return state_; } |
209 | 214 |
210 // See NavigationHandle for a description of those member variables. | 215 // See NavigationHandle for a description of those member variables. |
211 GURL url_; | 216 GURL url_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 250 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
246 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 251 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
247 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 252 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
248 | 253 |
249 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 254 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
250 }; | 255 }; |
251 | 256 |
252 } // namespace content | 257 } // namespace content |
253 | 258 |
254 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 259 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |