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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // PlzNavigate: This value always comes from the CommonNavigationParams | 84 // PlzNavigate: This value always comes from the CommonNavigationParams |
85 // associated with this navigation. | 85 // associated with this navigation. |
86 static std::unique_ptr<NavigationHandleImpl> Create( | 86 static std::unique_ptr<NavigationHandleImpl> Create( |
87 const GURL& url, | 87 const GURL& url, |
88 const std::vector<GURL>& redirect_chain, | 88 const std::vector<GURL>& redirect_chain, |
89 FrameTreeNode* frame_tree_node, | 89 FrameTreeNode* frame_tree_node, |
90 bool is_renderer_initiated, | 90 bool is_renderer_initiated, |
91 bool is_same_page, | 91 bool is_same_page, |
92 const base::TimeTicks& navigation_start, | 92 const base::TimeTicks& navigation_start, |
93 int pending_nav_entry_id, | 93 int pending_nav_entry_id, |
94 bool started_from_context_menu); | 94 bool started_from_context_menu, |
| 95 CSPDisposition should_check_main_world_csp); |
95 ~NavigationHandleImpl() override; | 96 ~NavigationHandleImpl() override; |
96 | 97 |
97 // Used to track the state the navigation is currently in. | 98 // Used to track the state the navigation is currently in. |
98 enum State { | 99 enum State { |
99 INITIAL = 0, | 100 INITIAL = 0, |
100 WILL_SEND_REQUEST, | 101 WILL_SEND_REQUEST, |
101 DEFERRING_START, | 102 DEFERRING_START, |
102 WILL_REDIRECT_REQUEST, | 103 WILL_REDIRECT_REQUEST, |
103 DEFERRING_REDIRECT, | 104 DEFERRING_REDIRECT, |
104 CANCELING, | 105 CANCELING, |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 353 |
353 void set_complete_callback_for_testing( | 354 void set_complete_callback_for_testing( |
354 const ThrottleChecksFinishedCallback& callback) { | 355 const ThrottleChecksFinishedCallback& callback) { |
355 complete_callback_for_testing_ = callback; | 356 complete_callback_for_testing_ = callback; |
356 } | 357 } |
357 | 358 |
358 void set_base_url_for_data_url(const GURL& url) { | 359 void set_base_url_for_data_url(const GURL& url) { |
359 base_url_for_data_url_ = url; | 360 base_url_for_data_url_ = url; |
360 } | 361 } |
361 | 362 |
| 363 CSPDisposition should_check_main_world_csp() const { |
| 364 return should_check_main_world_csp_; |
| 365 } |
| 366 |
362 private: | 367 private: |
363 friend class NavigationHandleImplTest; | 368 friend class NavigationHandleImplTest; |
364 | 369 |
365 NavigationHandleImpl(const GURL& url, | 370 NavigationHandleImpl(const GURL& url, |
366 const std::vector<GURL>& redirect_chain, | 371 const std::vector<GURL>& redirect_chain, |
367 FrameTreeNode* frame_tree_node, | 372 FrameTreeNode* frame_tree_node, |
368 bool is_renderer_initiated, | 373 bool is_renderer_initiated, |
369 bool is_same_page, | 374 bool is_same_page, |
370 const base::TimeTicks& navigation_start, | 375 const base::TimeTicks& navigation_start, |
371 int pending_nav_entry_id, | 376 int pending_nav_entry_id, |
372 bool started_from_context_menu); | 377 bool started_from_context_menu, |
| 378 CSPDisposition should_check_main_world_csp); |
373 | 379 |
374 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 380 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
375 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 381 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
376 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 382 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
377 | 383 |
378 // Called when WillProcessResponse checks are done, to find the final | 384 // Called when WillProcessResponse checks are done, to find the final |
379 // RenderFrameHost for the navigation. Checks whether the navigation should be | 385 // RenderFrameHost for the navigation. Checks whether the navigation should be |
380 // transferred. Returns false if the transfer attempt results in the | 386 // transferred. Returns false if the transfer attempt results in the |
381 // destruction of this NavigationHandle and the navigation should no longer | 387 // destruction of this NavigationHandle and the navigation should no longer |
382 // proceed. This can happen when the RenderFrameHostManager determines a | 388 // proceed. This can happen when the RenderFrameHostManager determines a |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 524 |
519 GURL searchable_form_url_; | 525 GURL searchable_form_url_; |
520 std::string searchable_form_encoding_; | 526 std::string searchable_form_encoding_; |
521 | 527 |
522 GURL previous_url_; | 528 GURL previous_url_; |
523 GURL base_url_; | 529 GURL base_url_; |
524 GURL base_url_for_data_url_; | 530 GURL base_url_for_data_url_; |
525 net::HostPortPair socket_address_; | 531 net::HostPortPair socket_address_; |
526 NavigationType navigation_type_; | 532 NavigationType navigation_type_; |
527 | 533 |
| 534 // Whether or not the CSP of the main world should apply. When the navigation |
| 535 // is initiated from a content script in an isolated world, the CSP defined |
| 536 // in the main world should not apply. |
| 537 CSPDisposition should_check_main_world_csp_; |
| 538 |
528 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 539 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
529 | 540 |
530 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 541 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
531 }; | 542 }; |
532 | 543 |
533 } // namespace content | 544 } // namespace content |
534 | 545 |
535 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 546 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |