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