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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 void Resume() override; | 124 void Resume() override; |
125 void CancelDeferredNavigation( | 125 void CancelDeferredNavigation( |
126 NavigationThrottle::ThrottleCheckResult result) override; | 126 NavigationThrottle::ThrottleCheckResult result) override; |
127 void RegisterThrottleForTesting( | 127 void RegisterThrottleForTesting( |
128 std::unique_ptr<NavigationThrottle> navigation_throttle) override; | 128 std::unique_ptr<NavigationThrottle> navigation_throttle) override; |
129 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( | 129 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( |
130 bool is_post, | 130 bool is_post, |
131 const Referrer& sanitized_referrer, | 131 const Referrer& sanitized_referrer, |
132 bool has_user_gesture, | 132 bool has_user_gesture, |
133 ui::PageTransition transition, | 133 ui::PageTransition transition, |
134 bool is_external_protocol) override; | 134 bool is_external_protocol, |
135 const ThrottleChecksFinishedCallback& complete_callback) override; | |
135 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( | 136 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( |
136 const GURL& new_url, | 137 const GURL& new_url, |
137 bool new_method_is_post, | 138 bool new_method_is_post, |
138 const GURL& new_referrer_url, | 139 const GURL& new_referrer_url, |
139 bool new_is_external_protocol) override; | 140 bool new_is_external_protocol, |
141 const ThrottleChecksFinishedCallback& complete_callback) override; | |
140 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( | 142 NavigationThrottle::ThrottleCheckResult CallWillProcessResponseForTesting( |
141 RenderFrameHost* render_frame_host, | 143 RenderFrameHost* render_frame_host, |
142 const std::string& raw_response_header) override; | 144 const std::string& raw_response_header, |
145 const ThrottleChecksFinishedCallback& complete_callback) override; | |
143 void CallDidCommitNavigationForTesting(const GURL& url) override; | 146 void CallDidCommitNavigationForTesting(const GURL& url) override; |
144 bool WasStartedFromContextMenu() const override; | 147 bool WasStartedFromContextMenu() const override; |
145 const GURL& GetSearchableFormURL() override; | 148 const GURL& GetSearchableFormURL() override; |
146 const std::string& GetSearchableFormEncoding() override; | 149 const std::string& GetSearchableFormEncoding() override; |
147 ReloadType GetReloadType() override; | 150 ReloadType GetReloadType() override; |
148 const GlobalRequestID& GetGlobalRequestID() override; | 151 const GlobalRequestID& GetGlobalRequestID() override; |
149 | |
150 NavigationData* GetNavigationData() override; | 152 NavigationData* GetNavigationData() override; |
151 | 153 |
152 // The NavigatorDelegate to notify/query for various navigation events. | 154 // The NavigatorDelegate to notify/query for various navigation events. |
153 // Normally this is the WebContents, except if this NavigationHandle was | 155 // Normally this is the WebContents, except if this NavigationHandle was |
154 // created during a navigation to an interstitial page. In this case it will | 156 // created during a navigation to an interstitial page. In this case it will |
155 // be the InterstitialPage itself. | 157 // be the InterstitialPage itself. |
156 // | 158 // |
157 // Note: due to the interstitial navigation case, all calls that can possibly | 159 // Note: due to the interstitial navigation case, all calls that can possibly |
158 // expose the NavigationHandle to code outside of content/ MUST go though the | 160 // expose the NavigationHandle to code outside of content/ MUST go though the |
159 // NavigatorDelegate. In particular, the ContentBrowserClient should not be | 161 // NavigatorDelegate. In particular, the ContentBrowserClient should not be |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 ServiceWorkerNavigationHandle* service_worker_handle() const { | 218 ServiceWorkerNavigationHandle* service_worker_handle() const { |
217 return service_worker_handle_.get(); | 219 return service_worker_handle_.get(); |
218 } | 220 } |
219 | 221 |
220 // PlzNavigate | 222 // PlzNavigate |
221 void InitAppCacheHandle(ChromeAppCacheService* appcache_service); | 223 void InitAppCacheHandle(ChromeAppCacheService* appcache_service); |
222 AppCacheNavigationHandle* appcache_handle() const { | 224 AppCacheNavigationHandle* appcache_handle() const { |
223 return appcache_handle_.get(); | 225 return appcache_handle_.get(); |
224 } | 226 } |
225 | 227 |
226 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | |
227 ThrottleChecksFinishedCallback; | |
228 | |
229 // Called when the URLRequest will start in the network stack. |callback| | 228 // Called when the URLRequest will start in the network stack. |callback| |
230 // will be called when all throttle checks have completed. This will allow | 229 // will be called when all throttle checks have completed. This will allow |
231 // the caller to cancel the navigation or let it proceed. | 230 // the caller to cancel the navigation or let it proceed. |
232 void WillStartRequest( | 231 // Returns the synchronous throttle check result, or DEFER if it is being |
232 // calculated asynchronously. | |
233 NavigationThrottle::ThrottleCheckResult WillStartRequest( | |
clamy
2017/02/15 16:37:22
I'm don't really like having the result be returne
Charlie Harrison
2017/02/15 16:42:12
What would you prefer? One idea is to have the cal
clamy
2017/02/16 14:10:43
I really don't want to be modifying the semantic o
| |
233 const std::string& method, | 234 const std::string& method, |
234 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 235 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
235 const Referrer& sanitized_referrer, | 236 const Referrer& sanitized_referrer, |
236 bool has_user_gesture, | 237 bool has_user_gesture, |
237 ui::PageTransition transition, | 238 ui::PageTransition transition, |
238 bool is_external_protocol, | 239 bool is_external_protocol, |
239 RequestContextType request_context_type, | 240 RequestContextType request_context_type, |
240 blink::WebMixedContentContextType mixed_content_context_type, | 241 blink::WebMixedContentContextType mixed_content_context_type, |
241 const ThrottleChecksFinishedCallback& callback); | 242 const ThrottleChecksFinishedCallback& callback); |
242 | 243 |
243 // Called when the URLRequest will be redirected in the network stack. | 244 // Called when the URLRequest will be redirected in the network stack. |
244 // |callback| will be called when all throttles check have completed. This | 245 // |callback| will be called when all throttles check have completed. This |
245 // will allow the caller to cancel the navigation or let it proceed. | 246 // will allow the caller to cancel the navigation or let it proceed. |
246 // This will also inform the delegate that the request was redirected. | 247 // This will also inform the delegate that the request was redirected. |
247 void WillRedirectRequest( | 248 // Returns the synchronous throttle check result, or DEFER if it is being |
249 // calculated asynchronously. | |
250 NavigationThrottle::ThrottleCheckResult WillRedirectRequest( | |
248 const GURL& new_url, | 251 const GURL& new_url, |
249 const std::string& new_method, | 252 const std::string& new_method, |
250 const GURL& new_referrer_url, | 253 const GURL& new_referrer_url, |
251 bool new_is_external_protocol, | 254 bool new_is_external_protocol, |
252 scoped_refptr<net::HttpResponseHeaders> response_headers, | 255 scoped_refptr<net::HttpResponseHeaders> response_headers, |
253 net::HttpResponseInfo::ConnectionInfo connection_info, | 256 net::HttpResponseInfo::ConnectionInfo connection_info, |
254 const ThrottleChecksFinishedCallback& callback); | 257 const ThrottleChecksFinishedCallback& callback); |
255 | 258 |
256 // Called when the URLRequest has delivered response headers and metadata. | 259 // Called when the URLRequest has delivered response headers and metadata. |
257 // |callback| will be called when all throttle checks have completed, | 260 // |callback| will be called when all throttle checks have completed, |
258 // allowing the caller to cancel the navigation or let it proceed. | 261 // allowing the caller to cancel the navigation or let it proceed. |
259 // NavigationHandle will not call |callback| with a result of DEFER. | 262 // NavigationHandle will not call |callback| with a result of DEFER. |
260 // If the result is PROCEED, then 'ReadyToCommitNavigation' will be called | 263 // If the result is PROCEED, then 'ReadyToCommitNavigation' will be called |
261 // with |render_frame_host| and |response_headers| just before calling | 264 // with |render_frame_host| and |response_headers| just before calling |
262 // |callback|. Should a transfer navigation happen, |transfer_callback| will | 265 // |callback|. Should a transfer navigation happen, |transfer_callback| will |
263 // be run on the IO thread. | 266 // be run on the IO thread. |
267 // Returns the synchronous throttle check result, or DEFER if it is being | |
268 // calculated asynchronously. | |
264 // PlzNavigate: transfer navigations are not possible. | 269 // PlzNavigate: transfer navigations are not possible. |
265 void WillProcessResponse( | 270 NavigationThrottle::ThrottleCheckResult WillProcessResponse( |
266 RenderFrameHostImpl* render_frame_host, | 271 RenderFrameHostImpl* render_frame_host, |
267 scoped_refptr<net::HttpResponseHeaders> response_headers, | 272 scoped_refptr<net::HttpResponseHeaders> response_headers, |
268 net::HttpResponseInfo::ConnectionInfo connection_info, | 273 net::HttpResponseInfo::ConnectionInfo connection_info, |
269 const SSLStatus& ssl_status, | 274 const SSLStatus& ssl_status, |
270 const GlobalRequestID& request_id, | 275 const GlobalRequestID& request_id, |
271 bool should_replace_current_entry, | 276 bool should_replace_current_entry, |
272 bool is_download, | 277 bool is_download, |
273 bool is_stream, | 278 bool is_stream, |
274 const base::Closure& transfer_callback, | 279 const base::Closure& transfer_callback, |
275 const ThrottleChecksFinishedCallback& callback); | 280 const ThrottleChecksFinishedCallback& callback); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 NavigationType navigation_type_; | 496 NavigationType navigation_type_; |
492 | 497 |
493 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 498 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
494 | 499 |
495 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 500 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
496 }; | 501 }; |
497 | 502 |
498 } // namespace content | 503 } // namespace content |
499 | 504 |
500 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 505 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |