| 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
| 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const base::TimeTicks& navigation_start, | 86 const base::TimeTicks& navigation_start, |
| 87 NavigationControllerImpl* controller); | 87 NavigationControllerImpl* controller); |
| 88 | 88 |
| 89 // Creates a request for a renderer-intiated navigation. | 89 // Creates a request for a renderer-intiated navigation. |
| 90 // Note: |body| is sent to the IO thread when calling BeginNavigation, and | 90 // Note: |body| is sent to the IO thread when calling BeginNavigation, and |
| 91 // should no longer be manipulated afterwards on the UI thread. | 91 // should no longer be manipulated afterwards on the UI thread. |
| 92 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid | 92 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid |
| 93 // threading subtleties. | 93 // threading subtleties. |
| 94 static std::unique_ptr<NavigationRequest> CreateRendererInitiated( | 94 static std::unique_ptr<NavigationRequest> CreateRendererInitiated( |
| 95 FrameTreeNode* frame_tree_node, | 95 FrameTreeNode* frame_tree_node, |
| 96 NavigationEntryImpl* entry, |
| 96 const CommonNavigationParams& common_params, | 97 const CommonNavigationParams& common_params, |
| 97 const BeginNavigationParams& begin_params, | 98 const BeginNavigationParams& begin_params, |
| 98 int current_history_list_offset, | 99 int current_history_list_offset, |
| 99 int current_history_list_length); | 100 int current_history_list_length); |
| 100 | 101 |
| 101 ~NavigationRequest() override; | 102 ~NavigationRequest() override; |
| 102 | 103 |
| 103 // Called on the UI thread by the Navigator to start the navigation. | 104 // Called on the UI thread by the Navigator to start the navigation. |
| 104 void BeginNavigation(); | 105 void BeginNavigation(); |
| 105 | 106 |
| 106 const CommonNavigationParams& common_params() const { return common_params_; } | 107 const CommonNavigationParams& common_params() const { return common_params_; } |
| 107 | 108 |
| 108 const BeginNavigationParams& begin_params() const { return begin_params_; } | 109 const BeginNavigationParams& begin_params() const { return begin_params_; } |
| 109 | 110 |
| 110 const RequestNavigationParams& request_params() const { | 111 const RequestNavigationParams& request_params() const { |
| 111 return request_params_; | 112 return request_params_; |
| 112 } | 113 } |
| 113 | 114 |
| 115 // Updates the navigation start time. |
| 116 void set_navigation_start_time(const base::TimeTicks& time) { |
| 117 common_params_.navigation_start = time; |
| 118 } |
| 119 |
| 114 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } | 120 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } |
| 115 | 121 |
| 116 NavigationState state() const { return state_; } | 122 NavigationState state() const { return state_; } |
| 117 | 123 |
| 118 FrameTreeNode* frame_tree_node() const { return frame_tree_node_; } | 124 FrameTreeNode* frame_tree_node() const { return frame_tree_node_; } |
| 119 | 125 |
| 120 SiteInstanceImpl* source_site_instance() const { | 126 SiteInstanceImpl* source_site_instance() const { |
| 121 return source_site_instance_.get(); | 127 return source_site_instance_.get(); |
| 122 } | 128 } |
| 123 | 129 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 143 } | 149 } |
| 144 | 150 |
| 145 NavigationHandleImpl* navigation_handle() const { | 151 NavigationHandleImpl* navigation_handle() const { |
| 146 return navigation_handle_.get(); | 152 return navigation_handle_.get(); |
| 147 } | 153 } |
| 148 | 154 |
| 149 void SetWaitingForRendererResponse(); | 155 void SetWaitingForRendererResponse(); |
| 150 | 156 |
| 151 // Creates a NavigationHandle. This should be called after any previous | 157 // Creates a NavigationHandle. This should be called after any previous |
| 152 // NavigationRequest for the FrameTreeNode has been destroyed. | 158 // NavigationRequest for the FrameTreeNode has been destroyed. |
| 153 void CreateNavigationHandle(int pending_nav_entry_id); | 159 void CreateNavigationHandle(); |
| 154 | 160 |
| 155 // Transfers the ownership of the NavigationHandle to |render_frame_host|. | 161 // Transfers the ownership of the NavigationHandle to |render_frame_host|. |
| 156 // This should be called when the navigation is ready to commit, because the | 162 // This should be called when the navigation is ready to commit, because the |
| 157 // NavigationHandle outlives the NavigationRequest. The NavigationHandle's | 163 // NavigationHandle outlives the NavigationRequest. The NavigationHandle's |
| 158 // lifetime is the entire navigation, while the NavigationRequest is | 164 // lifetime is the entire navigation, while the NavigationRequest is |
| 159 // destroyed when a navigation is ready for commit. | 165 // destroyed when a navigation is ready for commit. |
| 160 void TransferNavigationHandleOwnership( | 166 void TransferNavigationHandleOwnership( |
| 161 RenderFrameHostImpl* render_frame_host); | 167 RenderFrameHostImpl* render_frame_host); |
| 162 | 168 |
| 163 void set_on_start_checks_complete_closure_for_testing( | 169 void set_on_start_checks_complete_closure_for_testing( |
| 164 const base::Closure& closure) { | 170 const base::Closure& closure) { |
| 165 on_start_checks_complete_closure_ = closure; | 171 on_start_checks_complete_closure_ = closure; |
| 166 } | 172 } |
| 167 | 173 |
| 174 int nav_entry_id() const { return nav_entry_id_; } |
| 175 |
| 168 private: | 176 private: |
| 169 NavigationRequest(FrameTreeNode* frame_tree_node, | 177 NavigationRequest(FrameTreeNode* frame_tree_node, |
| 170 const CommonNavigationParams& common_params, | 178 const CommonNavigationParams& common_params, |
| 171 const BeginNavigationParams& begin_params, | 179 const BeginNavigationParams& begin_params, |
| 172 const RequestNavigationParams& request_params, | 180 const RequestNavigationParams& request_params, |
| 173 bool browser_initiated, | 181 bool browser_initiated, |
| 174 bool may_transfer, | 182 bool may_transfer, |
| 175 const FrameNavigationEntry* frame_navigation_entry, | 183 const FrameNavigationEntry* frame_navigation_entry, |
| 176 const NavigationEntryImpl* navitation_entry); | 184 const NavigationEntryImpl* navitation_entry); |
| 177 | 185 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 std::unique_ptr<NavigationURLLoader> loader_; | 230 std::unique_ptr<NavigationURLLoader> loader_; |
| 223 | 231 |
| 224 // These next items are used in browser-initiated navigations to store | 232 // These next items are used in browser-initiated navigations to store |
| 225 // information from the NavigationEntryImpl that is required after request | 233 // information from the NavigationEntryImpl that is required after request |
| 226 // creation time. | 234 // creation time. |
| 227 scoped_refptr<SiteInstanceImpl> source_site_instance_; | 235 scoped_refptr<SiteInstanceImpl> source_site_instance_; |
| 228 scoped_refptr<SiteInstanceImpl> dest_site_instance_; | 236 scoped_refptr<SiteInstanceImpl> dest_site_instance_; |
| 229 RestoreType restore_type_; | 237 RestoreType restore_type_; |
| 230 bool is_view_source_; | 238 bool is_view_source_; |
| 231 int bindings_; | 239 int bindings_; |
| 240 int nav_entry_id_ = 0; |
| 232 | 241 |
| 233 // Whether the navigation should be sent to a renderer a process. This is | 242 // Whether the navigation should be sent to a renderer a process. This is |
| 234 // true, except for 204/205 responses and downloads. | 243 // true, except for 204/205 responses and downloads. |
| 235 bool response_should_be_rendered_; | 244 bool response_should_be_rendered_; |
| 236 | 245 |
| 237 // The type of SiteInstance associated with this navigation. | 246 // The type of SiteInstance associated with this navigation. |
| 238 AssociatedSiteInstanceType associated_site_instance_type_; | 247 AssociatedSiteInstanceType associated_site_instance_type_; |
| 239 | 248 |
| 240 // Whether the request may be transferred to a different process upon commit. | 249 // Whether the request may be transferred to a different process upon commit. |
| 241 // True for browser-initiated navigations and renderer-inititated navigations | 250 // True for browser-initiated navigations and renderer-inititated navigations |
| (...skipping 14 matching lines...) Expand all Loading... |
| 256 mojo::ScopedDataPipeConsumerHandle handle_; | 265 mojo::ScopedDataPipeConsumerHandle handle_; |
| 257 | 266 |
| 258 base::Closure on_start_checks_complete_closure_; | 267 base::Closure on_start_checks_complete_closure_; |
| 259 | 268 |
| 260 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); | 269 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); |
| 261 }; | 270 }; |
| 262 | 271 |
| 263 } // namespace content | 272 } // namespace content |
| 264 | 273 |
| 265 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 274 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
| OLD | NEW |