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 <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/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "content/browser/frame_host/frame_tree_node.h" | 15 #include "content/browser/frame_host/frame_tree_node.h" |
| 16 #include "content/browser/frame_host/render_frame_host_impl.h" | 16 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "content/public/browser/navigation_data.h" | |
| 18 #include "content/public/browser/navigation_throttle.h" | 19 #include "content/public/browser/navigation_throttle.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 struct FrameHostMsg_DidCommitProvisionalLoad_Params; | 22 struct FrameHostMsg_DidCommitProvisionalLoad_Params; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 | 25 |
| 25 class NavigatorDelegate; | 26 class NavigatorDelegate; |
| 26 class ServiceWorkerContextWrapper; | 27 class ServiceWorkerContextWrapper; |
| 27 class ServiceWorkerNavigationHandle; | 28 class ServiceWorkerNavigationHandle; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 bool is_post, | 105 bool is_post, |
| 105 const Referrer& sanitized_referrer, | 106 const Referrer& sanitized_referrer, |
| 106 bool has_user_gesture, | 107 bool has_user_gesture, |
| 107 ui::PageTransition transition, | 108 ui::PageTransition transition, |
| 108 bool is_external_protocol) override; | 109 bool is_external_protocol) override; |
| 109 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( | 110 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( |
| 110 const GURL& new_url, | 111 const GURL& new_url, |
| 111 bool new_method_is_post, | 112 bool new_method_is_post, |
| 112 const GURL& new_referrer_url, | 113 const GURL& new_referrer_url, |
| 113 bool new_is_external_protocol) override; | 114 bool new_is_external_protocol) override; |
| 115 NavigationData* GetNavigationData() override; | |
| 114 | 116 |
| 115 NavigatorDelegate* GetDelegate() const; | 117 NavigatorDelegate* GetDelegate() const; |
| 116 | 118 |
| 117 // Returns the response headers for the request or nullptr if there are none. | 119 // Returns the response headers for the request or nullptr if there are none. |
| 118 // This should only be accessed after a redirect was encountered or after the | 120 // This should only be accessed after a redirect was encountered or after the |
| 119 // navigation is ready to commit. The headers returned should not be modified, | 121 // navigation is ready to commit. The headers returned should not be modified, |
| 120 // as modifications will not be reflected in the network stack. | 122 // as modifications will not be reflected in the network stack. |
| 121 const net::HttpResponseHeaders* GetResponseHeaders(); | 123 const net::HttpResponseHeaders* GetResponseHeaders(); |
| 122 | 124 |
| 123 // Get the unique id from the NavigationEntry associated with this | 125 // Get the unique id from the NavigationEntry associated with this |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 // delegate. | 206 // delegate. |
| 205 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); | 207 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); |
| 206 | 208 |
| 207 // Called when the navigation was committed in |render_frame_host|. This will | 209 // Called when the navigation was committed in |render_frame_host|. This will |
| 208 // update the |state_|. | 210 // update the |state_|. |
| 209 void DidCommitNavigation( | 211 void DidCommitNavigation( |
| 210 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, | 212 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, |
| 211 bool same_page, | 213 bool same_page, |
| 212 RenderFrameHostImpl* render_frame_host); | 214 RenderFrameHostImpl* render_frame_host); |
| 213 | 215 |
| 216 // Called during commit. Takes ownership of the embedder's NavigationData | |
| 217 // instance. This NavigationData may have been cloned prior to being added | |
| 218 // here. | |
| 219 void SetNavigationData(std::unique_ptr<NavigationData> navigation_data) { | |
| 220 navigation_data_ = std::move(navigation_data); | |
|
tbansal1
2016/04/27 23:44:48
This implementation should go in .cc file. In gene
| |
| 221 } | |
| 222 | |
| 214 private: | 223 private: |
| 215 friend class NavigationHandleImplTest; | 224 friend class NavigationHandleImplTest; |
| 216 | 225 |
| 217 // Used to track the state the navigation is currently in. | 226 // Used to track the state the navigation is currently in. |
| 218 enum State { | 227 enum State { |
| 219 INITIAL = 0, | 228 INITIAL = 0, |
| 220 WILL_SEND_REQUEST, | 229 WILL_SEND_REQUEST, |
| 221 DEFERRING_START, | 230 DEFERRING_START, |
| 222 WILL_REDIRECT_REQUEST, | 231 WILL_REDIRECT_REQUEST, |
| 223 DEFERRING_REDIRECT, | 232 DEFERRING_REDIRECT, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 int pending_nav_entry_id_; | 296 int pending_nav_entry_id_; |
| 288 | 297 |
| 289 // This callback will be run when all throttle checks have been performed. | 298 // This callback will be run when all throttle checks have been performed. |
| 290 ThrottleChecksFinishedCallback complete_callback_; | 299 ThrottleChecksFinishedCallback complete_callback_; |
| 291 | 300 |
| 292 // PlzNavigate | 301 // PlzNavigate |
| 293 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 302 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 294 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 303 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 295 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 304 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 296 | 305 |
| 306 // Embedder data tied to this navigation. | |
| 307 std::unique_ptr<NavigationData> navigation_data_; | |
| 308 | |
| 297 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 309 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 298 }; | 310 }; |
| 299 | 311 |
| 300 } // namespace content | 312 } // namespace content |
| 301 | 313 |
| 302 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 314 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |