Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 10450002: Transfer user agent override info between browser and renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleand up userAgentOverride Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 8 #include <utility>
9 9
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 content::Source<WebContents>(new_contents)); 362 content::Source<WebContents>(new_contents));
363 363
364 // Register for redirect notifications sourced from |this|. 364 // Register for redirect notifications sourced from |this|.
365 notification_registrar_.Add( 365 notification_registrar_.Add(
366 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 366 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
367 content::Source<WebContents>(GetWebContents())); 367 content::Source<WebContents>(GetWebContents()));
368 368
369 DCHECK(load_start_time_.is_null()); 369 DCHECK(load_start_time_.is_null());
370 load_start_time_ = base::TimeTicks::Now(); 370 load_start_time_ = base::TimeTicks::Now();
371 371
372 new_contents->GetController().LoadURL( 372 // Transfer over the user agent override.
373 new_contents->SetUserAgentOverride(
374 prerender_manager_->config().user_agent_override);
375
376 new_contents->GetController().LoadURLWithUserAgentOverride(
373 prerender_url_, 377 prerender_url_,
374 referrer_, 378 referrer_,
375 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : 379 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED :
376 content::PAGE_TRANSITION_LINK), 380 content::PAGE_TRANSITION_LINK),
377 std::string()); 381 false,
382 std::string(),
383 prerender_manager_->config().is_overriding_user_agent);
378 } 384 }
379 385
380 bool PrerenderContents::GetChildId(int* child_id) const { 386 bool PrerenderContents::GetChildId(int* child_id) const {
381 CHECK(child_id); 387 CHECK(child_id);
382 DCHECK_GE(child_id_, -1); 388 DCHECK_GE(child_id_, -1);
383 *child_id = child_id_; 389 *child_id = child_id_;
384 return child_id_ != -1; 390 return child_id_ != -1;
385 } 391 }
386 392
387 bool PrerenderContents::GetRouteId(int* route_id) const { 393 bool PrerenderContents::GetRouteId(int* route_id) const {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 bool PrerenderContents::IsCrossSiteNavigationPending() const { 722 bool PrerenderContents::IsCrossSiteNavigationPending() const {
717 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) 723 if (!prerender_contents_.get() || !prerender_contents_->web_contents())
718 return false; 724 return false;
719 const WebContents* web_contents = prerender_contents_->web_contents(); 725 const WebContents* web_contents = prerender_contents_->web_contents();
720 return (web_contents->GetSiteInstance() != 726 return (web_contents->GetSiteInstance() !=
721 web_contents->GetPendingSiteInstance()); 727 web_contents->GetPendingSiteInstance());
722 } 728 }
723 729
724 730
725 } // namespace prerender 731 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698