| 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_handle_impl.h" | 10 #include "content/browser/frame_host/navigation_handle_impl.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 reinterpret_cast<const char *>( | 82 reinterpret_cast<const char *>( |
| 83 entry.GetBrowserInitiatedPostData()->front()), | 83 entry.GetBrowserInitiatedPostData()->front()), |
| 84 entry.GetBrowserInitiatedPostData()->size()); | 84 entry.GetBrowserInitiatedPostData()->size()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( | 87 scoped_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
| 88 frame_tree_node, | 88 frame_tree_node, |
| 89 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, | 89 entry.ConstructCommonNavigationParams(dest_url, dest_referrer, |
| 90 frame_entry, navigation_type), | 90 frame_entry, navigation_type), |
| 91 BeginNavigationParams(method, headers.ToString(), | 91 BeginNavigationParams(method, headers.ToString(), |
| 92 LoadFlagFromNavigationType(navigation_type), false), | 92 LoadFlagFromNavigationType(navigation_type), |
| 93 false, // has_user_gestures |
| 94 false, // skip_service_worker |
| 95 REQUEST_CONTEXT_TYPE_LOCATION), |
| 93 entry.ConstructRequestNavigationParams( | 96 entry.ConstructRequestNavigationParams( |
| 94 frame_entry, navigation_start, is_same_document_history_load, | 97 frame_entry, navigation_start, is_same_document_history_load, |
| 95 frame_tree_node->has_committed_real_load(), | 98 frame_tree_node->has_committed_real_load(), |
| 96 controller->GetPendingEntryIndex() == -1, | 99 controller->GetPendingEntryIndex() == -1, |
| 97 controller->GetIndexOfEntry(&entry), | 100 controller->GetIndexOfEntry(&entry), |
| 98 controller->GetLastCommittedEntryIndex(), | 101 controller->GetLastCommittedEntryIndex(), |
| 99 controller->GetEntryCount()), | 102 controller->GetEntryCount()), |
| 100 request_body, true, &frame_entry, &entry)); | 103 request_body, true, &frame_entry, &entry)); |
| 101 return navigation_request.Pass(); | 104 return navigation_request.Pass(); |
| 102 } | 105 } |
| 103 | 106 |
| 104 // static | 107 // static |
| 105 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( | 108 scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( |
| 106 FrameTreeNode* frame_tree_node, | 109 FrameTreeNode* frame_tree_node, |
| 107 const CommonNavigationParams& common_params, | 110 const CommonNavigationParams& common_params, |
| 108 const BeginNavigationParams& begin_params, | 111 const BeginNavigationParams& begin_params, |
| 109 scoped_refptr<ResourceRequestBody> body, | 112 scoped_refptr<ResourceRequestBody> body, |
| 110 int current_history_list_offset, | 113 int current_history_list_offset, |
| 111 int current_history_list_length) { | 114 int current_history_list_length) { |
| 112 // TODO(clamy): Check if some PageState should be provided here. | 115 // TODO(clamy): Check if some PageState should be provided here. |
| 113 // TODO(clamy): See how we should handle override of the user agent when the | 116 // TODO(clamy): See how we should handle override of the user agent when the |
| 114 // navigation may start in a renderer and commit in another one. | 117 // navigation may start in a renderer and commit in another one. |
| 115 // TODO(clamy): See if the navigation start time should be measured in the | 118 // TODO(clamy): See if the navigation start time should be measured in the |
| 116 // renderer and sent to the browser instead of being measured here. | 119 // renderer and sent to the browser instead of being measured here. |
| 117 // TODO(clamy): The pending history list offset should be properly set. | 120 // TODO(clamy): The pending history list offset should be properly set. |
| 118 // TODO(clamy): Set has_committed_real_load. | 121 // TODO(clamy): Set has_committed_real_load. |
| 119 RequestNavigationParams request_params; | 122 RequestNavigationParams request_params( |
| 120 request_params.current_history_list_offset = current_history_list_offset; | 123 false, // is_overriding_user_agent |
| 121 request_params.current_history_list_length = current_history_list_length; | 124 base::TimeTicks::Now(), // browser_navigation_start |
| 125 std::vector<GURL>(), // redirects |
| 126 false, // can_load_local_resources |
| 127 base::Time::Now(), // request_time |
| 128 PageState(), // page_state |
| 129 -1, // page_id |
| 130 0, // nav_entry_id |
| 131 false, // is_same_document_history_load |
| 132 false, // has_committed_real_load |
| 133 false, // intended_as_new_entry |
| 134 -1, // pending_history_list_offset |
| 135 current_history_list_offset, current_history_list_length, |
| 136 false); // should_clear_history_list |
| 122 scoped_ptr<NavigationRequest> navigation_request( | 137 scoped_ptr<NavigationRequest> navigation_request( |
| 123 new NavigationRequest(frame_tree_node, common_params, begin_params, | 138 new NavigationRequest(frame_tree_node, common_params, begin_params, |
| 124 request_params, body, false, nullptr, nullptr)); | 139 request_params, body, false, nullptr, nullptr)); |
| 125 return navigation_request.Pass(); | 140 return navigation_request.Pass(); |
| 126 } | 141 } |
| 127 | 142 |
| 128 NavigationRequest::NavigationRequest( | 143 NavigationRequest::NavigationRequest( |
| 129 FrameTreeNode* frame_tree_node, | 144 FrameTreeNode* frame_tree_node, |
| 130 const CommonNavigationParams& common_params, | 145 const CommonNavigationParams& common_params, |
| 131 const BeginNavigationParams& begin_params, | 146 const BeginNavigationParams& begin_params, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 frame_tree_node_->navigator()->FailedNavigation( | 281 frame_tree_node_->navigator()->FailedNavigation( |
| 267 frame_tree_node_, has_stale_copy_in_cache, net_error); | 282 frame_tree_node_, has_stale_copy_in_cache, net_error); |
| 268 } | 283 } |
| 269 | 284 |
| 270 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { | 285 void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { |
| 271 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, | 286 frame_tree_node_->navigator()->LogResourceRequestTime(timestamp, |
| 272 common_params_.url); | 287 common_params_.url); |
| 273 } | 288 } |
| 274 | 289 |
| 275 } // namespace content | 290 } // namespace content |
| OLD | NEW |