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 #include "content/browser/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 10 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scoped_refptr<net::HttpResponseHeaders>(), | 298 scoped_refptr<net::HttpResponseHeaders>(), |
299 base::Bind(&UpdateThrottleCheckResult, &result)); | 299 base::Bind(&UpdateThrottleCheckResult, &result)); |
300 | 300 |
301 // Reset the callback to ensure it will not be called later. | 301 // Reset the callback to ensure it will not be called later. |
302 complete_callback_.Reset(); | 302 complete_callback_.Reset(); |
303 return result; | 303 return result; |
304 } | 304 } |
305 | 305 |
306 NavigationThrottle::ThrottleCheckResult | 306 NavigationThrottle::ThrottleCheckResult |
307 NavigationHandleImpl::CallWillProcessResponseForTesting( | 307 NavigationHandleImpl::CallWillProcessResponseForTesting( |
308 content::RenderFrameHost* render_frame_host) { | 308 content::RenderFrameHost* render_frame_host, |
| 309 scoped_refptr<net::HttpResponseHeaders> response_headers) { |
309 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 310 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
310 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), | 311 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), |
311 scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(), | 312 response_headers, SSLStatus(), |
312 base::Bind(&UpdateThrottleCheckResult, &result)); | 313 base::Bind(&UpdateThrottleCheckResult, &result)); |
313 | 314 |
314 // Reset the callback to ensure it will not be called later. | 315 // Reset the callback to ensure it will not be called later. |
315 complete_callback_.Reset(); | 316 complete_callback_.Reset(); |
316 return result; | 317 return result; |
317 } | 318 } |
318 | 319 |
| 320 void NavigationHandleImpl::CallDidCommitNavigationForTesting( |
| 321 const GURL& url, |
| 322 ui::PageTransition transition, |
| 323 bool same_page, |
| 324 RenderFrameHost* render_frame_host) { |
| 325 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 326 |
| 327 params.page_id = 1; |
| 328 params.nav_entry_id = 1; |
| 329 params.url = url; |
| 330 params.referrer = content::Referrer(); |
| 331 params.transition = transition; |
| 332 params.redirects = std::vector<GURL>(); |
| 333 params.should_update_history = false; |
| 334 params.searchable_form_url = GURL(); |
| 335 params.searchable_form_encoding = std::string(); |
| 336 params.did_create_new_entry = false; |
| 337 params.gesture = NavigationGestureUser; |
| 338 params.was_within_same_page = false; |
| 339 params.method = "GET"; |
| 340 params.page_state = PageState::CreateFromURL(url); |
| 341 params.contents_mime_type = std::string("text/html"); |
| 342 |
| 343 DidCommitNavigation(params, same_page, |
| 344 static_cast<RenderFrameHostImpl*>(render_frame_host)); |
| 345 } |
| 346 |
319 NavigationData* NavigationHandleImpl::GetNavigationData() { | 347 NavigationData* NavigationHandleImpl::GetNavigationData() { |
320 return navigation_data_.get(); | 348 return navigation_data_.get(); |
321 } | 349 } |
322 | 350 |
323 void NavigationHandleImpl::WillStartRequest( | 351 void NavigationHandleImpl::WillStartRequest( |
324 const std::string& method, | 352 const std::string& method, |
325 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 353 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
326 const Referrer& sanitized_referrer, | 354 const Referrer& sanitized_referrer, |
327 bool has_user_gesture, | 355 bool has_user_gesture, |
328 ui::PageTransition transition, | 356 ui::PageTransition transition, |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 600 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
573 | 601 |
574 if (throttles_to_register.size() > 0) { | 602 if (throttles_to_register.size() > 0) { |
575 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 603 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
576 throttles_to_register.end()); | 604 throttles_to_register.end()); |
577 throttles_to_register.weak_clear(); | 605 throttles_to_register.weak_clear(); |
578 } | 606 } |
579 } | 607 } |
580 | 608 |
581 } // namespace content | 609 } // namespace content |
OLD | NEW |