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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 2161073002: Adds RequestContextType information to the NavigationHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed clamy@'s and nasko@'s comments. Created 4 years, 5 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 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 bool is_external_protocol) override; 111 bool is_external_protocol) override;
112 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( 112 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting(
113 const GURL& new_url, 113 const GURL& new_url,
114 bool new_method_is_post, 114 bool new_method_is_post,
115 const GURL& new_referrer_url, 115 const GURL& new_referrer_url,
116 bool new_is_external_protocol) override; 116 bool new_is_external_protocol) override;
117 NavigationData* GetNavigationData() override; 117 NavigationData* GetNavigationData() override;
118 118
119 NavigatorDelegate* GetDelegate() const; 119 NavigatorDelegate* GetDelegate() const;
120 120
121 RequestContextType GetFetchRequestContextType() const;
clamy 2016/07/22 13:51:31 s/GetFetchRequestContextType/GetRequestContextType
carlosk 2016/07/22 16:00:29 Done.
122
121 // Returns the response headers for the request or nullptr if there are none. 123 // Returns the response headers for the request or nullptr if there are none.
122 // This should only be accessed after a redirect was encountered or after the 124 // This should only be accessed after a redirect was encountered or after the
123 // navigation is ready to commit. The headers returned should not be modified, 125 // navigation is ready to commit. The headers returned should not be modified,
124 // as modifications will not be reflected in the network stack. 126 // as modifications will not be reflected in the network stack.
125 const net::HttpResponseHeaders* GetResponseHeaders(); 127 const net::HttpResponseHeaders* GetResponseHeaders();
126 128
127 // Get the unique id from the NavigationEntry associated with this 129 // Get the unique id from the NavigationEntry associated with this
128 // NavigationHandle. Note that a synchronous, renderer-initiated navigation 130 // NavigationHandle. Note that a synchronous, renderer-initiated navigation
129 // will not have a NavigationEntry associated with it, and this will return 0. 131 // will not have a NavigationEntry associated with it, and this will return 0.
130 int pending_nav_entry_id() const { return pending_nav_entry_id_; } 132 int pending_nav_entry_id() const { return pending_nav_entry_id_; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Called when the URLRequest will start in the network stack. |callback| 171 // Called when the URLRequest will start in the network stack. |callback|
170 // will be called when all throttle checks have completed. This will allow 172 // will be called when all throttle checks have completed. This will allow
171 // the caller to cancel the navigation or let it proceed. 173 // the caller to cancel the navigation or let it proceed.
172 void WillStartRequest( 174 void WillStartRequest(
173 const std::string& method, 175 const std::string& method,
174 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, 176 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body,
175 const Referrer& sanitized_referrer, 177 const Referrer& sanitized_referrer,
176 bool has_user_gesture, 178 bool has_user_gesture,
177 ui::PageTransition transition, 179 ui::PageTransition transition,
178 bool is_external_protocol, 180 bool is_external_protocol,
181 RequestContextType request_context_type,
179 const ThrottleChecksFinishedCallback& callback); 182 const ThrottleChecksFinishedCallback& callback);
180 183
181 // Called when the URLRequest will be redirected in the network stack. 184 // Called when the URLRequest will be redirected in the network stack.
182 // |callback| will be called when all throttles check have completed. This 185 // |callback| will be called when all throttles check have completed. This
183 // will allow the caller to cancel the navigation or let it proceed. 186 // will allow the caller to cancel the navigation or let it proceed.
184 // This will also inform the delegate that the request was redirected. 187 // This will also inform the delegate that the request was redirected.
185 void WillRedirectRequest( 188 void WillRedirectRequest(
186 const GURL& new_url, 189 const GURL& new_url,
187 const std::string& new_method, 190 const std::string& new_method,
188 const GURL& new_referrer_url, 191 const GURL& new_referrer_url,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 305
303 // The index of the next throttle to check. 306 // The index of the next throttle to check.
304 size_t next_index_; 307 size_t next_index_;
305 308
306 // The time this navigation started. 309 // The time this navigation started.
307 const base::TimeTicks navigation_start_; 310 const base::TimeTicks navigation_start_;
308 311
309 // The unique id of the corresponding NavigationEntry. 312 // The unique id of the corresponding NavigationEntry.
310 int pending_nav_entry_id_; 313 int pending_nav_entry_id_;
311 314
315 // The fetch request context type.
316 RequestContextType request_context_type_;
317
312 // This callback will be run when all throttle checks have been performed. 318 // This callback will be run when all throttle checks have been performed.
313 ThrottleChecksFinishedCallback complete_callback_; 319 ThrottleChecksFinishedCallback complete_callback_;
314 320
315 // Embedder data tied to this navigation. 321 // Embedder data tied to this navigation.
316 std::unique_ptr<NavigationData> navigation_data_; 322 std::unique_ptr<NavigationData> navigation_data_;
317 323
318 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 324 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
319 }; 325 };
320 326
321 } // namespace content 327 } // namespace content
322 328
323 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 329 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698