Index: content/browser/web_contents/navigation_controller_impl.cc |
diff --git a/content/browser/web_contents/navigation_controller_impl.cc b/content/browser/web_contents/navigation_controller_impl.cc |
index b24eb5b1390c3071230174dcd27948bd9c4f3d93..f475eaf94e2367fc33666f877a97b946d4034aba 100644 |
--- a/content/browser/web_contents/navigation_controller_impl.cc |
+++ b/content/browser/web_contents/navigation_controller_impl.cc |
@@ -574,6 +574,25 @@ void NavigationControllerImpl::LoadURL( |
const content::Referrer& referrer, |
content::PageTransition transition, |
const std::string& extra_headers) { |
+ bool override = false; |
+ |
+ // Carry over the user agent override if we're doing a regular navigation. |
+ bool carry_over = transition == content::PAGE_TRANSITION_TYPED || |
+ transition == content::PAGE_TRANSITION_AUTO_BOOKMARK || |
+ transition == content::PAGE_TRANSITION_GENERATED; |
gone
2012/05/24 18:26:21
These conditions were the only ones we encountered
jochen (gone - plz use gerrit)
2012/05/31 14:09:16
What is the intention? When should the UA override
gone
2012/05/31 21:43:25
We intend to carry the override around until a cal
Charlie Reis
2012/06/01 00:36:08
As noted before, I don't understand why it's per-R
|
+ if (GetLastCommittedEntry() && carry_over) |
+ override = GetLastCommittedEntry()->GetIsOverridingUserAgent(); |
+ |
+ LoadURLWithUserAgentOverride(url, referrer, transition, extra_headers, |
+ override); |
+} |
+ |
+void NavigationControllerImpl::LoadURLWithUserAgentOverride( |
+ const GURL& url, |
+ const content::Referrer& referrer, |
+ content::PageTransition transition, |
+ const std::string& extra_headers, |
+ bool is_overriding_user_agent) { |
if (content::HandleDebugURL(url, transition)) |
return; |
@@ -583,6 +602,7 @@ void NavigationControllerImpl::LoadURL( |
NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
CreateNavigationEntry( |
url, referrer, transition, false, extra_headers, browser_context_)); |
+ entry->SetIsOverridingUserAgent(is_overriding_user_agent); |
LoadEntry(entry); |
} |
@@ -868,11 +888,8 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( |
static_cast<SiteInstanceImpl*>(web_contents_->GetSiteInstance())); |
new_entry->SetHasPostData(params.is_post); |
new_entry->SetPostID(params.post_id); |
- |
- if (params.redirects.size() > 0) |
- new_entry->SetOriginalRequestURL(params.redirects[0]); |
- else |
- new_entry->SetOriginalRequestURL(params.url); |
+ new_entry->SetOriginalRequestURL(params.original_request_url); |
tony
2012/05/31 17:25:00
How are original_request_url and url/redirects[0]
gone
2012/05/31 21:43:25
It's intentional; the redirect chain doesn't alway
tony
2012/05/31 21:59:02
I don't fully understand the issue, but is this bu
gone
2012/06/01 01:04:06
Will do.
|
+ new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); |
InsertOrReplaceEntry(new_entry, *did_replace_entry); |
} |