OLD | NEW |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.ConstructRequestNavigationParams( | 92 entry.ConstructRequestNavigationParams( |
93 navigation_start, | 93 navigation_start, controller->HasCommittedRealLoad(frame_tree_node), |
94 controller->GetPendingEntryIndex() == -1, | 94 controller->GetPendingEntryIndex() == -1, |
95 controller->GetIndexOfEntry(&entry), | 95 controller->GetIndexOfEntry(&entry), |
96 controller->GetLastCommittedEntryIndex(), | 96 controller->GetLastCommittedEntryIndex(), |
97 controller->GetEntryCount()), | 97 controller->GetEntryCount()), |
98 request_body, true, &entry)); | 98 request_body, true, &entry)); |
99 return navigation_request.Pass(); | 99 return navigation_request.Pass(); |
100 } | 100 } |
101 | 101 |
102 // static | 102 // static |
103 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( | 103 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( |
104 FrameTreeNode* frame_tree_node, | 104 FrameTreeNode* frame_tree_node, |
105 const CommonNavigationParams& common_params, | 105 const CommonNavigationParams& common_params, |
106 const BeginNavigationParams& begin_params, | 106 const BeginNavigationParams& begin_params, |
107 scoped_refptr<ResourceRequestBody> body, | 107 scoped_refptr<ResourceRequestBody> body, |
108 int current_history_list_offset, | 108 int current_history_list_offset, |
109 int current_history_list_length) { | 109 int current_history_list_length) { |
110 // TODO(clamy): Check if some PageState should be provided here. | 110 // TODO(clamy): Check if some PageState should be provided here. |
111 // TODO(clamy): See how we should handle override of the user agent when the | 111 // TODO(clamy): See how we should handle override of the user agent when the |
112 // navigation may start in a renderer and commit in another one. | 112 // navigation may start in a renderer and commit in another one. |
113 // TODO(clamy): See if the navigation start time should be measured in the | 113 // TODO(clamy): See if the navigation start time should be measured in the |
114 // renderer and sent to the browser instead of being measured here. | 114 // renderer and sent to the browser instead of being measured here. |
115 // TODO(clamy): The pending history list offset should be properly set. | 115 // TODO(clamy): The pending history list offset should be properly set. |
| 116 // TODO(clamy): Set has_committed_real_load. |
116 RequestNavigationParams request_params; | 117 RequestNavigationParams request_params; |
117 request_params.current_history_list_offset = current_history_list_offset; | 118 request_params.current_history_list_offset = current_history_list_offset; |
118 request_params.current_history_list_length = current_history_list_length; | 119 request_params.current_history_list_length = current_history_list_length; |
119 scoped_ptr<NavigationRequest> navigation_request( | 120 scoped_ptr<NavigationRequest> navigation_request( |
120 new NavigationRequest(frame_tree_node, common_params, begin_params, | 121 new NavigationRequest(frame_tree_node, common_params, begin_params, |
121 request_params, body, false, nullptr)); | 122 request_params, body, false, nullptr)); |
122 return navigation_request.Pass(); | 123 return navigation_request.Pass(); |
123 } | 124 } |
124 | 125 |
125 NavigationRequest::NavigationRequest( | 126 NavigationRequest::NavigationRequest( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 frame_tree_node_->navigator()->FailedNavigation( | 214 frame_tree_node_->navigator()->FailedNavigation( |
214 frame_tree_node_, has_stale_copy_in_cache, net_error); | 215 frame_tree_node_, has_stale_copy_in_cache, net_error); |
215 } | 216 } |
216 | 217 |
217 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { | 218 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { |
218 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, | 219 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, |
219 common_params_.url); | 220 common_params_.url); |
220 } | 221 } |
221 | 222 |
222 } // namespace content | 223 } // namespace content |
OLD | NEW |