OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/prerender/prerender_contents.h" | 5 #include "chrome/browser/prerender/prerender_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 367 |
368 // Register for redirect notifications sourced from |this|. | 368 // Register for redirect notifications sourced from |this|. |
369 notification_registrar_.Add( | 369 notification_registrar_.Add( |
370 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, | 370 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, |
371 content::Source<WebContents>(GetWebContents())); | 371 content::Source<WebContents>(GetWebContents())); |
372 | 372 |
373 // Transfer over the user agent override. | 373 // Transfer over the user agent override. |
374 new_contents->SetUserAgentOverride( | 374 new_contents->SetUserAgentOverride( |
375 prerender_manager_->config().user_agent_override); | 375 prerender_manager_->config().user_agent_override); |
376 | 376 |
377 new_contents->GetController().LoadURLWithUserAgentOverride( | 377 content::NavigationController::LoadURLParams load_url_params( |
378 prerender_url_, | 378 prerender_url_); |
379 referrer_, | 379 load_url_params.referrer = referrer_; |
380 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : | 380 load_url_params.transition_type = (origin_ == ORIGIN_OMNIBOX ? |
381 content::PAGE_TRANSITION_LINK), | 381 content::PAGE_TRANSITION_TYPED : content::PAGE_TRANSITION_LINK); |
382 false, | 382 load_url_params.override_user_agent = |
383 std::string(), | 383 prerender_manager_->config().is_overriding_user_agent ? |
384 prerender_manager_->config().is_overriding_user_agent); | 384 content::NavigationController::UA_OVERRIDE_TRUE : |
| 385 content::NavigationController::UA_OVERRIDE_FALSE; |
| 386 new_contents->GetController().LoadURLWithParams(load_url_params); |
385 } | 387 } |
386 | 388 |
387 bool PrerenderContents::GetChildId(int* child_id) const { | 389 bool PrerenderContents::GetChildId(int* child_id) const { |
388 CHECK(child_id); | 390 CHECK(child_id); |
389 DCHECK_GE(child_id_, -1); | 391 DCHECK_GE(child_id_, -1); |
390 *child_id = child_id_; | 392 *child_id = child_id_; |
391 return child_id_ != -1; | 393 return child_id_ != -1; |
392 } | 394 } |
393 | 395 |
394 bool PrerenderContents::GetRouteId(int* route_id) const { | 396 bool PrerenderContents::GetRouteId(int* route_id) const { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 bool PrerenderContents::IsCrossSiteNavigationPending() const { | 717 bool PrerenderContents::IsCrossSiteNavigationPending() const { |
716 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) | 718 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) |
717 return false; | 719 return false; |
718 const WebContents* web_contents = prerender_contents_->web_contents(); | 720 const WebContents* web_contents = prerender_contents_->web_contents(); |
719 return (web_contents->GetSiteInstance() != | 721 return (web_contents->GetSiteInstance() != |
720 web_contents->GetPendingSiteInstance()); | 722 web_contents->GetPendingSiteInstance()); |
721 } | 723 } |
722 | 724 |
723 | 725 |
724 } // namespace prerender | 726 } // namespace prerender |
OLD | NEW |