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

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: Addressed Kinuko's comments Created 5 years, 1 month 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/callback.h" 10 #include "base/callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "content/browser/frame_host/render_frame_host_impl.h" 14 #include "content/browser/frame_host/render_frame_host_impl.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/public/browser/navigation_throttle.h" 16 #include "content/public/browser/navigation_throttle.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 class NavigatorDelegate; 21 class NavigatorDelegate;
22 class ServiceWorkerNavigationHandle;
22 struct NavigationRequestInfo; 23 struct NavigationRequestInfo;
23 24
24 // This class keeps track of a single navigation. It is created upon receipt of 25 // This class keeps track of a single navigation. It is created upon receipt of
25 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns 26 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns
26 // the newly created NavigationHandleImpl as long as the navigation is ongoing. 27 // the newly created NavigationHandleImpl as long as the navigation is ongoing.
27 // The NavigationHandleImpl in the RenderFrameHost will be reset when the 28 // The NavigationHandleImpl in the RenderFrameHost will be reset when the
28 // navigation stops, that is if one of the following events happen: 29 // navigation stops, that is if one of the following events happen:
29 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new 30 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new
30 // navigation (see below for special cases where the DidStartProvisionalLoad 31 // navigation (see below for special cases where the DidStartProvisionalLoad
31 // message does not indicate the start of a new navigation). 32 // message does not indicate the start of a new navigation).
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 98
98 // Returns whether the navigation is currently being transferred from one 99 // Returns whether the navigation is currently being transferred from one
99 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC 100 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC
100 // for the navigation URL, received in the new RenderFrameHost, should not 101 // for the navigation URL, received in the new RenderFrameHost, should not
101 // indicate the start of a new navigation in that case. 102 // indicate the start of a new navigation in that case.
102 bool is_transferring() const { return is_transferring_; } 103 bool is_transferring() const { return is_transferring_; }
103 void set_is_transferring(bool is_transferring) { 104 void set_is_transferring(bool is_transferring) {
104 is_transferring_ = is_transferring; 105 is_transferring_ = is_transferring;
105 } 106 }
106 107
108 // PlzNavigate
109 ServiceWorkerNavigationHandle* service_worker_handle() const {
110 return service_worker_handle_.get();
111 }
112
107 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> 113 typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)>
108 ThrottleChecksFinishedCallback; 114 ThrottleChecksFinishedCallback;
109 115
110 // Called when the URLRequest will start in the network stack. |callback| 116 // Called when the URLRequest will start in the network stack. |callback|
111 // will be called when all throttle checks have completed. This will allow 117 // will be called when all throttle checks have completed. This will allow
112 // the caller to cancel the navigation or let it proceed. 118 // the caller to cancel the navigation or let it proceed.
113 void WillStartRequest(bool is_post, 119 void WillStartRequest(bool is_post,
114 const Referrer& sanitized_referrer, 120 const Referrer& sanitized_referrer,
115 bool has_user_gesture, 121 bool has_user_gesture,
116 ui::PageTransition transition, 122 ui::PageTransition transition,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 193
188 // A list of Throttles registered for this navigation. 194 // A list of Throttles registered for this navigation.
189 ScopedVector<NavigationThrottle> throttles_; 195 ScopedVector<NavigationThrottle> throttles_;
190 196
191 // The index of the next throttle to check. 197 // The index of the next throttle to check.
192 size_t next_index_; 198 size_t next_index_;
193 199
194 // This callback will be run when all throttle checks have been performed. 200 // This callback will be run when all throttle checks have been performed.
195 ThrottleChecksFinishedCallback complete_callback_; 201 ThrottleChecksFinishedCallback complete_callback_;
196 202
203 // PlzNavigate
204 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
205 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
206 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
207
197 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 208 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
198 }; 209 };
199 210
200 } // namespace content 211 } // namespace content
201 212
202 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 213 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698