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/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "content/browser/frame_host/render_frame_host_impl.h" | 13 #include "content/browser/frame_host/render_frame_host_impl.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/navigation_throttle.h" | 15 #include "content/public/browser/navigation_throttle.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class NavigatorDelegate; | 20 class NavigatorDelegate; |
| 21 class ServiceWorkerNavigationHandle; |
21 struct NavigationRequestInfo; | 22 struct NavigationRequestInfo; |
22 | 23 |
23 // This class keeps track of a single navigation. It is created upon receipt of | 24 // This class keeps track of a single navigation. It is created upon receipt of |
24 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 25 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
25 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 26 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
26 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 27 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
27 // navigation stops, that is if one of the following events happen: | 28 // navigation stops, that is if one of the following events happen: |
28 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 29 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
29 // navigation (see below for special cases where the DidStartProvisionalLoad | 30 // navigation (see below for special cases where the DidStartProvisionalLoad |
30 // message does not indicate the start of a new navigation). | 31 // message does not indicate the start of a new navigation). |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 96 |
96 // Returns whether the navigation is currently being transferred from one | 97 // Returns whether the navigation is currently being transferred from one |
97 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC | 98 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC |
98 // for the navigation URL, received in the new RenderFrameHost, should not | 99 // for the navigation URL, received in the new RenderFrameHost, should not |
99 // indicate the start of a new navigation in that case. | 100 // indicate the start of a new navigation in that case. |
100 bool is_transferring() const { return is_transferring_; } | 101 bool is_transferring() const { return is_transferring_; } |
101 void set_is_transferring(bool is_transferring) { | 102 void set_is_transferring(bool is_transferring) { |
102 is_transferring_ = is_transferring; | 103 is_transferring_ = is_transferring; |
103 } | 104 } |
104 | 105 |
| 106 // PlzNavigate |
| 107 ServiceWorkerNavigationHandle* service_worker_handle() const { |
| 108 return service_worker_handle_.get(); |
| 109 } |
| 110 |
105 // Called when the URLRequest will start in the network stack. | 111 // Called when the URLRequest will start in the network stack. |
106 NavigationThrottle::ThrottleCheckResult WillStartRequest( | 112 NavigationThrottle::ThrottleCheckResult WillStartRequest( |
107 bool is_post, | 113 bool is_post, |
108 const Referrer& sanitized_referrer, | 114 const Referrer& sanitized_referrer, |
109 bool has_user_gesture, | 115 bool has_user_gesture, |
110 ui::PageTransition transition, | 116 ui::PageTransition transition, |
111 bool is_external_protocol); | 117 bool is_external_protocol); |
112 | 118 |
113 // Called when the URLRequest will be redirected in the network stack. | 119 // Called when the URLRequest will be redirected in the network stack. |
114 NavigationThrottle::ThrottleCheckResult WillRedirectRequest( | 120 NavigationThrottle::ThrottleCheckResult WillRedirectRequest( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Whether the navigation is in the middle of a transfer. Set to false when | 167 // Whether the navigation is in the middle of a transfer. Set to false when |
162 // the DidStartProvisionalLoad is received from the new renderer. | 168 // the DidStartProvisionalLoad is received from the new renderer. |
163 bool is_transferring_; | 169 bool is_transferring_; |
164 | 170 |
165 // The FrameTreeNode this navigation is happening in. | 171 // The FrameTreeNode this navigation is happening in. |
166 FrameTreeNode* frame_tree_node_; | 172 FrameTreeNode* frame_tree_node_; |
167 | 173 |
168 // A list of Throttles registered for this navigation. | 174 // A list of Throttles registered for this navigation. |
169 ScopedVector<NavigationThrottle> throttles_; | 175 ScopedVector<NavigationThrottle> throttles_; |
170 | 176 |
| 177 // PlzNavigate |
| 178 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 179 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 180 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 181 |
171 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 182 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
172 }; | 183 }; |
173 | 184 |
174 } // namespace content | 185 } // namespace content |
175 | 186 |
176 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 187 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |