OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_HANDLE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
7 | 7 |
8 #include "content/public/browser/navigation_handle.h" | 8 #include "content/public/browser/navigation_handle.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "content/browser/frame_host/frame_tree_node.h" | 16 #include "content/browser/frame_host/frame_tree_node.h" |
17 #include "content/browser/frame_host/render_frame_host_impl.h" | 17 #include "content/browser/frame_host/render_frame_host_impl.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/browser/navigation_data.h" | 19 #include "content/public/browser/navigation_data.h" |
20 #include "content/public/browser/navigation_throttle.h" | 20 #include "content/public/browser/navigation_throttle.h" |
| 21 #include "content/public/common/request_context_type.h" |
21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
22 | 23 |
23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 24 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
24 | 25 |
25 namespace content { | 26 namespace content { |
26 | 27 |
27 class NavigatorDelegate; | 28 class NavigatorDelegate; |
28 class ResourceRequestBodyImpl; | 29 class ResourceRequestBodyImpl; |
29 struct NavigationRequestInfo; | |
30 | 30 |
31 // This class keeps track of a single navigation. It is created upon receipt of | 31 // This class keeps track of a single navigation. It is created upon receipt of |
32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 33 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
35 // navigation stops, that is if one of the following events happen: | 35 // navigation stops, that is if one of the following events happen: |
36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
37 // navigation (see below for special cases where the DidStartProvisionalLoad | 37 // navigation (see below for special cases where the DidStartProvisionalLoad |
38 // message does not indicate the start of a new navigation). | 38 // message does not indicate the start of a new navigation). |
39 // - The RenderFrameHost stops loading. | 39 // - The RenderFrameHost stops loading. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 render_frame_host_ = render_frame_host; | 156 render_frame_host_ = render_frame_host; |
157 } | 157 } |
158 | 158 |
159 // Returns the POST body associated with this navigation. This will be | 159 // Returns the POST body associated with this navigation. This will be |
160 // null for GET and/or other non-POST requests (or if a response to a POST | 160 // null for GET and/or other non-POST requests (or if a response to a POST |
161 // request was a redirect that changed the method to GET - for example 302). | 161 // request was a redirect that changed the method to GET - for example 302). |
162 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body() const { | 162 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body() const { |
163 return resource_request_body_; | 163 return resource_request_body_; |
164 } | 164 } |
165 | 165 |
| 166 RequestContextType fetch_request_context_type() const { |
| 167 return fetch_request_context_type_; |
| 168 } |
| 169 |
166 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 170 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
167 ThrottleChecksFinishedCallback; | 171 ThrottleChecksFinishedCallback; |
168 | 172 |
169 // Called when the URLRequest will start in the network stack. |callback| | 173 // Called when the URLRequest will start in the network stack. |callback| |
170 // will be called when all throttle checks have completed. This will allow | 174 // will be called when all throttle checks have completed. This will allow |
171 // the caller to cancel the navigation or let it proceed. | 175 // the caller to cancel the navigation or let it proceed. |
172 void WillStartRequest( | 176 void WillStartRequest( |
173 const std::string& method, | 177 const std::string& method, |
174 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, | 178 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, |
175 const Referrer& sanitized_referrer, | 179 const Referrer& sanitized_referrer, |
176 bool has_user_gesture, | 180 bool has_user_gesture, |
177 ui::PageTransition transition, | 181 ui::PageTransition transition, |
178 bool is_external_protocol, | 182 bool is_external_protocol, |
| 183 RequestContextType fetch_request_context_type, |
179 const ThrottleChecksFinishedCallback& callback); | 184 const ThrottleChecksFinishedCallback& callback); |
180 | 185 |
181 // Called when the URLRequest will be redirected in the network stack. | 186 // Called when the URLRequest will be redirected in the network stack. |
182 // |callback| will be called when all throttles check have completed. This | 187 // |callback| will be called when all throttles check have completed. This |
183 // will allow the caller to cancel the navigation or let it proceed. | 188 // will allow the caller to cancel the navigation or let it proceed. |
184 // This will also inform the delegate that the request was redirected. | 189 // This will also inform the delegate that the request was redirected. |
185 void WillRedirectRequest( | 190 void WillRedirectRequest( |
186 const GURL& new_url, | 191 const GURL& new_url, |
187 const std::string& new_method, | 192 const std::string& new_method, |
188 const GURL& new_referrer_url, | 193 const GURL& new_referrer_url, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 307 |
303 // The index of the next throttle to check. | 308 // The index of the next throttle to check. |
304 size_t next_index_; | 309 size_t next_index_; |
305 | 310 |
306 // The time this navigation started. | 311 // The time this navigation started. |
307 const base::TimeTicks navigation_start_; | 312 const base::TimeTicks navigation_start_; |
308 | 313 |
309 // The unique id of the corresponding NavigationEntry. | 314 // The unique id of the corresponding NavigationEntry. |
310 int pending_nav_entry_id_; | 315 int pending_nav_entry_id_; |
311 | 316 |
| 317 // The fetch request context type. |
| 318 RequestContextType fetch_request_context_type_; |
| 319 |
312 // This callback will be run when all throttle checks have been performed. | 320 // This callback will be run when all throttle checks have been performed. |
313 ThrottleChecksFinishedCallback complete_callback_; | 321 ThrottleChecksFinishedCallback complete_callback_; |
314 | 322 |
315 // Embedder data tied to this navigation. | 323 // Embedder data tied to this navigation. |
316 std::unique_ptr<NavigationData> navigation_data_; | 324 std::unique_ptr<NavigationData> navigation_data_; |
317 | 325 |
318 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 326 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
319 }; | 327 }; |
320 | 328 |
321 } // namespace content | 329 } // namespace content |
322 | 330 |
323 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 331 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |