Move pending navigation parameters to RenderFrame, and use the HistoryController to distribute them to affected frames.

BUG=369661
TEST=existing tests

Review URL: https://codereview.chromium.org/1027863002

Cr-Commit-Position: refs/heads/master@{#322176}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index cbe833d9..4f93aad 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -74,6 +74,7 @@
 
 class ChildFrameCompositingHelper;
 class CompositorDependencies;
+class DocumentState;
 class ExternalPopupMenu;
 class GeolocationDispatcher;
 class ManifestManager;
@@ -81,6 +82,7 @@
 class MediaStreamRendererFactory;
 class MediaPermissionDispatcher;
 class MidiDispatcher;
+class NavigationState;
 class NotificationPermissionDispatcher;
 class PageState;
 class PepperPluginInstanceImpl;
@@ -101,6 +103,7 @@
 struct CommonNavigationParams;
 struct CustomContextMenuContext;
 struct FrameReplicationState;
+struct NavigationParams;
 struct RequestNavigationParams;
 struct ResourceResponseHead;
 struct StartNavigationParams;
@@ -541,6 +544,11 @@
 
   ManifestManager* manifest_manager();
 
+  // TODO(creis): Remove when the only caller, the HistoryController, is no
+  // more.
+  void SetPendingNavigationParams(
+      scoped_ptr<NavigationParams> navigation_params);
+
  protected:
   RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
 
@@ -719,6 +727,14 @@
   // Returns the URL being loaded by the |frame_|'s request.
   GURL GetLoadingUrl() const;
 
+  // If we initiated a navigation, this function will populate |document_state|
+  // with the navigation information saved in OnNavigate().
+  void PopulateDocumentStateFromPending(DocumentState* document_state);
+
+  // Returns a new NavigationState populated with the navigation information
+  // saved in OnNavigate().
+  NavigationState* CreateNavigationStateFromPending();
+
 #if defined(OS_ANDROID)
   blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
       const blink::WebURL& url,
@@ -761,6 +777,11 @@
   // own RenderWidgets.
   scoped_refptr<RenderWidget> render_widget_;
 
+  // Temporarily holds state pertaining to a navigation that has been initiated
+  // until the NavigationState corresponding to the new navigation is created in
+  // didCreateDataSource().
+  scoped_ptr<NavigationParams> pending_navigation_params_;
+
 #if defined(ENABLE_PLUGINS)
   // Current text input composition text. Empty if no composition is in
   // progress.