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 "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 bool is_transferring() const { return is_transferring_; } | 105 bool is_transferring() const { return is_transferring_; } |
106 void set_is_transferring(bool is_transferring) { | 106 void set_is_transferring(bool is_transferring) { |
107 is_transferring_ = is_transferring; | 107 is_transferring_ = is_transferring; |
108 } | 108 } |
109 | 109 |
110 // PlzNavigate | 110 // PlzNavigate |
111 ServiceWorkerNavigationHandle* service_worker_handle() const { | 111 ServiceWorkerNavigationHandle* service_worker_handle() const { |
112 return service_worker_handle_.get(); | 112 return service_worker_handle_.get(); |
113 } | 113 } |
114 | 114 |
115 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> | 115 using ExtraHeadersList = std::vector<std::pair<std::string, std::string> >; |
nasko
2015/11/25 14:54:37
nit: I think it is safe these days to have ">>" at
| |
116 ThrottleChecksFinishedCallback; | 116 using ThrottleChecksFinishedCallback = |
117 base::Callback<void(NavigationThrottle::ThrottleCheckResult, | |
118 const ExtraHeadersList&)>; | |
119 | |
120 // Adds an entry in the ExtraHeadersList. The extra header itself will be | |
121 // added to the request when the ThrottleChecksFinishedCallback will be run. | |
122 void AddExtraHeader(const std::string& name, const std::string& value); | |
117 | 123 |
118 // Called when the URLRequest will start in the network stack. |callback| | 124 // Called when the URLRequest will start in the network stack. |callback| |
119 // will be called when all throttle checks have completed. This will allow | 125 // will be called when all throttle checks have completed. This will allow |
120 // the caller to cancel the navigation or let it proceed. | 126 // the caller to cancel the navigation or let it proceed. |
121 void WillStartRequest(bool is_post, | 127 void WillStartRequest(bool is_post, |
122 const Referrer& sanitized_referrer, | 128 const Referrer& sanitized_referrer, |
123 bool has_user_gesture, | 129 bool has_user_gesture, |
124 ui::PageTransition transition, | 130 ui::PageTransition transition, |
125 bool is_external_protocol, | 131 bool is_external_protocol, |
126 const ThrottleChecksFinishedCallback& callback); | 132 const ThrottleChecksFinishedCallback& callback); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 | 203 |
198 // The FrameTreeNode this navigation is happening in. | 204 // The FrameTreeNode this navigation is happening in. |
199 FrameTreeNode* frame_tree_node_; | 205 FrameTreeNode* frame_tree_node_; |
200 | 206 |
201 // A list of Throttles registered for this navigation. | 207 // A list of Throttles registered for this navigation. |
202 ScopedVector<NavigationThrottle> throttles_; | 208 ScopedVector<NavigationThrottle> throttles_; |
203 | 209 |
204 // The index of the next throttle to check. | 210 // The index of the next throttle to check. |
205 size_t next_index_; | 211 size_t next_index_; |
206 | 212 |
213 // Passed back to the handler of the navigation request after the throttles | |
214 // checks have been performed. | |
215 ExtraHeadersList extra_headers_to_add_; | |
216 | |
207 // This callback will be run when all throttle checks have been performed. | 217 // This callback will be run when all throttle checks have been performed. |
208 ThrottleChecksFinishedCallback complete_callback_; | 218 ThrottleChecksFinishedCallback complete_callback_; |
209 | 219 |
210 // PlzNavigate | 220 // PlzNavigate |
211 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 221 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
212 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 222 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
213 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 223 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
214 | 224 |
215 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 225 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
216 }; | 226 }; |
217 | 227 |
218 } // namespace content | 228 } // namespace content |
219 | 229 |
220 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 230 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |