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 // NavigationHandle implementation: | 99 // NavigationHandle implementation: |
99 const GURL& GetURL() override; | 100 const GURL& GetURL() override; |
100 SiteInstance* GetStartingSiteInstance() override; | 101 SiteInstance* GetStartingSiteInstance() override; |
101 bool IsInMainFrame() override; | 102 bool IsInMainFrame() override; |
102 bool IsParentMainFrame() override; | 103 bool IsParentMainFrame() override; |
103 bool IsRendererInitiated() override; | 104 bool IsRendererInitiated() override; |
104 bool WasServerRedirect() override; | 105 bool WasServerRedirect() override; |
105 const std::vector<GURL>& GetRedirectChain() override; | 106 const std::vector<GURL>& GetRedirectChain() override; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 NavigationType navigation_type() { | 322 NavigationType navigation_type() { |
322 DCHECK_GE(state_, DID_COMMIT); | 323 DCHECK_GE(state_, DID_COMMIT); |
323 return navigation_type_; | 324 return navigation_type_; |
324 } | 325 } |
325 | 326 |
326 void set_response_headers_for_testing( | 327 void set_response_headers_for_testing( |
327 scoped_refptr<net::HttpResponseHeaders> response_headers) { | 328 scoped_refptr<net::HttpResponseHeaders> response_headers) { |
328 response_headers_ = response_headers; | 329 response_headers_ = response_headers; |
329 } | 330 } |
330 | 331 |
| 332 bool should_bypass_main_world_csp() const { |
| 333 return should_bypass_main_world_csp_; |
| 334 } |
| 335 |
331 private: | 336 private: |
332 friend class NavigationHandleImplTest; | 337 friend class NavigationHandleImplTest; |
333 | 338 |
334 // Used to track the state the navigation is currently in. | 339 // Used to track the state the navigation is currently in. |
335 enum State { | 340 enum State { |
336 INITIAL = 0, | 341 INITIAL = 0, |
337 WILL_SEND_REQUEST, | 342 WILL_SEND_REQUEST, |
338 DEFERRING_START, | 343 DEFERRING_START, |
339 WILL_REDIRECT_REQUEST, | 344 WILL_REDIRECT_REQUEST, |
340 DEFERRING_REDIRECT, | 345 DEFERRING_REDIRECT, |
341 CANCELING, | 346 CANCELING, |
342 WILL_PROCESS_RESPONSE, | 347 WILL_PROCESS_RESPONSE, |
343 DEFERRING_RESPONSE, | 348 DEFERRING_RESPONSE, |
344 READY_TO_COMMIT, | 349 READY_TO_COMMIT, |
345 DID_COMMIT, | 350 DID_COMMIT, |
346 DID_COMMIT_ERROR_PAGE, | 351 DID_COMMIT_ERROR_PAGE, |
347 }; | 352 }; |
348 | 353 |
349 NavigationHandleImpl(const GURL& url, | 354 NavigationHandleImpl(const GURL& url, |
350 const std::vector<GURL>& redirect_chain, | 355 const std::vector<GURL>& redirect_chain, |
351 FrameTreeNode* frame_tree_node, | 356 FrameTreeNode* frame_tree_node, |
352 bool is_renderer_initiated, | 357 bool is_renderer_initiated, |
353 bool is_same_page, | 358 bool is_same_page, |
354 const base::TimeTicks& navigation_start, | 359 const base::TimeTicks& navigation_start, |
355 int pending_nav_entry_id, | 360 int pending_nav_entry_id, |
356 bool started_from_context_menu); | 361 bool started_from_context_menu, |
| 362 bool should_bypass_main_world_csp); |
357 | 363 |
358 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); | 364 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); |
359 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); | 365 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); |
360 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); | 366 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); |
361 | 367 |
362 // Called when WillProcessResponse checks are done, to find the final | 368 // Called when WillProcessResponse checks are done, to find the final |
363 // RenderFrameHost for the navigation. Checks whether the navigation should be | 369 // RenderFrameHost for the navigation. Checks whether the navigation should be |
364 // transferred. Returns false if the transfer attempt results in the | 370 // transferred. Returns false if the transfer attempt results in the |
365 // destruction of this NavigationHandle and the navigation should no longer | 371 // destruction of this NavigationHandle and the navigation should no longer |
366 // proceed. This can happen when the RenderFrameHostManager determines a | 372 // proceed. This can happen when the RenderFrameHostManager determines a |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 RestoreType restore_type_; | 499 RestoreType restore_type_; |
494 | 500 |
495 GURL searchable_form_url_; | 501 GURL searchable_form_url_; |
496 std::string searchable_form_encoding_; | 502 std::string searchable_form_encoding_; |
497 | 503 |
498 GURL previous_url_; | 504 GURL previous_url_; |
499 GURL base_url_; | 505 GURL base_url_; |
500 net::HostPortPair socket_address_; | 506 net::HostPortPair socket_address_; |
501 NavigationType navigation_type_; | 507 NavigationType navigation_type_; |
502 | 508 |
| 509 // Whether or not the navigation has been issued by an isolated world, for |
| 510 // instance from a chrome extension. When true, the navigation should not be |
| 511 // blocked by the parent frame's CSP. |
| 512 bool should_bypass_main_world_csp_; |
| 513 |
503 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; | 514 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; |
504 | 515 |
505 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); | 516 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); |
506 }; | 517 }; |
507 | 518 |
508 } // namespace content | 519 } // namespace content |
509 | 520 |
510 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ | 521 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ |
OLD | NEW |