-
Bryan McQuade authored
Reason for revert: sky@ and ducbui@ found a simpler and more correct fix in https://chromium-review.googlesource.com/c/569578/, so this is no longer needed. The browsertest NewPageInNewForegroundTab, as well as prerender logic in the MetricsWebContentsObserver constructor, are not reverted, as the browsertest is expected to continue to pass, and the prerender logic is still needed even with ducbui's fix. Original issue's description: > Provide WebContents::CreateParams to tab helpers. > > With browser-side navigation enabled, navigations in new foreground tabs are > considered to have started in the background. This is a change in behavior. > This causes page load metrics to incorrectly consider these page loads to have > started in the background, which skews all of Chrome's page load metrics > (PageLoad.* in UMA). > > clamy explains: > """ > the background/foreground issue seems to be due to the ordering of calls in > chrome/browser/ui/browser_navigator.cc when we create a new tab. > What happens is: > - we first create a WebContents and ask it to navigate > (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=557). > This result in the creation of a NavigationHandle, so we fire DidStartNavigation. > In the current architecture, we fire DidStartNavigation after receiving > DidStartProvisionalLoad. > - then we insert the WebContents in the tab strip > (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=589). > This fires WebContentsImpl::WasShown. > """ > > This patch implements Nasko's proposed fix to expose the WebContents > CreateParams to interested WebContentsObservers, page load metrics's > MetricsWebContentsObserver being the first consumer. > > We don't have the CreateParams in all places where a WebContents is passed to > TabHelpers, so we wrap the CreateParams in a base::Optional<> and provide > CreateParams in cases where they are available. > > BUG=725347 > > Review-Url: https://codereview.chromium.org/2894973002 > Cr-Commit-Position: refs/heads/master@{#474895} > Committed: https://chromium.googlesource.com/chromium/src/+/42b72063edb66bfd015bd9dea116c3e3e937d3eb Bug: 725347 Change-Id: I10871fb8a711e9a71b1b8ad2541b6bce017d27be Reviewed-on: https://chromium-review.googlesource.com/571285 Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Bryan McQuade <bmcquade@chromium.org> Cr-Commit-Position: refs/heads/master@{#486909}
d2b93c04