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

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 1018383002: Make NavigationParams clearer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + addressed comment Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include "content/browser/frame_host/frame_tree.h" 7 #include "content/browser/frame_host/frame_tree.h"
8 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 request_body->AppendBytes( 82 request_body->AppendBytes(
83 reinterpret_cast<const char *>( 83 reinterpret_cast<const char *>(
84 entry.GetBrowserInitiatedPostData()->front()), 84 entry.GetBrowserInitiatedPostData()->front()),
85 entry.GetBrowserInitiatedPostData()->size()); 85 entry.GetBrowserInitiatedPostData()->size());
86 } 86 }
87 87
88 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 88 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest(
89 frame_tree_node, entry.ConstructCommonNavigationParams(navigation_type), 89 frame_tree_node, entry.ConstructCommonNavigationParams(navigation_type),
90 BeginNavigationParams(method, headers.ToString(), 90 BeginNavigationParams(method, headers.ToString(),
91 LoadFlagFromNavigationType(navigation_type), false), 91 LoadFlagFromNavigationType(navigation_type), false),
92 entry.ConstructCommitNavigationParams(navigation_start), 92 entry.ConstructRequestNavigationParams(
93 entry.ConstructHistoryNavigationParams(controller), request_body, true, 93 navigation_start, controller->GetIndexOfEntry(&entry),
94 &entry)); 94 controller->GetLastCommittedEntryIndex(),
95 controller->GetEntryCount()),
96 request_body, true, &entry));
95 return navigation_request.Pass(); 97 return navigation_request.Pass();
96 } 98 }
97 99
98 // static 100 // static
99 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( 101 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated(
100 FrameTreeNode* frame_tree_node, 102 FrameTreeNode* frame_tree_node,
101 const CommonNavigationParams& common_params, 103 const CommonNavigationParams& common_params,
102 const BeginNavigationParams& begin_params, 104 const BeginNavigationParams& begin_params,
103 scoped_refptr<ResourceRequestBody> body, 105 scoped_refptr<ResourceRequestBody> body,
104 int current_history_list_offset, 106 int current_history_list_offset,
105 int current_history_list_length) { 107 int current_history_list_length) {
106 // TODO(clamy): Check if some PageState should be provided here. 108 // TODO(clamy): Check if some PageState should be provided here.
107 // TODO(clamy): See how we should handle override of the user agent when the 109 // TODO(clamy): See how we should handle override of the user agent when the
108 // navigation may start in a renderer and commit in another one. 110 // navigation may start in a renderer and commit in another one.
109 // TODO(clamy): See if the navigation start time should be measured in the 111 // TODO(clamy): See if the navigation start time should be measured in the
110 // renderer and sent to the browser instead of being measured here. 112 // renderer and sent to the browser instead of being measured here.
111 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( 113 // TODO(clamy): The pending history list offset should be properly set.
112 frame_tree_node, common_params, begin_params, CommitNavigationParams(), 114 RequestNavigationParams request_params;
113 HistoryNavigationParams(PageState(), -1, -1, current_history_list_offset, 115 request_params.current_history_list_offset = current_history_list_offset;
114 current_history_list_length, false), 116 request_params.current_history_list_length = current_history_list_length;
115 body, false, nullptr)); 117 scoped_ptr<NavigationRequest> navigation_request(
118 new NavigationRequest(frame_tree_node, common_params, begin_params,
119 request_params, body, false, nullptr));
116 return navigation_request.Pass(); 120 return navigation_request.Pass();
117 } 121 }
118 122
119 NavigationRequest::NavigationRequest( 123 NavigationRequest::NavigationRequest(
120 FrameTreeNode* frame_tree_node, 124 FrameTreeNode* frame_tree_node,
121 const CommonNavigationParams& common_params, 125 const CommonNavigationParams& common_params,
122 const BeginNavigationParams& begin_params, 126 const BeginNavigationParams& begin_params,
123 const CommitNavigationParams& commit_params, 127 const RequestNavigationParams& request_params,
124 const HistoryNavigationParams& history_params,
125 scoped_refptr<ResourceRequestBody> body, 128 scoped_refptr<ResourceRequestBody> body,
126 bool browser_initiated, 129 bool browser_initiated,
127 const NavigationEntryImpl* entry) 130 const NavigationEntryImpl* entry)
128 : frame_tree_node_(frame_tree_node), 131 : frame_tree_node_(frame_tree_node),
129 common_params_(common_params), 132 common_params_(common_params),
130 begin_params_(begin_params), 133 begin_params_(begin_params),
131 commit_params_(commit_params), 134 request_params_(request_params),
132 history_params_(history_params),
133 browser_initiated_(browser_initiated), 135 browser_initiated_(browser_initiated),
134 state_(NOT_STARTED), 136 state_(NOT_STARTED),
135 restore_type_(NavigationEntryImpl::RESTORE_NONE), 137 restore_type_(NavigationEntryImpl::RESTORE_NONE),
136 is_view_source_(false), 138 is_view_source_(false),
137 bindings_(NavigationEntryImpl::kInvalidBindings) { 139 bindings_(NavigationEntryImpl::kInvalidBindings) {
138 if (entry) { 140 if (entry) {
139 source_site_instance_ = entry->source_site_instance(); 141 source_site_instance_ = entry->source_site_instance();
140 dest_site_instance_ = entry->site_instance(); 142 dest_site_instance_ = entry->site_instance();
141 restore_type_ = entry->restore_type(); 143 restore_type_ = entry->restore_type();
142 is_view_source_ = entry->IsViewSourceMode(); 144 is_view_source_ = entry->IsViewSourceMode();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // TODO(davidben): Network failures should display a network error page. 209 // TODO(davidben): Network failures should display a network error page.
208 NOTIMPLEMENTED() << " where net_error=" << net_error; 210 NOTIMPLEMENTED() << " where net_error=" << net_error;
209 } 211 }
210 212
211 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { 213 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) {
212 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, 214 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp,
213 common_params_.url); 215 common_params_.url);
214 } 216 }
215 217
216 } // namespace content 218 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698