| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 349 void set_complete_callback_for_testing( | 350 void set_complete_callback_for_testing( |
| 350 const ThrottleChecksFinishedCallback& callback) { | 351 const ThrottleChecksFinishedCallback& callback) { |
| 351 complete_callback_for_testing_ = callback; | 352 complete_callback_for_testing_ = callback; |
| 352 } | 353 } |
| 353 | 354 |
| 355 bool should_bypass_main_world_csp() const { |
| 356 return should_bypass_main_world_csp_; |
| 357 } |
| 358 |
| 354 private: | 359 private: |
| 355 friend class NavigationHandleImplTest; | 360 friend class NavigationHandleImplTest; |
| 356 | 361 |
| 357 NavigationHandleImpl(const GURL& url, | 362 NavigationHandleImpl(const GURL& url, |
| 358 const std::vector<GURL>& redirect_chain, | 363 const std::vector<GURL>& redirect_chain, |
| 359 FrameTreeNode* frame_tree_node, | 364 FrameTreeNode* frame_tree_node, |
| 360 bool is_renderer_initiated, | 365 bool is_renderer_initiated, |
| 361 bool is_same_page, | 366 bool is_same_page, |
| 362 const base::TimeTicks& navigation_start, | 367 const base::TimeTicks& navigation_start, |
| 363 int pending_nav_entry_id, | 368 int pending_nav_entry_id, |
| 364 bool started_from_context_menu); | 369 bool started_from_context_menu, |
| 370 bool should_bypass_main_world_csp); |
| 365 | 371 |
| 366 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 372 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
| 367 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 373 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
| 368 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 374 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
| 369 | 375 |
| 370 // Called when WillProcessResponse checks are done, to find the final | 376 // Called when WillProcessResponse checks are done, to find the final |
| 371 // RenderFrameHost for the navigation. Checks whether the navigation should be | 377 // RenderFrameHost for the navigation. Checks whether the navigation should be |
| 372 // transferred. Returns false if the transfer attempt results in the | 378 // transferred. Returns false if the transfer attempt results in the |
| 373 // destruction of this NavigationHandle and the navigation should no longer | 379 // destruction of this NavigationHandle and the navigation should no longer |
| 374 // proceed. This can happen when the RenderFrameHostManager determines a | 380 // proceed. This can happen when the RenderFrameHostManager determines a |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 RestoreType restore_type_; | 514 RestoreType restore_type_; |
| 509 | 515 |
| 510 GURL searchable_form_url_; | 516 GURL searchable_form_url_; |
| 511 std::string searchable_form_encoding_; | 517 std::string searchable_form_encoding_; |
| 512 | 518 |
| 513 GURL previous_url_; | 519 GURL previous_url_; |
| 514 GURL base_url_; | 520 GURL base_url_; |
| 515 net::HostPortPair socket_address_; | 521 net::HostPortPair socket_address_; |
| 516 NavigationType navigation_type_; | 522 NavigationType navigation_type_; |
| 517 | 523 |
| 524 // Whether or not the navigation has been issued by an isolated world, for |
| 525 // instance from a chrome extension. When true, the navigation should not be |
| 526 // blocked by the parent frame's CSP. |
| 527 bool should_bypass_main_world_csp_; |
| 528 |
| 518 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 529 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
| 519 | 530 |
| 520 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 531 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
| 521 }; | 532 }; |
| 522 | 533 |
| 523 } // namespace content | 534 } // namespace content |
| 524 | 535 |
| 525 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 536 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
| OLD | NEW |