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

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: Add TODO. 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool should_bypass_main_world_csp,
97 bool is_form_submission);
nasko 2017/03/16 21:49:47 There are too many booleans on this method. It mig
arthursonzogni 2017/03/17 14:58:25 Yes, I will be happy to fix this in a follow up. S
97 ~NavigationHandleImpl() override; 98 ~NavigationHandleImpl() override;
98 99
99 // Used to track the state the navigation is currently in. 100 // Used to track the state the navigation is currently in.
100 enum State { 101 enum State {
101 INITIAL = 0, 102 INITIAL = 0,
102 WILL_SEND_REQUEST, 103 WILL_SEND_REQUEST,
103 DEFERRING_START, 104 DEFERRING_START,
104 WILL_REDIRECT_REQUEST, 105 WILL_REDIRECT_REQUEST,
105 DEFERRING_REDIRECT, 106 DEFERRING_REDIRECT,
106 CANCELING, 107 CANCELING,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 const std::string& GetSearchableFormEncoding() override; 164 const std::string& GetSearchableFormEncoding() override;
164 ReloadType GetReloadType() override; 165 ReloadType GetReloadType() override;
165 RestoreType GetRestoreType() override; 166 RestoreType GetRestoreType() override;
166 const GlobalRequestID& GetGlobalRequestID() override; 167 const GlobalRequestID& GetGlobalRequestID() override;
167 168
168 NavigationData* GetNavigationData() override; 169 NavigationData* GetNavigationData() override;
169 170
170 // Used in tests. 171 // Used in tests.
171 State state_for_testing() const { return state_; } 172 State state_for_testing() const { return state_; }
172 173
174 // Whether or not the navigation has been initiated by a form submission.
175 // TODO(arthursonzogni) This value is correct only when PlzNavigate is
nasko 2017/03/16 21:49:47 nit: ":" after the TODO().
arthursonzogni 2017/03/17 14:58:25 Done.
176 // enabled. Make it work in both mode.
nasko 2017/03/16 21:49:47 nit: modes.
alexmos 2017/03/16 23:05:36 nit: s/mode/modes/
arthursonzogni 2017/03/17 14:58:25 Done.
arthursonzogni 2017/03/17 14:58:25 Done.
177 bool is_form_submission() const { return is_form_submission_; }
178
173 // The NavigatorDelegate to notify/query for various navigation events. 179 // The NavigatorDelegate to notify/query for various navigation events.
174 // Normally this is the WebContents, except if this NavigationHandle was 180 // Normally this is the WebContents, except if this NavigationHandle was
175 // created during a navigation to an interstitial page. In this case it will 181 // created during a navigation to an interstitial page. In this case it will
176 // be the InterstitialPage itself. 182 // be the InterstitialPage itself.
177 // 183 //
178 // Note: due to the interstitial navigation case, all calls that can possibly 184 // Note: due to the interstitial navigation case, all calls that can possibly
179 // expose the NavigationHandle to code outside of content/ MUST go though the 185 // expose the NavigationHandle to code outside of content/ MUST go though the
180 // NavigatorDelegate. In particular, the ContentBrowserClient should not be 186 // NavigatorDelegate. In particular, the ContentBrowserClient should not be
181 // called directly form the NavigationHandle code. Thus, these calls will not 187 // called directly form the NavigationHandle code. Thus, these calls will not
182 // expose the NavigationHandle when navigating to an InterstialPage. 188 // expose the NavigationHandle when navigating to an InterstialPage.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 friend class NavigationHandleImplTest; 366 friend class NavigationHandleImplTest;
361 367
362 NavigationHandleImpl(const GURL& url, 368 NavigationHandleImpl(const GURL& url,
363 const std::vector<GURL>& redirect_chain, 369 const std::vector<GURL>& redirect_chain,
364 FrameTreeNode* frame_tree_node, 370 FrameTreeNode* frame_tree_node,
365 bool is_renderer_initiated, 371 bool is_renderer_initiated,
366 bool is_same_page, 372 bool is_same_page,
367 const base::TimeTicks& navigation_start, 373 const base::TimeTicks& navigation_start,
368 int pending_nav_entry_id, 374 int pending_nav_entry_id,
369 bool started_from_context_menu, 375 bool started_from_context_menu,
370 bool should_bypass_main_world_csp); 376 bool should_bypass_main_world_csp,
377 bool is_form_submission);
371 378
372 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 379 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
373 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 380 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
374 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 381 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
375 382
376 // Called when WillProcessResponse checks are done, to find the final 383 // Called when WillProcessResponse checks are done, to find the final
377 // RenderFrameHost for the navigation. Checks whether the navigation should be 384 // RenderFrameHost for the navigation. Checks whether the navigation should be
378 // transferred. Returns false if the transfer attempt results in the 385 // transferred. Returns false if the transfer attempt results in the
379 // destruction of this NavigationHandle and the navigation should no longer 386 // destruction of this NavigationHandle and the navigation should no longer
380 // proceed. This can happen when the RenderFrameHostManager determines a 387 // proceed. This can happen when the RenderFrameHostManager determines a
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 GURL previous_url_; 526 GURL previous_url_;
520 GURL base_url_; 527 GURL base_url_;
521 net::HostPortPair socket_address_; 528 net::HostPortPair socket_address_;
522 NavigationType navigation_type_; 529 NavigationType navigation_type_;
523 530
524 // Whether or not the navigation has been issued by an isolated world, for 531 // 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 532 // instance from a chrome extension. When true, the navigation should not be
526 // blocked by the parent frame's CSP. 533 // blocked by the parent frame's CSP.
527 bool should_bypass_main_world_csp_; 534 bool should_bypass_main_world_csp_;
528 535
536 // Whether or not the navigation results from the submission of a form.
537 bool is_form_submission_;
538
529 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 539 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
530 540
531 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 541 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
532 }; 542 };
533 543
534 } // namespace content 544 } // namespace content
535 545
536 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 546 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698