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

Issue 10450002: Transfer user agent override info between browser and renderer (Closed)

Created:
8 years, 7 months ago by gone
Modified:
8 years, 6 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, jochen+watch-content_chromium.org, tburkard+watch_chromium.org, jam, joi+watch-content_chromium.org, dominich+watch_chromium.org, darin-cc_chromium.org, mmenke
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Transfer user agent info between browser and renderer Upstreaming "Request desktop site" feature from Android. Previous CLs: * http://codereview.chromium.org/9999010/ Stores the original request URL in NavigationEntry * http://codereview.chromium.org/10170016/ Adds info about user agent overrides to WebContents and NavigationEntries * https://bugs.webkit.org/show_bug.cgi?id=83959 Adds ability to override the user agent string per-WebFrameClient The previous CLs added the framework to the browser and renderer to support overriding the default user agent with a different string. This CL connects the two sides, letting the browser pass information about the user agent override the renderer should be using for a given navigation. There's a slightly out of date doc at http://go/chrome_android_rds that's being adjusted as CLs land. Changes from previous CLs: * The user agent override string is now stored in the RendererPreferences instead of directly inside the RenderViewImpl and WebContentsImpl. * Setting the user agent override for a WebContents forces a reload if a page is currently being loaded to avoid giving different parts of a web page different user agents. Additions: * The browser-side lets the renderer know about the user agent override string through an IPC call that occurs when the user agent is set in WebContentsImpl and when a RenderViewImpl is created. * Instant + Prefetch classes have been adjusted to set carry over the override flags from the WebContents they're being used for. * A new function is added to the NavigationController to allow setting the override flag for a particular NavigationEntry before it is loaded. * The NavigationController is alerted to new navigations by the renderer with an IPC call and saves the override state in the relevant NavigationEntry. * DocumentState stores whether the user agent override was used for a given navigation, and is set in RenderViewImpl::didCreateDataSource(). Both browser- and renderer-initiated navigations go through here, with browser-initiated navigations using a ViewMsg_Navigate_Params. * WebFrameClient::userAgentOverride() is overridden by RenderViewImpl to return the user agent for the current main frame. If the main frame is provisionally loading something, we use the override for the provisional load instead. Internal bugs=6272286,6213026 BUG=112923 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=143279

Patch Set 1 #

Patch Set 2 : Updating commit log #

Patch Set 3 : Adding new loadEntry type to allow prerenderer to change user agent #

Patch Set 4 : Diff shows what we do downstream #

Total comments: 39

Patch Set 5 : Addessing comments #

Patch Set 6 : Added logic to instant loader to match prerenderer #

Total comments: 2

Patch Set 7 : Moved override state to DocumentState #

Total comments: 9

Patch Set 8 : Cleand up userAgentOverride #

Total comments: 6

Patch Set 9 : Addressing nits #

Patch Set 10 : Adding TODO to combine the NavigationController URL loading interfaces #

Patch Set 11 : Rebasing #

Patch Set 12 : Default to not overriding in prerender config #

Unified diffs Side-by-side diffs Delta from patch set Stats (+172 lines, -26 lines) Patch
M chrome/browser/instant/instant_loader.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/instant/instant_loader.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +29 lines, -7 lines 0 comments Download
M chrome/browser/prerender/prerender_config.h View 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/prerender/prerender_config.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/prerender/prerender_contents.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +8 lines, -2 lines 0 comments Download
M content/browser/web_contents/navigation_controller_impl.h View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M content/browser/web_contents/navigation_controller_impl.cc View 1 2 3 4 5 6 7 8 4 chunks +25 lines, -9 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +0 lines, -4 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +17 lines, -2 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +7 lines, -0 lines 0 comments Download
M content/public/browser/navigation_controller.h View 1 2 3 4 5 6 7 8 9 1 chunk +10 lines, -0 lines 0 comments Download
M content/public/common/renderer_preferences.h View 1 2 3 4 2 chunks +6 lines, -0 lines 0 comments Download
M content/public/renderer/document_state.h View 1 2 3 4 5 6 2 chunks +8 lines, -0 lines 0 comments Download
M content/public/renderer/document_state.cc View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_view_impl.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M content/renderer/render_view_impl.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +41 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
gone
https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc File content/browser/web_contents/navigation_controller_impl.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc#newcode582 content/browser/web_contents/navigation_controller_impl.cc:582: transition == content::PAGE_TRANSITION_GENERATED; These conditions were the only ones ...
8 years, 7 months ago (2012-05-24 18:26:21 UTC) #1
gone
Not sure if you guys are the right ones for this, but added you based ...
8 years, 6 months ago (2012-05-31 02:23:09 UTC) #2
jochen (gone - plz use gerrit)
I'd recommend creis and jam as reviewers https://chromiumcodereview.appspot.com/10450002/diff/3019/chrome/browser/prerender/prerender_contents.cc File chrome/browser/prerender/prerender_contents.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/chrome/browser/prerender/prerender_contents.cc#newcode368 chrome/browser/prerender/prerender_contents.cc:368: new_contents->GetController().LoadURLWithUserAgentOverride( why ...
8 years, 6 months ago (2012-05-31 14:09:15 UTC) #3
tony
https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc File content/browser/web_contents/navigation_controller_impl.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc#newcode891 content/browser/web_contents/navigation_controller_impl.cc:891: new_entry->SetOriginalRequestURL(params.original_request_url); How are original_request_url and url/redirects[0] different? Is this ...
8 years, 6 months ago (2012-05-31 17:25:00 UTC) #4
gone
+creis and jam https://chromiumcodereview.appspot.com/10450002/diff/3019/chrome/browser/prerender/prerender_contents.cc File chrome/browser/prerender/prerender_contents.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/chrome/browser/prerender/prerender_contents.cc#newcode368 chrome/browser/prerender/prerender_contents.cc:368: new_contents->GetController().LoadURLWithUserAgentOverride( On 2012/05/31 14:09:16, jochen wrote: ...
8 years, 6 months ago (2012-05-31 21:43:24 UTC) #5
tony
https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc File content/browser/web_contents/navigation_controller_impl.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/web_contents/navigation_controller_impl.cc#newcode891 content/browser/web_contents/navigation_controller_impl.cc:891: new_entry->SetOriginalRequestURL(params.original_request_url); On 2012/05/31 21:43:25, dfalcantara wrote: > On 2012/05/31 ...
8 years, 6 months ago (2012-05-31 21:59:01 UTC) #6
Charlie Reis
On 2012/05/31 21:43:24, dfalcantara wrote: > +creis and jam Which part did you want me ...
8 years, 6 months ago (2012-05-31 23:20:28 UTC) #7
gone
On 2012/05/31 23:20:28, creis wrote: > On 2012/05/31 21:43:24, dfalcantara wrote: > > +creis and ...
8 years, 6 months ago (2012-05-31 23:21:24 UTC) #8
Charlie Reis
On 2012/05/31 23:21:24, dfalcantara wrote: > On 2012/05/31 23:20:28, creis wrote: > > On 2012/05/31 ...
8 years, 6 months ago (2012-06-01 00:29:29 UTC) #9
Charlie Reis
Some questions below about how this feature should work. https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h File content/browser/renderer_host/render_view_host_impl.h (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h#newcode248 content/browser/renderer_host/render_view_host_impl.h:248: ...
8 years, 6 months ago (2012-06-01 00:36:08 UTC) #10
gone
https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h File content/browser/renderer_host/render_view_host_impl.h (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h#newcode248 content/browser/renderer_host/render_view_host_impl.h:248: // normally used when a navigation requires it. On ...
8 years, 6 months ago (2012-06-01 01:04:06 UTC) #11
Charlie Reis
https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h File content/browser/renderer_host/render_view_host_impl.h (right): https://chromiumcodereview.appspot.com/10450002/diff/3019/content/browser/renderer_host/render_view_host_impl.h#newcode248 content/browser/renderer_host/render_view_host_impl.h:248: // normally used when a navigation requires it. On ...
8 years, 6 months ago (2012-06-01 18:04:08 UTC) #12
gone
Met with creis on Monday about this CL, and I'm still working through some of ...
8 years, 6 months ago (2012-06-14 00:46:39 UTC) #13
darin (slow to review)
I could imagine storing this flag on the DocumentState object. When userAgentOverride() is called, you ...
8 years, 6 months ago (2012-06-15 04:09:22 UTC) #14
gone
Thanks for the pointers! I'll start looking into the DocumentState. https://chromiumcodereview.appspot.com/10450002/diff/26001/content/renderer/render_view_impl.cc File content/renderer/render_view_impl.cc (right): https://chromiumcodereview.appspot.com/10450002/diff/26001/content/renderer/render_view_impl.cc#newcode3709 ...
8 years, 6 months ago (2012-06-15 21:22:35 UTC) #15
gone
The latest patch moves the override state for a navigation over to the DocumentState class ...
8 years, 6 months ago (2012-06-18 18:36:07 UTC) #16
darin (slow to review)
overall, this looks pretty good to me. https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h File content/public/browser/navigation_controller.h (right): https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h#newcode172 content/public/browser/navigation_controller.h:172: virtual void ...
8 years, 6 months ago (2012-06-19 18:36:34 UTC) #17
gone
https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h File content/public/browser/navigation_controller.h (right): https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h#newcode172 content/public/browser/navigation_controller.h:172: virtual void LoadURLWithUserAgentOverride(const GURL& url, On 2012/06/19 18:36:34, darin ...
8 years, 6 months ago (2012-06-19 21:44:21 UTC) #18
Charlie Reis
Yep, this seems good to me. Just a few minor comments below. https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h File content/public/browser/navigation_controller.h ...
8 years, 6 months ago (2012-06-19 22:47:59 UTC) #19
gone
Addressed the nits. I agree that LoadURL could be replaced, but it touches so many ...
8 years, 6 months ago (2012-06-20 00:01:10 UTC) #20
Charlie Reis
LGTM. Darin? https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h File content/public/browser/navigation_controller.h (right): https://chromiumcodereview.appspot.com/10450002/diff/32001/content/public/browser/navigation_controller.h#newcode172 content/public/browser/navigation_controller.h:172: virtual void LoadURLWithUserAgentOverride(const GURL& url, On 2012/06/20 ...
8 years, 6 months ago (2012-06-20 00:17:52 UTC) #21
gone
> Sure. Maybe just add a TODO for now, to be sure it doesn't get ...
8 years, 6 months ago (2012-06-20 00:32:10 UTC) #22
darin (slow to review)
LGTM
8 years, 6 months ago (2012-06-20 16:55:06 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dfalcantara@chromium.org/10450002/45003
8 years, 6 months ago (2012-06-20 20:17:55 UTC) #24
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dfalcantara@chromium.org/10450002/44022
8 years, 6 months ago (2012-06-20 21:08:48 UTC) #25
commit-bot: I haz the power
8 years, 6 months ago (2012-06-20 22:32:23 UTC) #26
Change committed as 143279

Powered by Google App Engine
This is Rietveld 408576698