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

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

Issue 1294243004: PlzNavigate: Make ServiceWorker work with PlzNavigate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
13 #include "content/browser/frame_host/render_frame_host_impl.h" 14 #include "content/browser/frame_host/render_frame_host_impl.h"
14 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
15 #include "content/public/browser/navigation_throttle.h" 16 #include "content/public/browser/navigation_throttle.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class NavigatorDelegate; 21 class NavigatorDelegate;
21 struct NavigationRequestInfo; 22 struct NavigationRequestInfo;
23 class ServiceWorkerContext;
michaeln 2015/10/01 01:42:15 i don't think this forward is needed
Fabrice (no longer in Chrome) 2015/10/01 18:29:55 Done.
24 class ServiceWorkerContextWrapper;
22 25
23 // This class keeps track of a single navigation. It is created upon receipt of 26 // This class keeps track of a single navigation. It is created upon receipt of
24 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns 27 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns
25 // the newly created NavigationHandleImpl as long as the navigation is ongoing. 28 // the newly created NavigationHandleImpl as long as the navigation is ongoing.
26 // The NavigationHandleImpl in the RenderFrameHost will be reset when the 29 // The NavigationHandleImpl in the RenderFrameHost will be reset when the
27 // navigation stops, that is if one of the following events happen: 30 // navigation stops, that is if one of the following events happen:
28 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new 31 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new
29 // navigation (see below for special cases where the DidStartProvisionalLoad 32 // navigation (see below for special cases where the DidStartProvisionalLoad
30 // message does not indicate the start of a new navigation). 33 // message does not indicate the start of a new navigation).
31 // - The RenderFrameHost stops loading. 34 // - The RenderFrameHost stops loading.
(...skipping 16 matching lines...) Expand all
48 // NavigationRequest. It is then owned by the NavigationRequest until the 51 // NavigationRequest. It is then owned by the NavigationRequest until the
49 // navigation is ready to commit. The NavigationHandleImpl ownership is then 52 // navigation is ready to commit. The NavigationHandleImpl ownership is then
50 // transferred to the RenderFrameHost in which the navigation will commit. 53 // transferred to the RenderFrameHost in which the navigation will commit.
51 // 54 //
52 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset 55 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset
53 // following the receipt of a DidStartProvisionalLoad IPC. There are also no 56 // following the receipt of a DidStartProvisionalLoad IPC. There are also no
54 // transferring navigations. The other causes of NavigationHandleImpl reset in 57 // transferring navigations. The other causes of NavigationHandleImpl reset in
55 // the RenderFrameHost still apply. 58 // the RenderFrameHost still apply.
56 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { 59 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle {
57 public: 60 public:
58 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, 61 static scoped_ptr<NavigationHandleImpl> Create(
59 bool is_main_frame, 62 const GURL& url,
60 NavigatorDelegate* delegate); 63 bool is_main_frame,
64 NavigatorDelegate* delegate,
65 int service_worker_provider_id);
clamy 2015/10/01 12:41:26 I do not like having the service_worker_provider_i
Fabrice (no longer in Chrome) 2015/10/01 18:29:55 That was my first idea too, but the NavigationRequ
michaeln 2015/10/01 23:11:11 I think your talking about the construction sequen
clamy 2015/10/02 10:34:44 While it does look straightforward to alter the co
Fabrice (no longer in Chrome) 2015/10/02 16:37:34 That works thanks!
61 ~NavigationHandleImpl() override; 66 ~NavigationHandleImpl() override;
62 67
63 // NavigationHandle implementation: 68 // NavigationHandle implementation:
64 const GURL& GetURL() override; 69 const GURL& GetURL() override;
65 bool IsInMainFrame() override; 70 bool IsInMainFrame() override;
66 bool IsPost() override; 71 bool IsPost() override;
67 const Referrer& GetReferrer() override; 72 const Referrer& GetReferrer() override;
68 bool HasUserGesture() override; 73 bool HasUserGesture() override;
69 ui::PageTransition GetPageTransition() override; 74 ui::PageTransition GetPageTransition() override;
70 bool IsExternalProtocol() override; 75 bool IsExternalProtocol() override;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Used to track the state the navigation is currently in. 140 // Used to track the state the navigation is currently in.
136 enum State { 141 enum State {
137 INITIAL = 0, 142 INITIAL = 0,
138 WILL_SEND_REQUEST, 143 WILL_SEND_REQUEST,
139 READY_TO_COMMIT, 144 READY_TO_COMMIT,
140 DID_COMMIT, 145 DID_COMMIT,
141 DID_COMMIT_ERROR_PAGE, 146 DID_COMMIT_ERROR_PAGE,
142 }; 147 };
143 148
144 NavigationHandleImpl(const GURL& url, 149 NavigationHandleImpl(const GURL& url,
145 const bool is_main_frame, 150 bool is_main_frame,
146 NavigatorDelegate* delegate); 151 NavigatorDelegate* delegate,
152 int service_worker_provider_id);
147 153
148 // See NavigationHandle for a description of those member variables. 154 // See NavigationHandle for a description of those member variables.
149 GURL url_; 155 GURL url_;
150 const bool is_main_frame_; 156 const bool is_main_frame_;
151 bool is_post_; 157 bool is_post_;
152 Referrer sanitized_referrer_; 158 Referrer sanitized_referrer_;
153 bool has_user_gesture_; 159 bool has_user_gesture_;
154 ui::PageTransition transition_; 160 ui::PageTransition transition_;
155 bool is_external_protocol_; 161 bool is_external_protocol_;
156 net::Error net_error_code_; 162 net::Error net_error_code_;
157 RenderFrameHostImpl* render_frame_host_; 163 RenderFrameHostImpl* render_frame_host_;
158 bool is_same_page_; 164 bool is_same_page_;
159 165
160 // The state the navigation is in. 166 // The state the navigation is in.
161 State state_; 167 State state_;
162 168
163 // Whether the navigation is in the middle of a transfer. Set to false when 169 // Whether the navigation is in the middle of a transfer. Set to false when
164 // the DidStartProvisionalLoad is received from the new renderer. 170 // the DidStartProvisionalLoad is received from the new renderer.
165 bool is_transferring_; 171 bool is_transferring_;
166 172
167 // The delegate that should be notified about events related to this 173 // The delegate that should be notified about events related to this
168 // navigation. 174 // navigation.
169 NavigatorDelegate* delegate_; 175 NavigatorDelegate* delegate_;
170 176
171 // A list of Throttles registered for this navigation. 177 // A list of Throttles registered for this navigation.
172 ScopedVector<NavigationThrottle> throttles_; 178 ScopedVector<NavigationThrottle> throttles_;
173 179
180 // PlzNavigate
181 // The SWProvider ID used for navigations.
michaeln 2015/10/01 01:42:15 for non-plznav navigations, this should probably b
clamy 2015/10/01 12:41:26 nit: use the full class name for SWProvider. Also,
Fabrice (no longer in Chrome) 2015/10/01 18:29:54 Done.
182 int service_worker_provider_id_;
183
184 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
185
174 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 186 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
175 }; 187 };
176 188
177 } // namespace content 189 } // namespace content
178 190
179 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 191 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698