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

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

Issue 1399363004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 "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).
31 // - The RenderFrameHost stops loading. 32 // - The RenderFrameHost stops loading.
32 // - The RenderFrameHost receives a DidDropNavigation IPC. 33 // - The RenderFrameHost receives a DidDropNavigation IPC.
33 // 34 //
34 // When the navigation encounters an error, the DidStartProvisionalLoad marking 35 // When the navigation encounters an error, the DidStartProvisionalLoad marking
35 // the start of the load of the error page will not be considered as marking a 36 // the start of the load of the error page will not be considered as marking a
36 // new navigation. It will not reset the NavigationHandleImpl in the 37 // new navigation. It will not reset the NavigationHandleImpl in the
37 // RenderFrameHost. 38 // RenderFrameHost.
38 // 39 //
39 // If the navigation needs a cross-site transfer, then the NavigationHandleImpl 40 // If the navigation needs a cross-site transfer, then the NavigationHandleImpl
40 // will briefly be held by the RenderFrameHostManager, until a suitable 41 // will briefly be held by the RenderFrameHostManager, until a suitable
41 // RenderFrameHost for the navigation has been found. The ownership of the 42 // RenderFrameHost for the navigation has been found. The ownership of the
42 // NavigationHandleImpl will then be transferred to the new RenderFrameHost. 43 // NavigationHandleImpl will then be transferred to the new RenderFrameHost.
43 // The DidStartProvisionalLoad received by the new RenderFrameHost for the 44 // The DidStartProvisionalLoad received by the new RenderFrameHost for the
44 // transferring navigation will not reset the NavigationHandleImpl, as it does 45 // transferring navigation will not reset the NavigationHandleImpl, as it does
45 // not mark the start of a new navigation. 46 // not mark the start of a new navigation.
46 // 47 //
47 // PlzNavigate: the NavigationHandleImpl is created just after creating a new 48 // PlzNavigate: the NavigationHandleImpl is created just after creating a new
48 // NavigationRequest. It is then owned by the NavigationRequest until the 49 // NavigationRequest. It is then owned by the NavigationRequest until the
49 // navigation is ready to commit. The NavigationHandleImpl ownership is then 50 // navigation is ready to commit. The NavigationHandleImpl ownership is then
50 // transferred to the RenderFrameHost in which the navigation will commit. 51 // transferred to the RenderFrameHost in which the navigation will commit.
michaeln 2015/10/21 20:07:28 Also extending this comment to describe when it's
51 // 52 //
52 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset 53 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset
53 // following the receipt of a DidStartProvisionalLoad IPC. There are also no 54 // following the receipt of a DidStartProvisionalLoad IPC. There are also no
54 // transferring navigations. The other causes of NavigationHandleImpl reset in 55 // transferring navigations. The other causes of NavigationHandleImpl reset in
55 // the RenderFrameHost still apply. 56 // the RenderFrameHost still apply.
56 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { 57 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
57 public: 58 public:
58 static scoped_ptr<NavigationHandleImpl> Create( 59 static scoped_ptr<NavigationHandleImpl> Create(
59 const GURL& url, 60 const GURL& url,
60 FrameTreeNode* frame_tree_node); 61 FrameTreeNode* frame_tree_node);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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.
michaeln 2015/10/21 20:07:28 Maybe include in the doc comment that this needs t
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698