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

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

Issue 2045383002: PlzNavigate: detect when a ServiceWorker is present (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 6 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 "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 23 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
24 24
25 namespace content { 25 namespace content {
26 26
27 class NavigatorDelegate; 27 class NavigatorDelegate;
28 class ResourceRequestBodyImpl; 28 class ResourceRequestBodyImpl;
29 class ServiceWorkerContextWrapper;
30 class ServiceWorkerNavigationHandle;
31 struct NavigationRequestInfo; 29 struct NavigationRequestInfo;
32 30
33 // 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
34 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns 32 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns
35 // the newly created NavigationHandleImpl as long as the navigation is ongoing. 33 // the newly created NavigationHandleImpl as long as the navigation is ongoing.
36 // The NavigationHandleImpl in the RenderFrameHost will be reset when the 34 // The NavigationHandleImpl in the RenderFrameHost will be reset when the
37 // navigation stops, that is if one of the following events happen: 35 // navigation stops, that is if one of the following events happen:
38 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new 36 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new
39 // navigation (see below for special cases where the DidStartProvisionalLoad 37 // navigation (see below for special cases where the DidStartProvisionalLoad
40 // message does not indicate the start of a new navigation). 38 // message does not indicate the start of a new navigation).
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 render_frame_host_ = render_frame_host; 156 render_frame_host_ = render_frame_host;
159 } 157 }
160 158
161 // Returns the POST body associated with this navigation. This will be 159 // Returns the POST body associated with this navigation. This will be
162 // null for GET and/or other non-POST requests (or if a response to a POST 160 // null for GET and/or other non-POST requests (or if a response to a POST
163 // request was a redirect that changed the method to GET - for example 302). 161 // request was a redirect that changed the method to GET - for example 302).
164 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body() const { 162 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body() const {
165 return resource_request_body_; 163 return resource_request_body_;
166 } 164 }
167 165
168 // PlzNavigate
169 void InitServiceWorkerHandle(
170 ServiceWorkerContextWrapper* service_worker_context);
171 ServiceWorkerNavigationHandle* service_worker_handle() const {
172 return service_worker_handle_.get();
173 }
174
175 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> 166 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)>
176 ThrottleChecksFinishedCallback; 167 ThrottleChecksFinishedCallback;
177 168
178 // Called when the URLRequest will start in the network stack. |callback| 169 // Called when the URLRequest will start in the network stack. |callback|
179 // will be called when all throttle checks have completed. This will allow 170 // will be called when all throttle checks have completed. This will allow
180 // the caller to cancel the navigation or let it proceed. 171 // the caller to cancel the navigation or let it proceed.
181 void WillStartRequest( 172 void WillStartRequest(
182 const std::string& method, 173 const std::string& method,
183 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body, 174 scoped_refptr<content::ResourceRequestBodyImpl> resource_request_body,
184 const Referrer& sanitized_referrer, 175 const Referrer& sanitized_referrer,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 302
312 // The time this navigation started. 303 // The time this navigation started.
313 const base::TimeTicks navigation_start_; 304 const base::TimeTicks navigation_start_;
314 305
315 // The unique id of the corresponding NavigationEntry. 306 // The unique id of the corresponding NavigationEntry.
316 int pending_nav_entry_id_; 307 int pending_nav_entry_id_;
317 308
318 // This callback will be run when all throttle checks have been performed. 309 // This callback will be run when all throttle checks have been performed.
319 ThrottleChecksFinishedCallback complete_callback_; 310 ThrottleChecksFinishedCallback complete_callback_;
320 311
321 // PlzNavigate
322 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
323 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
324 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
325
326 // Embedder data tied to this navigation. 312 // Embedder data tied to this navigation.
327 std::unique_ptr<NavigationData> navigation_data_; 313 std::unique_ptr<NavigationData> navigation_data_;
328 314
329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 315 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
330 }; 316 };
331 317
332 } // namespace content 318 } // namespace content
333 319
334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 320 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698