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> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 // the RenderFrameHost still apply. | 62 // the RenderFrameHost still apply. |
| 63 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { | 63 class CONTENT_EXPORT NavigationHandleImpl : public NavigationHandle { |
| 64 public: | 64 public: |
| 65 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks | 65 // |navigation_start| comes from the DidStartProvisionalLoad IPC, which tracks |
| 66 // both renderer-initiated and browser-initiated navigation start. | 66 // both renderer-initiated and browser-initiated navigation start. |
| 67 // PlzNavigate: This value always comes from the CommonNavigationParams | 67 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 68 // associated with this navigation. | 68 // associated with this navigation. |
| 69 static std::unique_ptr<NavigationHandleImpl> Create( | 69 static std::unique_ptr<NavigationHandleImpl> Create( |
| 70 const GURL& url, | 70 const GURL& url, |
| 71 FrameTreeNode* frame_tree_node, | 71 FrameTreeNode* frame_tree_node, |
| 72 bool is_renderer_initiated, | |
| 72 bool is_synchronous, | 73 bool is_synchronous, |
| 73 bool is_srcdoc, | 74 bool is_srcdoc, |
| 74 const base::TimeTicks& navigation_start, | 75 const base::TimeTicks& navigation_start, |
| 75 int pending_nav_entry_id); | 76 int pending_nav_entry_id); |
| 76 ~NavigationHandleImpl() override; | 77 ~NavigationHandleImpl() override; |
| 77 | 78 |
| 78 // NavigationHandle implementation: | 79 // NavigationHandle implementation: |
| 79 const GURL& GetURL() override; | 80 const GURL& GetURL() override; |
| 80 bool IsInMainFrame() override; | 81 bool IsInMainFrame() override; |
| 81 bool IsParentMainFrame() override; | 82 bool IsParentMainFrame() override; |
| 83 bool IsRendererInitiated() override; | |
| 82 bool IsSynchronousNavigation() override; | 84 bool IsSynchronousNavigation() override; |
| 83 bool IsSrcdoc() override; | 85 bool IsSrcdoc() override; |
| 84 bool WasServerRedirect() override; | 86 bool WasServerRedirect() override; |
| 85 int GetFrameTreeNodeId() override; | 87 int GetFrameTreeNodeId() override; |
| 86 int GetParentFrameTreeNodeId() override; | 88 int GetParentFrameTreeNodeId() override; |
| 87 const base::TimeTicks& NavigationStart() override; | 89 const base::TimeTicks& NavigationStart() override; |
| 88 bool IsPost() override; | 90 bool IsPost() override; |
| 89 const Referrer& GetReferrer() override; | 91 const Referrer& GetReferrer() override; |
| 90 bool HasUserGesture() override; | 92 bool HasUserGesture() override; |
| 91 ui::PageTransition GetPageTransition() override; | 93 ui::PageTransition GetPageTransition() override; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 113 bool new_is_external_protocol) override; | 115 bool new_is_external_protocol) 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 |
| 125 // Update whether the current navigation is renderer-initiated. Currently | |
| 126 // required during transfer navigations. | |
| 127 // TODO(creis): Remove this when transfer navigations do not require pending | |
| 128 // entries. See https://crbug.com/495161. | |
|
Charlie Reis
2016/05/11 21:50:03
Yikes, looks like most of this was copied from upd
clamy
2016/05/12 04:04:44
Considering how the NavigationHandle is used (ie f
dominickn
2016/05/12 04:22:58
I did just copy this from the update_entry_id_for_
| |
| 129 void set_is_renderer_initiated(bool is_renderer_initiated) { | |
| 130 is_renderer_initiated_ = is_renderer_initiated; | |
| 131 } | |
| 132 | |
| 123 // Get the unique id from the NavigationEntry associated with this | 133 // Get the unique id from the NavigationEntry associated with this |
| 124 // NavigationHandle. Note that a synchronous, renderer-initiated navigation | 134 // NavigationHandle. Note that a synchronous, renderer-initiated navigation |
| 125 // will not have a NavigationEntry associated with it, and this will return 0. | 135 // will not have a NavigationEntry associated with it, and this will return 0. |
| 126 int pending_nav_entry_id() const { return pending_nav_entry_id_; } | 136 int pending_nav_entry_id() const { return pending_nav_entry_id_; } |
| 127 | 137 |
| 128 // Changes the pending NavigationEntry ID for this handle. This is currently | 138 // Changes the pending NavigationEntry ID for this handle. This is currently |
| 129 // required during transfer navigations. | 139 // required during transfer navigations. |
| 130 // TODO(creis): Remove this when transfer navigations do not require pending | 140 // TODO(creis): Remove this when transfer navigations do not require pending |
| 131 // entries. See https://crbug.com/495161. | 141 // entries. See https://crbug.com/495161. |
| 132 void update_entry_id_for_transfer(int nav_entry_id) { | 142 void update_entry_id_for_transfer(int nav_entry_id) { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 CANCELING, | 234 CANCELING, |
| 225 WILL_PROCESS_RESPONSE, | 235 WILL_PROCESS_RESPONSE, |
| 226 DEFERRING_RESPONSE, | 236 DEFERRING_RESPONSE, |
| 227 READY_TO_COMMIT, | 237 READY_TO_COMMIT, |
| 228 DID_COMMIT, | 238 DID_COMMIT, |
| 229 DID_COMMIT_ERROR_PAGE, | 239 DID_COMMIT_ERROR_PAGE, |
| 230 }; | 240 }; |
| 231 | 241 |
| 232 NavigationHandleImpl(const GURL& url, | 242 NavigationHandleImpl(const GURL& url, |
| 233 FrameTreeNode* frame_tree_node, | 243 FrameTreeNode* frame_tree_node, |
| 244 bool is_renderer_initiated, | |
| 234 bool is_synchronous, | 245 bool is_synchronous, |
| 235 bool is_srcdoc, | 246 bool is_srcdoc, |
| 236 const base::TimeTicks& navigation_start, | 247 const base::TimeTicks& navigation_start, |
| 237 int pending_nav_entry_id); | 248 int pending_nav_entry_id); |
| 238 | 249 |
| 239 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 250 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 240 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 251 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 241 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 252 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 242 | 253 |
| 243 // Helper function to run and reset the |complete_callback_|. This marks the | 254 // Helper function to run and reset the |complete_callback_|. This marks the |
| 244 // end of a round of NavigationThrottleChecks. | 255 // end of a round of NavigationThrottleChecks. |
| 245 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); | 256 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); |
| 246 | 257 |
| 247 // Used in tests. | 258 // Used in tests. |
| 248 State state() const { return state_; } | 259 State state() const { return state_; } |
| 249 | 260 |
| 250 // See NavigationHandle for a description of those member variables. | 261 // See NavigationHandle for a description of those member variables. |
| 251 GURL url_; | 262 GURL url_; |
| 252 Referrer sanitized_referrer_; | 263 Referrer sanitized_referrer_; |
| 253 bool has_user_gesture_; | 264 bool has_user_gesture_; |
| 254 ui::PageTransition transition_; | 265 ui::PageTransition transition_; |
| 255 bool is_external_protocol_; | 266 bool is_external_protocol_; |
| 256 net::Error net_error_code_; | 267 net::Error net_error_code_; |
| 257 RenderFrameHostImpl* render_frame_host_; | 268 RenderFrameHostImpl* render_frame_host_; |
| 269 bool is_renderer_initiated_; | |
|
clamy
2016/05/12 04:04:44
I don't see a good reason why this should change o
dominickn
2016/05/12 04:22:58
Done.
| |
| 258 bool is_same_page_; | 270 bool is_same_page_; |
| 259 const bool is_synchronous_; | 271 const bool is_synchronous_; |
| 260 const bool is_srcdoc_; | 272 const bool is_srcdoc_; |
| 261 bool was_redirected_; | 273 bool was_redirected_; |
| 262 scoped_refptr<net::HttpResponseHeaders> response_headers_; | 274 scoped_refptr<net::HttpResponseHeaders> response_headers_; |
| 263 | 275 |
| 264 // The HTTP method used for the navigation. | 276 // The HTTP method used for the navigation. |
| 265 std::string method_; | 277 std::string method_; |
| 266 | 278 |
| 267 // The state the navigation is in. | 279 // The state the navigation is in. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 293 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a | 305 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a |
| 294 // corresponding ServiceWorkerNetworkProvider is created in the renderer. | 306 // corresponding ServiceWorkerNetworkProvider is created in the renderer. |
| 295 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; | 307 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; |
| 296 | 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 |