Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 2689653003: PlzNavigate: Enforce 'form-action' CSP on the browser-side. (Closed)
Patch Set: Rebase. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 CSPDisposition should_check_main_world_csp,
96 bool is_form_submission);
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ReloadType GetReloadType() override; 165 ReloadType GetReloadType() override;
165 RestoreType GetRestoreType() override; 166 RestoreType GetRestoreType() override;
166 const GURL& GetBaseURLForDataURL() override; 167 const GURL& GetBaseURLForDataURL() override;
167 const GlobalRequestID& GetGlobalRequestID() override; 168 const GlobalRequestID& GetGlobalRequestID() override;
168 169
169 NavigationData* GetNavigationData() override; 170 NavigationData* GetNavigationData() override;
170 171
171 // Used in tests. 172 // Used in tests.
172 State state_for_testing() const { return state_; } 173 State state_for_testing() const { return state_; }
173 174
175 // Whether or not the navigation has been initiated by a form submission.
176 // TODO(arthursonzogni): This value is correct only when PlzNavigate is
177 // enabled. Make it work in both modes.
178 bool is_form_submission() const { return is_form_submission_; }
179
174 // The NavigatorDelegate to notify/query for various navigation events. 180 // The NavigatorDelegate to notify/query for various navigation events.
175 // Normally this is the WebContents, except if this NavigationHandle was 181 // Normally this is the WebContents, except if this NavigationHandle was
176 // created during a navigation to an interstitial page. In this case it will 182 // created during a navigation to an interstitial page. In this case it will
177 // be the InterstitialPage itself. 183 // be the InterstitialPage itself.
178 // 184 //
179 // Note: due to the interstitial navigation case, all calls that can possibly 185 // Note: due to the interstitial navigation case, all calls that can possibly
180 // expose the NavigationHandle to code outside of content/ MUST go though the 186 // expose the NavigationHandle to code outside of content/ MUST go though the
181 // NavigatorDelegate. In particular, the ContentBrowserClient should not be 187 // NavigatorDelegate. In particular, the ContentBrowserClient should not be
182 // called directly form the NavigationHandle code. Thus, these calls will not 188 // called directly form the NavigationHandle code. Thus, these calls will not
183 // expose the NavigationHandle when navigating to an InterstialPage. 189 // expose the NavigationHandle when navigating to an InterstialPage.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 friend class NavigationHandleImplTest; 374 friend class NavigationHandleImplTest;
369 375
370 NavigationHandleImpl(const GURL& url, 376 NavigationHandleImpl(const GURL& url,
371 const std::vector<GURL>& redirect_chain, 377 const std::vector<GURL>& redirect_chain,
372 FrameTreeNode* frame_tree_node, 378 FrameTreeNode* frame_tree_node,
373 bool is_renderer_initiated, 379 bool is_renderer_initiated,
374 bool is_same_page, 380 bool is_same_page,
375 const base::TimeTicks& navigation_start, 381 const base::TimeTicks& navigation_start,
376 int pending_nav_entry_id, 382 int pending_nav_entry_id,
377 bool started_from_context_menu, 383 bool started_from_context_menu,
378 CSPDisposition should_check_main_world_csp); 384 CSPDisposition should_check_main_world_csp,
385 bool is_form_submission);
379 386
380 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 387 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
381 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 388 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
382 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 389 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
383 390
384 // Called when WillProcessResponse checks are done, to find the final 391 // Called when WillProcessResponse checks are done, to find the final
385 // RenderFrameHost for the navigation. Checks whether the navigation should be 392 // RenderFrameHost for the navigation. Checks whether the navigation should be
386 // transferred. Returns false if the transfer attempt results in the 393 // transferred. Returns false if the transfer attempt results in the
387 // destruction of this NavigationHandle and the navigation should no longer 394 // destruction of this NavigationHandle and the navigation should no longer
388 // proceed. This can happen when the RenderFrameHostManager determines a 395 // proceed. This can happen when the RenderFrameHostManager determines a
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 GURL base_url_; 536 GURL base_url_;
530 GURL base_url_for_data_url_; 537 GURL base_url_for_data_url_;
531 net::HostPortPair socket_address_; 538 net::HostPortPair socket_address_;
532 NavigationType navigation_type_; 539 NavigationType navigation_type_;
533 540
534 // Whether or not the CSP of the main world should apply. When the navigation 541 // 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 542 // is initiated from a content script in an isolated world, the CSP defined
536 // in the main world should not apply. 543 // in the main world should not apply.
537 CSPDisposition should_check_main_world_csp_; 544 CSPDisposition should_check_main_world_csp_;
538 545
546 // Whether or not the navigation results from the submission of a form.
547 bool is_form_submission_;
548
539 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 549 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
540 550
541 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 551 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
542 }; 552 };
543 553
544 } // namespace content 554 } // namespace content
545 555
546 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 556 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/interstitial_page_navigator_impl.cc ('k') | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698