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

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

Issue 1530393003: WIP: Move 'X-Frame-Options' checking to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years 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 "base/callback.h" 10 #include "base/callback.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // NavigationHandle implementation: 72 // NavigationHandle implementation:
73 const GURL& GetURL() override; 73 const GURL& GetURL() override;
74 bool IsInMainFrame() override; 74 bool IsInMainFrame() override;
75 const base::TimeTicks& NavigationStart() override; 75 const base::TimeTicks& NavigationStart() override;
76 bool IsPost() override; 76 bool IsPost() override;
77 const Referrer& GetReferrer() override; 77 const Referrer& GetReferrer() override;
78 bool HasUserGesture() override; 78 bool HasUserGesture() override;
79 ui::PageTransition GetPageTransition() override; 79 ui::PageTransition GetPageTransition() override;
80 bool IsExternalProtocol() override; 80 bool IsExternalProtocol() override;
81 const net::HttpResponseHeaders* GetResponseHeaders() override;
81 net::Error GetNetErrorCode() override; 82 net::Error GetNetErrorCode() override;
82 RenderFrameHostImpl* GetRenderFrameHost() override; 83 RenderFrameHostImpl* GetRenderFrameHost() override;
83 bool IsSamePage() override; 84 bool IsSamePage() override;
84 bool HasCommitted() override; 85 bool HasCommitted() override;
85 bool IsErrorPage() override; 86 bool IsErrorPage() override;
86 void Resume() override; 87 void Resume() override;
87 void CancelDeferredNavigation( 88 void CancelDeferredNavigation(
88 NavigationThrottle::ThrottleCheckResult result) override; 89 NavigationThrottle::ThrottleCheckResult result) override;
89 void RegisterThrottleForTesting( 90 void RegisterThrottleForTesting(
90 scoped_ptr<NavigationThrottle> navigation_throttle) override; 91 scoped_ptr<NavigationThrottle> navigation_throttle) override;
91 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( 92 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting(
92 bool is_post, 93 bool is_post,
93 const Referrer& sanitized_referrer, 94 const Referrer& sanitized_referrer,
94 bool has_user_gesture, 95 bool has_user_gesture,
95 ui::PageTransition transition, 96 ui::PageTransition transition,
96 bool is_external_protocol) override; 97 bool is_external_protocol) override;
97 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( 98 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting(
98 const GURL& new_url, 99 const GURL& new_url,
99 bool new_method_is_post, 100 bool new_method_is_post,
100 const GURL& new_referrer_url, 101 const GURL& new_referrer_url,
101 bool new_is_external_protocol) override; 102 bool new_is_external_protocol) override;
102 103
103 NavigatorDelegate* GetDelegate() const; 104 NavigatorDelegate* GetDelegate() const;
104 105
105 // Returns the response headers for the request. This can only be accessed
106 // after a redirect was encountered or after the the navigation is ready to
107 // commit. It should not be modified, as modifications will not be reflected
108 // in the network stack.
109 const net::HttpResponseHeaders* GetResponseHeaders();
110
111 void set_net_error_code(net::Error net_error_code) { 106 void set_net_error_code(net::Error net_error_code) {
112 net_error_code_ = net_error_code; 107 net_error_code_ = net_error_code;
113 } 108 }
114 109
115 // Returns whether the navigation is currently being transferred from one 110 // Returns whether the navigation is currently being transferred from one
116 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC 111 // RenderFrameHost to another. In particular, a DidStartProvisionalLoad IPC
117 // for the navigation URL, received in the new RenderFrameHost, should not 112 // for the navigation URL, received in the new RenderFrameHost, should not
118 // indicate the start of a new navigation in that case. 113 // indicate the start of a new navigation in that case.
119 bool is_transferring() const { return is_transferring_; } 114 bool is_transferring() const { return is_transferring_; }
120 void set_is_transferring(bool is_transferring) { 115 void set_is_transferring(bool is_transferring) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // will allow the caller to cancel the navigation or let it proceed. 147 // will allow the caller to cancel the navigation or let it proceed.
153 // This will also inform the delegate that the request was redirected. 148 // This will also inform the delegate that the request was redirected.
154 void WillRedirectRequest( 149 void WillRedirectRequest(
155 const GURL& new_url, 150 const GURL& new_url,
156 bool new_method_is_post, 151 bool new_method_is_post,
157 const GURL& new_referrer_url, 152 const GURL& new_referrer_url,
158 bool new_is_external_protocol, 153 bool new_is_external_protocol,
159 scoped_refptr<net::HttpResponseHeaders> response_headers, 154 scoped_refptr<net::HttpResponseHeaders> response_headers,
160 const ThrottleChecksFinishedCallback& callback); 155 const ThrottleChecksFinishedCallback& callback);
161 156
157 // Called when the URLRequest has response data, and is ready to be
158 // committed. |callback| will be called if the throttle checks indicate
159 // that the request should be cancelled. Otherwise, 'ReadyToCommitNavigation'
160 // will be called.
161 void WillProcessResponse(
162 RenderFrameHostImpl* render_frame_host,
163 scoped_refptr<net::HttpResponseHeaders> response_headers,
164 const ThrottleChecksFinishedCallback& callback);
165
162 // Returns the FrameTreeNode this navigation is happening in. 166 // Returns the FrameTreeNode this navigation is happening in.
163 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 167 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
164 168
165 // Called when the navigation is ready to be committed in 169 // Called when the navigation is ready to be committed in
166 // |render_frame_host|. This will update the |state_| and inform the 170 // |render_frame_host|. This will update the |state_| and inform the
167 // delegate. 171 // delegate.
168 void ReadyToCommitNavigation( 172 void ReadyToCommitNavigation(
169 RenderFrameHostImpl* render_frame_host, 173 RenderFrameHostImpl* render_frame_host,
170 scoped_refptr<net::HttpResponseHeaders> response_headers); 174 scoped_refptr<net::HttpResponseHeaders> response_headers);
171 175
(...skipping 17 matching lines...) Expand all
189 DID_COMMIT, 193 DID_COMMIT,
190 DID_COMMIT_ERROR_PAGE, 194 DID_COMMIT_ERROR_PAGE,
191 }; 195 };
192 196
193 NavigationHandleImpl(const GURL& url, 197 NavigationHandleImpl(const GURL& url,
194 FrameTreeNode* frame_tree_node, 198 FrameTreeNode* frame_tree_node,
195 const base::TimeTicks& navigation_start); 199 const base::TimeTicks& navigation_start);
196 200
197 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 201 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
198 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 202 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
203 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
199 204
200 // Helper function to run and reset the |complete_callback_|. This marks the 205 // Helper function to run and reset the |complete_callback_|. This marks the
201 // end of a round of NavigationThrottleChecks. 206 // end of a round of NavigationThrottleChecks.
202 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); 207 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
203 208
204 // Used in tests. 209 // Used in tests.
205 State state() const { return state_; } 210 State state() const { return state_; }
206 211
207 // See NavigationHandle for a description of those member variables. 212 // See NavigationHandle for a description of those member variables.
208 GURL url_; 213 GURL url_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a 247 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
243 // corresponding ServiceWorkerNetworkProvider is created in the renderer. 248 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
244 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; 249 scoped_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
245 250
246 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 251 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
247 }; 252 };
248 253
249 } // namespace content 254 } // namespace content
250 255
251 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 256 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698