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

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: PlzNavigate: Enforce 'form-action' CSP on the browser-side. 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 bool should_bypass_main_world_csp); 95 bool should_bypass_main_world_csp,
96 bool is_form_submission);
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void CallDidCommitNavigationForTesting(const GURL& url) override; 145 void CallDidCommitNavigationForTesting(const GURL& url) override;
145 bool WasStartedFromContextMenu() const override; 146 bool WasStartedFromContextMenu() const override;
146 const GURL& GetSearchableFormURL() override; 147 const GURL& GetSearchableFormURL() override;
147 const std::string& GetSearchableFormEncoding() override; 148 const std::string& GetSearchableFormEncoding() override;
148 ReloadType GetReloadType() override; 149 ReloadType GetReloadType() override;
149 const GlobalRequestID& GetGlobalRequestID() override; 150 const GlobalRequestID& GetGlobalRequestID() override;
150 151
151 NavigationData* GetNavigationData() override; 152 NavigationData* GetNavigationData() override;
152 bool should_bypass_main_world_csp() const; 153 bool should_bypass_main_world_csp() const;
153 154
155 // Whether or not the navigation has been initiated by a form submission. It
156 // is currently not available when PlzNavigate is disabled.
157 bool is_form_submission() const;
158
154 // The NavigatorDelegate to notify/query for various navigation events. 159 // The NavigatorDelegate to notify/query for various navigation events.
155 // Normally this is the WebContents, except if this NavigationHandle was 160 // Normally this is the WebContents, except if this NavigationHandle was
156 // created during a navigation to an interstitial page. In this case it will 161 // created during a navigation to an interstitial page. In this case it will
157 // be the InterstitialPage itself. 162 // be the InterstitialPage itself.
158 // 163 //
159 // Note: due to the interstitial navigation case, all calls that can possibly 164 // Note: due to the interstitial navigation case, all calls that can possibly
160 // expose the NavigationHandle to code outside of content/ MUST go though the 165 // expose the NavigationHandle to code outside of content/ MUST go though the
161 // NavigatorDelegate. In particular, the ContentBrowserClient should not be 166 // NavigatorDelegate. In particular, the ContentBrowserClient should not be
162 // called directly form the NavigationHandle code. Thus, these calls will not 167 // called directly form the NavigationHandle code. Thus, these calls will not
163 // expose the NavigationHandle when navigating to an InterstialPage. 168 // expose the NavigationHandle when navigating to an InterstialPage.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
357 bool should_bypass_main_world_csp); 362 bool should_bypass_main_world_csp,
363 bool is_form_submission);
358 364
359 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 365 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
360 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 366 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
361 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 367 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
362 368
363 // Called when WillProcessResponse checks are done, to find the final 369 // Called when WillProcessResponse checks are done, to find the final
364 // RenderFrameHost for the navigation. Checks whether the navigation should be 370 // RenderFrameHost for the navigation. Checks whether the navigation should be
365 // transferred. Returns false if the transfer attempt results in the 371 // transferred. Returns false if the transfer attempt results in the
366 // destruction of this NavigationHandle and the navigation should no longer 372 // destruction of this NavigationHandle and the navigation should no longer
367 // proceed. This can happen when the RenderFrameHostManager determines a 373 // proceed. This can happen when the RenderFrameHostManager determines a
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 GURL previous_url_; 502 GURL previous_url_;
497 GURL base_url_; 503 GURL base_url_;
498 net::HostPortPair socket_address_; 504 net::HostPortPair socket_address_;
499 NavigationType navigation_type_; 505 NavigationType navigation_type_;
500 506
501 // Whether or not the navigation has been issued by an isolated world, for 507 // Whether or not the navigation has been issued by an isolated world, for
502 // instance from a chrome extension. When true, the navigation should not be 508 // instance from a chrome extension. When true, the navigation should not be
503 // blocked by the parent frame's CSP. 509 // blocked by the parent frame's CSP.
504 bool should_bypass_main_world_csp_; 510 bool should_bypass_main_world_csp_;
505 511
512 // Whether or not the navigation results from the submission of a form.
513 bool is_form_submission_;
514
506 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 515 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
507 516
508 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 517 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
509 }; 518 };
510 519
511 } // namespace content 520 } // namespace content
512 521
513 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 522 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698