Chromium Code Reviews| 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/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; |
| 22 class ServiceWorkerContextWrapper; | |
| 21 struct NavigationRequestInfo; | 23 struct NavigationRequestInfo; |
| 22 | 24 |
| 23 // 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 |
| 24 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns | 26 // a DidStartProvisionalLoad IPC in a RenderFrameHost. The RenderFrameHost owns |
| 25 // the newly created NavigationHandleImpl as long as the navigation is ongoing. | 27 // the newly created NavigationHandleImpl as long as the navigation is ongoing. |
| 26 // The NavigationHandleImpl in the RenderFrameHost will be reset when the | 28 // The NavigationHandleImpl in the RenderFrameHost will be reset when the |
| 27 // navigation stops, that is if one of the following events happen: | 29 // navigation stops, that is if one of the following events happen: |
| 28 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new | 30 // - The RenderFrameHost receives a DidStartProvisionalLoad IPC for a new |
| 29 // navigation (see below for special cases where the DidStartProvisionalLoad | 31 // navigation (see below for special cases where the DidStartProvisionalLoad |
| 30 // message does not indicate the start of a new navigation). | 32 // message does not indicate the start of a new navigation). |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 48 // NavigationRequest. It is then owned by the NavigationRequest until the | 50 // NavigationRequest. It is then owned by the NavigationRequest until the |
| 49 // navigation is ready to commit. The NavigationHandleImpl ownership is then | 51 // navigation is ready to commit. The NavigationHandleImpl ownership is then |
| 50 // transferred to the RenderFrameHost in which the navigation will commit. | 52 // transferred to the RenderFrameHost in which the navigation will commit. |
| 51 // | 53 // |
| 52 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset | 54 // When PlzNavigate is enabled, the NavigationHandleImpl will never be reset |
| 53 // following the receipt of a DidStartProvisionalLoad IPC. There are also no | 55 // following the receipt of a DidStartProvisionalLoad IPC. There are also no |
| 54 // transferring navigations. The other causes of NavigationHandleImpl reset in | 56 // transferring navigations. The other causes of NavigationHandleImpl reset in |
| 55 // the RenderFrameHost still apply. | 57 // the RenderFrameHost still apply. |
| 56 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { | 58 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| 57 public: | 59 public: |
| 58 static scoped_ptr<NavigationHandleImpl> Create(const GURL& url, | 60 static scoped_ptr<NavigationHandleImpl> Create( |
| 59 bool is_main_frame, | 61 const GURL& url, |
| 60 NavigatorDelegate* delegate); | 62 bool is_main_frame, |
| 63 NavigatorDelegate* delegate, | |
| 64 int service_worker_provider_id); | |
|
clamy
2015/10/02 10:34:44
See the comment in the previous patch set on why w
Fabrice (no longer in Chrome)
2015/10/02 16:37:34
Done.
| |
| 61 ~NavigationHandleImpl() override; | 65 ~NavigationHandleImpl() override; |
| 62 | 66 |
| 63 // NavigationHandle implementation: | 67 // NavigationHandle implementation: |
| 64 const GURL& GetURL() override; | 68 const GURL& GetURL() override; |
| 65 bool IsInMainFrame() override; | 69 bool IsInMainFrame() override; |
| 66 bool IsPost() override; | 70 bool IsPost() override; |
| 67 const Referrer& GetReferrer() override; | 71 const Referrer& GetReferrer() override; |
| 68 bool HasUserGesture() override; | 72 bool HasUserGesture() override; |
| 69 ui::PageTransition GetPageTransition() override; | 73 ui::PageTransition GetPageTransition() override; |
| 70 bool IsExternalProtocol() override; | 74 bool IsExternalProtocol() override; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 // Used to track the state the navigation is currently in. | 139 // Used to track the state the navigation is currently in. |
| 136 enum State { | 140 enum State { |
| 137 INITIAL = 0, | 141 INITIAL = 0, |
| 138 WILL_SEND_REQUEST, | 142 WILL_SEND_REQUEST, |
| 139 READY_TO_COMMIT, | 143 READY_TO_COMMIT, |
| 140 DID_COMMIT, | 144 DID_COMMIT, |
| 141 DID_COMMIT_ERROR_PAGE, | 145 DID_COMMIT_ERROR_PAGE, |
| 142 }; | 146 }; |
| 143 | 147 |
| 144 NavigationHandleImpl(const GURL& url, | 148 NavigationHandleImpl(const GURL& url, |
| 145 const bool is_main_frame, | 149 bool is_main_frame, |
| 146 NavigatorDelegate* delegate); | 150 NavigatorDelegate* delegate, |
| 151 int service_worker_provider_id); | |
| 147 | 152 |
| 148 // See NavigationHandle for a description of those member variables. | 153 // See NavigationHandle for a description of those member variables. |
| 149 GURL url_; | 154 GURL url_; |
| 150 const bool is_main_frame_; | 155 const bool is_main_frame_; |
| 151 bool is_post_; | 156 bool is_post_; |
| 152 Referrer sanitized_referrer_; | 157 Referrer sanitized_referrer_; |
| 153 bool has_user_gesture_; | 158 bool has_user_gesture_; |
| 154 ui::PageTransition transition_; | 159 ui::PageTransition transition_; |
| 155 bool is_external_protocol_; | 160 bool is_external_protocol_; |
| 156 net::Error net_error_code_; | 161 net::Error net_error_code_; |
| 157 RenderFrameHostImpl* render_frame_host_; | 162 RenderFrameHostImpl* render_frame_host_; |
| 158 bool is_same_page_; | 163 bool is_same_page_; |
| 159 | 164 |
| 160 // The state the navigation is in. | 165 // The state the navigation is in. |
| 161 State state_; | 166 State state_; |
| 162 | 167 |
| 163 // Whether the navigation is in the middle of a transfer. Set to false when | 168 // Whether the navigation is in the middle of a transfer. Set to false when |
| 164 // the DidStartProvisionalLoad is received from the new renderer. | 169 // the DidStartProvisionalLoad is received from the new renderer. |
| 165 bool is_transferring_; | 170 bool is_transferring_; |
| 166 | 171 |
| 167 // The delegate that should be notified about events related to this | 172 // The delegate that should be notified about events related to this |
| 168 // navigation. | 173 // navigation. |
| 169 NavigatorDelegate* delegate_; | 174 NavigatorDelegate* delegate_; |
| 170 | 175 |
| 171 // A list of Throttles registered for this navigation. | 176 // A list of Throttles registered for this navigation. |
| 172 ScopedVector<NavigationThrottle> throttles_; | 177 ScopedVector<NavigationThrottle> throttles_; |
| 173 | 178 |
| 179 // PlzNavigate | |
| 180 // The ServiceWorkerProviderHost ID used for navigations. | |
| 181 // Set to kInvalidServiceWorkerProviderId for sandboxed frames and sync loads. | |
| 182 // Set to kInvalidServiceWorkerProviderId for current navigation. | |
|
clamy
2015/10/02 10:34:44
I don't understand the last comment.
Fabrice (no longer in Chrome)
2015/10/02 16:37:34
I clarified it is unused. Since it is unused, it d
| |
| 183 int service_worker_provider_id_; | |
| 184 | |
| 185 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; | |
| 186 | |
| 174 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 187 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 175 }; | 188 }; |
| 176 | 189 |
| 177 } // namespace content | 190 } // namespace content |
| 178 | 191 |
| 179 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 192 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |