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 const std::string& raw_response_headers) { |
| 310 scoped_refptr<net::HttpResponseHeaders> headers = |
| 311 new net::HttpResponseHeaders(raw_response_headers); |
309 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; | 312 NavigationThrottle::ThrottleCheckResult result = NavigationThrottle::DEFER; |
310 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), | 313 WillProcessResponse(static_cast<RenderFrameHostImpl*>(render_frame_host), |
311 scoped_refptr<net::HttpResponseHeaders>(), SSLStatus(), | 314 headers, SSLStatus(), |
312 base::Bind(&UpdateThrottleCheckResult, &result)); | 315 base::Bind(&UpdateThrottleCheckResult, &result)); |
313 | 316 |
314 // Reset the callback to ensure it will not be called later. | 317 // Reset the callback to ensure it will not be called later. |
315 complete_callback_.Reset(); | 318 complete_callback_.Reset(); |
316 return result; | 319 return result; |
317 } | 320 } |
318 | 321 |
| 322 void NavigationHandleImpl::CallDidCommitNavigationForTesting(const GURL& url) { |
| 323 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 324 |
| 325 params.page_id = 1; |
| 326 params.nav_entry_id = 1; |
| 327 params.url = url; |
| 328 params.referrer = content::Referrer(); |
| 329 params.transition = ui::PAGE_TRANSITION_TYPED; |
| 330 params.redirects = std::vector<GURL>(); |
| 331 params.should_update_history = false; |
| 332 params.searchable_form_url = GURL(); |
| 333 params.searchable_form_encoding = std::string(); |
| 334 params.did_create_new_entry = false; |
| 335 params.gesture = NavigationGestureUser; |
| 336 params.was_within_same_page = false; |
| 337 params.method = "GET"; |
| 338 params.page_state = PageState::CreateFromURL(url); |
| 339 params.contents_mime_type = std::string("text/html"); |
| 340 |
| 341 DidCommitNavigation(params, false, render_frame_host_); |
| 342 } |
| 343 |
319 NavigationData* NavigationHandleImpl::GetNavigationData() { | 344 NavigationData* NavigationHandleImpl::GetNavigationData() { |
320 return navigation_data_.get(); | 345 return navigation_data_.get(); |
321 } | 346 } |
322 | 347 |
323 void NavigationHandleImpl::WillStartRequest( | 348 void NavigationHandleImpl::WillStartRequest( |
324 const std::string& method, | 349 const std::string& method, |
325 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 350 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
326 const Referrer& sanitized_referrer, | 351 const Referrer& sanitized_referrer, |
327 bool has_user_gesture, | 352 bool has_user_gesture, |
328 ui::PageTransition transition, | 353 ui::PageTransition transition, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 592 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
568 | 593 |
569 if (throttles_to_register.size() > 0) { | 594 if (throttles_to_register.size() > 0) { |
570 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 595 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
571 throttles_to_register.end()); | 596 throttles_to_register.end()); |
572 throttles_to_register.weak_clear(); | 597 throttles_to_register.weak_clear(); |
573 } | 598 } |
574 } | 599 } |
575 | 600 |
576 } // namespace content | 601 } // namespace content |
OLD | NEW |