| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // |callback| will be called when all throttles check have completed. This | 153 // |callback| will be called when all throttles check have completed. This |
| 154 // will allow the caller to cancel the navigation or let it proceed. | 154 // will allow the caller to cancel the navigation or let it proceed. |
| 155 void WillRedirectRequest( | 155 void WillRedirectRequest( |
| 156 const GURL& new_url, | 156 const GURL& new_url, |
| 157 bool new_method_is_post, | 157 bool new_method_is_post, |
| 158 const GURL& new_referrer_url, | 158 const GURL& new_referrer_url, |
| 159 bool new_is_external_protocol, | 159 bool new_is_external_protocol, |
| 160 scoped_refptr<net::HttpResponseHeaders> response_headers, | 160 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 161 const ThrottleChecksFinishedCallback& callback); | 161 const ThrottleChecksFinishedCallback& callback); |
| 162 | 162 |
| 163 // Called when the URLRequest has delivered response headers and metadata. |
| 164 // |callback| will be called when all throttle checks have completed, |
| 165 // allowing the caller to cancel the navigation or let it proceed. |
| 166 // NavigationHandle will not call |callback| with a result of DEFER. |
| 167 // If the result is PROCEED, then 'ReadyToCommitNavigation' will be called |
| 168 // with |render_frame_host| and |response_headers| just before calling |
| 169 // |callback|. |
| 170 void WillProcessResponse( |
| 171 RenderFrameHostImpl* render_frame_host, |
| 172 scoped_refptr<net::HttpResponseHeaders> response_headers, |
| 173 const ThrottleChecksFinishedCallback& callback); |
| 174 |
| 163 // Returns the FrameTreeNode this navigation is happening in. | 175 // Returns the FrameTreeNode this navigation is happening in. |
| 164 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 176 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
| 165 | 177 |
| 166 // Called when the navigation was redirected. This will update the |url_| and | 178 // Called when the navigation was redirected. This will update the |url_| and |
| 167 // inform the delegate. | 179 // inform the delegate. |
| 168 void DidRedirectNavigation(const GURL& new_url); | 180 void DidRedirectNavigation(const GURL& new_url); |
| 169 | 181 |
| 170 // Called when the navigation is ready to be committed in | 182 // Called when the navigation is ready to be committed in |
| 171 // |render_frame_host|. This will update the |state_| and inform the | 183 // |render_frame_host|. This will update the |state_| and inform the |
| 172 // delegate. | 184 // delegate. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 183 friend class NavigationHandleImplTest; | 195 friend class NavigationHandleImplTest; |
| 184 | 196 |
| 185 // Used to track the state the navigation is currently in. | 197 // Used to track the state the navigation is currently in. |
| 186 enum State { | 198 enum State { |
| 187 INITIAL = 0, | 199 INITIAL = 0, |
| 188 WILL_SEND_REQUEST, | 200 WILL_SEND_REQUEST, |
| 189 DEFERRING_START, | 201 DEFERRING_START, |
| 190 WILL_REDIRECT_REQUEST, | 202 WILL_REDIRECT_REQUEST, |
| 191 DEFERRING_REDIRECT, | 203 DEFERRING_REDIRECT, |
| 192 CANCELING, | 204 CANCELING, |
| 205 WILL_PROCESS_RESPONSE, |
| 206 DEFERRING_RESPONSE, |
| 193 READY_TO_COMMIT, | 207 READY_TO_COMMIT, |
| 194 DID_COMMIT, | 208 DID_COMMIT, |
| 195 DID_COMMIT_ERROR_PAGE, | 209 DID_COMMIT_ERROR_PAGE, |
| 196 }; | 210 }; |
| 197 | 211 |
| 198 NavigationHandleImpl(const GURL& url, | 212 NavigationHandleImpl(const GURL& url, |
| 199 FrameTreeNode* frame_tree_node, | 213 FrameTreeNode* frame_tree_node, |
| 200 const base::TimeTicks& navigation_start); | 214 const base::TimeTicks& navigation_start); |
| 201 | 215 |
| 202 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 216 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 203 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 217 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 218 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 204 | 219 |
| 205 // Helper function to run and reset the |complete_callback_|. This marks the | 220 // Helper function to run and reset the |complete_callback_|. This marks the |
| 206 // end of a round of NavigationThrottleChecks. | 221 // end of a round of NavigationThrottleChecks. |
| 207 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 222 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
| 208 | 223 |
| 209 // Used in tests. | 224 // Used in tests. |
| 210 State state() const { return state_; } | 225 State state() const { return state_; } |
| 211 | 226 |
| 212 // See NavigationHandle for a description of those member variables. | 227 // See NavigationHandle for a description of those member variables. |
| 213 GURL url_; | 228 GURL url_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 262 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 248 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 263 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 249 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 264 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 250 | 265 |
| 251 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 266 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 252 }; | 267 }; |
| 253 | 268 |
| 254 } // namespace content | 269 } // namespace content |
| 255 | 270 |
| 256 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 271 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |