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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Add TODO in the FrameLoader. 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // PlzNavigate: This value always comes from the CommonNavigationParams 84 // PlzNavigate: This value always comes from the CommonNavigationParams
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 ~NavigationHandleImpl() override; 96 ~NavigationHandleImpl() override;
96 97
97 // NavigationHandle implementation: 98 // NavigationHandle implementation:
98 const GURL& GetURL() override; 99 const GURL& GetURL() override;
99 SiteInstance* GetStartingSiteInstance() override; 100 SiteInstance* GetStartingSiteInstance() override;
100 bool IsInMainFrame() override; 101 bool IsInMainFrame() override;
101 bool IsParentMainFrame() override; 102 bool IsParentMainFrame() override;
102 bool IsRendererInitiated() override; 103 bool IsRendererInitiated() override;
103 bool WasServerRedirect() override; 104 bool WasServerRedirect() override;
104 const std::vector<GURL>& GetRedirectChain() override; 105 const std::vector<GURL>& GetRedirectChain() override;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 RenderFrameHost* render_frame_host, 142 RenderFrameHost* render_frame_host,
142 const std::string& raw_response_header) override; 143 const std::string& raw_response_header) override;
143 void CallDidCommitNavigationForTesting(const GURL& url) override; 144 void CallDidCommitNavigationForTesting(const GURL& url) override;
144 bool WasStartedFromContextMenu() const override; 145 bool WasStartedFromContextMenu() const override;
145 const GURL& GetSearchableFormURL() override; 146 const GURL& GetSearchableFormURL() override;
146 const std::string& GetSearchableFormEncoding() override; 147 const std::string& GetSearchableFormEncoding() override;
147 ReloadType GetReloadType() override; 148 ReloadType GetReloadType() override;
148 const GlobalRequestID& GetGlobalRequestID() override; 149 const GlobalRequestID& GetGlobalRequestID() override;
149 150
150 NavigationData* GetNavigationData() override; 151 NavigationData* GetNavigationData() override;
152 bool should_bypass_main_world_csp() const override;
151 153
152 // The NavigatorDelegate to notify/query for various navigation events. 154 // The NavigatorDelegate to notify/query for various navigation events.
153 // Normally this is the WebContents, except if this NavigationHandle was 155 // Normally this is the WebContents, except if this NavigationHandle was
154 // created during a navigation to an interstitial page. In this case it will 156 // created during a navigation to an interstitial page. In this case it will
155 // be the InterstitialPage itself. 157 // be the InterstitialPage itself.
156 // 158 //
157 // Note: due to the interstitial navigation case, all calls that can possibly 159 // Note: due to the interstitial navigation case, all calls that can possibly
158 // expose the NavigationHandle to code outside of content/ MUST go though the 160 // expose the NavigationHandle to code outside of content/ MUST go though the
159 // NavigatorDelegate. In particular, the ContentBrowserClient should not be 161 // NavigatorDelegate. In particular, the ContentBrowserClient should not be
160 // called directly form the NavigationHandle code. Thus, these calls will not 162 // called directly form the NavigationHandle code. Thus, these calls will not
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 DID_COMMIT_ERROR_PAGE, 346 DID_COMMIT_ERROR_PAGE,
345 }; 347 };
346 348
347 NavigationHandleImpl(const GURL& url, 349 NavigationHandleImpl(const GURL& url,
348 const std::vector<GURL>& redirect_chain, 350 const std::vector<GURL>& redirect_chain,
349 FrameTreeNode* frame_tree_node, 351 FrameTreeNode* frame_tree_node,
350 bool is_renderer_initiated, 352 bool is_renderer_initiated,
351 bool is_same_page, 353 bool is_same_page,
352 const base::TimeTicks& navigation_start, 354 const base::TimeTicks& navigation_start,
353 int pending_nav_entry_id, 355 int pending_nav_entry_id,
354 bool started_from_context_menu); 356 bool started_from_context_menu,
357 bool should_bypass_main_world_csp);
355 358
356 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 359 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
357 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 360 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
358 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 361 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
359 362
360 // Called when WillProcessResponse checks are done, to find the final 363 // Called when WillProcessResponse checks are done, to find the final
361 // RenderFrameHost for the navigation. Checks whether the navigation should be 364 // RenderFrameHost for the navigation. Checks whether the navigation should be
362 // transferred. Returns false if the transfer attempt results in the 365 // transferred. Returns false if the transfer attempt results in the
363 // destruction of this NavigationHandle and the navigation should no longer 366 // destruction of this NavigationHandle and the navigation should no longer
364 // proceed. This can happen when the RenderFrameHostManager determines a 367 // proceed. This can happen when the RenderFrameHostManager determines a
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 ReloadType reload_type_; 486 ReloadType reload_type_;
484 487
485 GURL searchable_form_url_; 488 GURL searchable_form_url_;
486 std::string searchable_form_encoding_; 489 std::string searchable_form_encoding_;
487 490
488 GURL previous_url_; 491 GURL previous_url_;
489 GURL base_url_; 492 GURL base_url_;
490 net::HostPortPair socket_address_; 493 net::HostPortPair socket_address_;
491 NavigationType navigation_type_; 494 NavigationType navigation_type_;
492 495
496 // Whether or not the navigation has been issued by a content script or an
nasko 2017/02/15 21:28:44 nit: content script is an extensions system detail
arthursonzogni 2017/02/16 17:32:41 Okay, I don't know exactly know what is a content
497 // isolated world, for instance from a chrome extension. When true, the
498 // navigation should not be blocked by the parent frame's CSP.
499 bool should_bypass_main_world_csp_;
500
493 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 501 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
494 502
495 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 503 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
496 }; 504 };
497 505
498 } // namespace content 506 } // namespace content
499 507
500 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 508 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698