| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // PlzNavigate: This value always comes from the CommonNavigationParams | 85 // PlzNavigate: This value always comes from the CommonNavigationParams |
| 86 // associated with this navigation. | 86 // associated with this navigation. |
| 87 static std::unique_ptr<NavigationHandleImpl> Create( | 87 static std::unique_ptr<NavigationHandleImpl> Create( |
| 88 const GURL& url, | 88 const GURL& url, |
| 89 const std::vector<GURL>& redirect_chain, | 89 const std::vector<GURL>& redirect_chain, |
| 90 FrameTreeNode* frame_tree_node, | 90 FrameTreeNode* frame_tree_node, |
| 91 bool is_renderer_initiated, | 91 bool is_renderer_initiated, |
| 92 bool is_same_page, | 92 bool is_same_page, |
| 93 const base::TimeTicks& navigation_start, | 93 const base::TimeTicks& navigation_start, |
| 94 int pending_nav_entry_id, | 94 int pending_nav_entry_id, |
| 95 bool started_from_context_menu); | 95 bool started_from_context_menu, |
| 96 bool should_bypass_main_world_csp); |
| 96 ~NavigationHandleImpl() override; | 97 ~NavigationHandleImpl() override; |
| 97 | 98 |
| 98 // Used to track the state the navigation is currently in. | 99 // Used to track the state the navigation is currently in. |
| 99 enum State { | 100 enum State { |
| 100 INITIAL = 0, | 101 INITIAL = 0, |
| 101 WILL_SEND_REQUEST, | 102 WILL_SEND_REQUEST, |
| 102 DEFERRING_START, | 103 DEFERRING_START, |
| 103 WILL_REDIRECT_REQUEST, | 104 WILL_REDIRECT_REQUEST, |
| 104 DEFERRING_REDIRECT, | 105 DEFERRING_REDIRECT, |
| 105 CANCELING, | 106 CANCELING, |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 NavigationType navigation_type() { | 340 NavigationType navigation_type() { |
| 340 DCHECK_GE(state_, DID_COMMIT); | 341 DCHECK_GE(state_, DID_COMMIT); |
| 341 return navigation_type_; | 342 return navigation_type_; |
| 342 } | 343 } |
| 343 | 344 |
| 344 void set_response_headers_for_testing( | 345 void set_response_headers_for_testing( |
| 345 scoped_refptr<net::HttpResponseHeaders> response_headers) { | 346 scoped_refptr<net::HttpResponseHeaders> response_headers) { |
| 346 response_headers_ = response_headers; | 347 response_headers_ = response_headers; |
| 347 } | 348 } |
| 348 | 349 |
| 350 bool should_bypass_main_world_csp() const { |
| 351 return should_bypass_main_world_csp_; |
| 352 } |
| 353 |
| 349 private: | 354 private: |
| 350 friend class NavigationHandleImplTest; | 355 friend class NavigationHandleImplTest; |
| 351 | 356 |
| 352 NavigationHandleImpl(const GURL& url, | 357 NavigationHandleImpl(const GURL& url, |
| 353 const std::vector<GURL>& redirect_chain, | 358 const std::vector<GURL>& redirect_chain, |
| 354 FrameTreeNode* frame_tree_node, | 359 FrameTreeNode* frame_tree_node, |
| 355 bool is_renderer_initiated, | 360 bool is_renderer_initiated, |
| 356 bool is_same_page, | 361 bool is_same_page, |
| 357 const base::TimeTicks& navigation_start, | 362 const base::TimeTicks& navigation_start, |
| 358 int pending_nav_entry_id, | 363 int pending_nav_entry_id, |
| 359 bool started_from_context_menu); | 364 bool started_from_context_menu, |
| 365 bool should_bypass_main_world_csp); |
| 360 | 366 |
| 361 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 367 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 362 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 368 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 363 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 369 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 364 | 370 |
| 365 // Called when WillProcessResponse checks are done, to find the final | 371 // Called when WillProcessResponse checks are done, to find the final |
| 366 // RenderFrameHost for the navigation. Checks whether the navigation should be | 372 // RenderFrameHost for the navigation. Checks whether the navigation should be |
| 367 // transferred. Returns false if the transfer attempt results in the | 373 // transferred. Returns false if the transfer attempt results in the |
| 368 // destruction of this NavigationHandle and the navigation should no longer | 374 // destruction of this NavigationHandle and the navigation should no longer |
| 369 // proceed. This can happen when the RenderFrameHostManager determines a | 375 // proceed. This can happen when the RenderFrameHostManager determines a |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 RestoreType restore_type_; | 502 RestoreType restore_type_; |
| 497 | 503 |
| 498 GURL searchable_form_url_; | 504 GURL searchable_form_url_; |
| 499 std::string searchable_form_encoding_; | 505 std::string searchable_form_encoding_; |
| 500 | 506 |
| 501 GURL previous_url_; | 507 GURL previous_url_; |
| 502 GURL base_url_; | 508 GURL base_url_; |
| 503 net::HostPortPair socket_address_; | 509 net::HostPortPair socket_address_; |
| 504 NavigationType navigation_type_; | 510 NavigationType navigation_type_; |
| 505 | 511 |
| 512 // Whether or not the navigation has been issued by an isolated world, for |
| 513 // instance from a chrome extension. When true, the navigation should not be |
| 514 // blocked by the parent frame's CSP. |
| 515 bool should_bypass_main_world_csp_; |
| 516 |
| 506 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 517 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 507 | 518 |
| 508 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 519 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 509 }; | 520 }; |
| 510 | 521 |
| 511 } // namespace content | 522 } // namespace content |
| 512 | 523 |
| 513 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 524 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |