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

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, 10 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);
97 ~NavigationHandleImpl() override; 98 ~NavigationHandleImpl() override;
98 99
99 // NavigationHandle implementation: 100 // NavigationHandle implementation:
100 const GURL& GetURL() override; 101 const GURL& GetURL() override;
101 SiteInstance* GetStartingSiteInstance() override; 102 SiteInstance* GetStartingSiteInstance() override;
102 bool IsInMainFrame() override; 103 bool IsInMainFrame() override;
103 bool IsParentMainFrame() override; 104 bool IsParentMainFrame() override;
104 bool IsRendererInitiated() override; 105 bool IsRendererInitiated() override;
105 bool WasServerRedirect() override; 106 bool WasServerRedirect() override;
106 const std::vector<GURL>& GetRedirectChain() override; 107 const std::vector<GURL>& GetRedirectChain() override;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void CallDidCommitNavigationForTesting(const GURL& url) override; 146 void CallDidCommitNavigationForTesting(const GURL& url) override;
146 bool WasStartedFromContextMenu() const override; 147 bool WasStartedFromContextMenu() const override;
147 const GURL& GetSearchableFormURL() override; 148 const GURL& GetSearchableFormURL() override;
148 const std::string& GetSearchableFormEncoding() override; 149 const std::string& GetSearchableFormEncoding() override;
149 ReloadType GetReloadType() override; 150 ReloadType GetReloadType() override;
150 RestoreType GetRestoreType() override; 151 RestoreType GetRestoreType() override;
151 const GlobalRequestID& GetGlobalRequestID() override; 152 const GlobalRequestID& GetGlobalRequestID() override;
152 153
153 NavigationData* GetNavigationData() override; 154 NavigationData* GetNavigationData() override;
154 155
156 // Whether or not the navigation has been initiated by a form submission. It
157 // is currently not available when PlzNavigate is disabled.
alexmos 2017/02/28 02:48:47 I'll defer to clamy@ and nasko@ on whether this is
arthursonzogni 2017/03/07 16:25:51 Yes, my plan was to eventually plumb this informat
nasko 2017/03/09 05:35:17 Adding a TODO and keeping it PlzNavigate specific
arthursonzogni 2017/03/10 09:35:37 Okay, but please notice that I will have to remove
158 bool is_form_submission() const;
nasko 2017/03/09 05:35:17 Since this is a simple accessor, it should be inli
arthursonzogni 2017/03/10 09:35:37 Done.
159
155 // The NavigatorDelegate to notify/query for various navigation events. 160 // The NavigatorDelegate to notify/query for various navigation events.
156 // Normally this is the WebContents, except if this NavigationHandle was 161 // Normally this is the WebContents, except if this NavigationHandle was
157 // created during a navigation to an interstitial page. In this case it will 162 // created during a navigation to an interstitial page. In this case it will
158 // be the InterstitialPage itself. 163 // be the InterstitialPage itself.
159 // 164 //
160 // Note: due to the interstitial navigation case, all calls that can possibly 165 // Note: due to the interstitial navigation case, all calls that can possibly
161 // expose the NavigationHandle to code outside of content/ MUST go though the 166 // expose the NavigationHandle to code outside of content/ MUST go though the
162 // NavigatorDelegate. In particular, the ContentBrowserClient should not be 167 // NavigatorDelegate. In particular, the ContentBrowserClient should not be
163 // called directly form the NavigationHandle code. Thus, these calls will not 168 // called directly form the NavigationHandle code. Thus, these calls will not
164 // expose the NavigationHandle when navigating to an InterstialPage. 169 // expose the NavigationHandle when navigating to an InterstialPage.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 }; 357 };
353 358
354 NavigationHandleImpl(const GURL& url, 359 NavigationHandleImpl(const GURL& url,
355 const std::vector<GURL>& redirect_chain, 360 const std::vector<GURL>& redirect_chain,
356 FrameTreeNode* frame_tree_node, 361 FrameTreeNode* frame_tree_node,
357 bool is_renderer_initiated, 362 bool is_renderer_initiated,
358 bool is_same_page, 363 bool is_same_page,
359 const base::TimeTicks& navigation_start, 364 const base::TimeTicks& navigation_start,
360 int pending_nav_entry_id, 365 int pending_nav_entry_id,
361 bool started_from_context_menu, 366 bool started_from_context_menu,
362 bool should_bypass_main_world_csp); 367 bool should_bypass_main_world_csp,
368 bool is_form_submission);
363 369
364 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 370 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
365 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 371 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
366 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 372 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
367 373
368 // Called when WillProcessResponse checks are done, to find the final 374 // Called when WillProcessResponse checks are done, to find the final
369 // RenderFrameHost for the navigation. Checks whether the navigation should be 375 // RenderFrameHost for the navigation. Checks whether the navigation should be
370 // transferred. Returns false if the transfer attempt results in the 376 // transferred. Returns false if the transfer attempt results in the
371 // destruction of this NavigationHandle and the navigation should no longer 377 // destruction of this NavigationHandle and the navigation should no longer
372 // proceed. This can happen when the RenderFrameHostManager determines a 378 // proceed. This can happen when the RenderFrameHostManager determines a
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 GURL previous_url_; 510 GURL previous_url_;
505 GURL base_url_; 511 GURL base_url_;
506 net::HostPortPair socket_address_; 512 net::HostPortPair socket_address_;
507 NavigationType navigation_type_; 513 NavigationType navigation_type_;
508 514
509 // Whether or not the navigation has been issued by an isolated world, for 515 // 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 516 // instance from a chrome extension. When true, the navigation should not be
511 // blocked by the parent frame's CSP. 517 // blocked by the parent frame's CSP.
512 bool should_bypass_main_world_csp_; 518 bool should_bypass_main_world_csp_;
513 519
520 // Whether or not the navigation results from the submission of a form.
521 bool is_form_submission_;
522
514 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 523 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
515 524
516 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 525 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
517 }; 526 };
518 527
519 } // namespace content 528 } // namespace content
520 529
521 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 530 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698