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

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: Diff shows what we do downstream Created 8 years, 7 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 content::Source<WebContents>(new_contents)); 354 content::Source<WebContents>(new_contents));
355 355
356 // Register for redirect notifications sourced from |this|. 356 // Register for redirect notifications sourced from |this|.
357 notification_registrar_.Add( 357 notification_registrar_.Add(
358 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 358 this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
359 content::Source<WebContents>(GetWebContents())); 359 content::Source<WebContents>(GetWebContents()));
360 360
361 DCHECK(load_start_time_.is_null()); 361 DCHECK(load_start_time_.is_null());
362 load_start_time_ = base::TimeTicks::Now(); 362 load_start_time_ = base::TimeTicks::Now();
363 363
364 new_contents->GetController().LoadURL( 364 // Transfer over the user agent override.
365 new_contents->SetUserAgentOverride(
366 prerender_manager_->config().user_agent_override);
367
368 new_contents->GetController().LoadURLWithUserAgentOverride(
jochen (gone - plz use gerrit) 2012/05/31 14:09:16 why is setting the override and then using LoadURL
gone 2012/05/31 21:43:25 The override string is stored for all NavigationEn
365 prerender_url_, 369 prerender_url_,
366 referrer_, 370 referrer_,
367 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED : 371 (origin_ == ORIGIN_OMNIBOX ? content::PAGE_TRANSITION_TYPED :
368 content::PAGE_TRANSITION_LINK), 372 content::PAGE_TRANSITION_LINK),
369 std::string()); 373 std::string(),
374 prerender_manager_->config().is_overriding_user_agent);
370 } 375 }
371 376
372 bool PrerenderContents::GetChildId(int* child_id) const { 377 bool PrerenderContents::GetChildId(int* child_id) const {
373 CHECK(child_id); 378 CHECK(child_id);
374 DCHECK_GE(child_id_, -1); 379 DCHECK_GE(child_id_, -1);
375 *child_id = child_id_; 380 *child_id = child_id_;
376 return child_id_ != -1; 381 return child_id_ != -1;
377 } 382 }
378 383
379 bool PrerenderContents::GetRouteId(int* route_id) const { 384 bool PrerenderContents::GetRouteId(int* route_id) const {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 bool PrerenderContents::IsCrossSiteNavigationPending() const { 713 bool PrerenderContents::IsCrossSiteNavigationPending() const {
709 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) 714 if (!prerender_contents_.get() || !prerender_contents_->web_contents())
710 return false; 715 return false;
711 const WebContents* web_contents = prerender_contents_->web_contents(); 716 const WebContents* web_contents = prerender_contents_->web_contents();
712 return (web_contents->GetSiteInstance() != 717 return (web_contents->GetSiteInstance() !=
713 web_contents->GetPendingSiteInstance()); 718 web_contents->GetPendingSiteInstance());
714 } 719 }
715 720
716 721
717 } // namespace prerender 722 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698