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

Side by Side Diff: net/base/network_delegate.h

Issue 572273002: Move handling of invalid referrer to the network delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 6 years, 3 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
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 CookieOptions* options); 101 CookieOptions* options);
102 bool CanAccessFile(const URLRequest& request, 102 bool CanAccessFile(const URLRequest& request,
103 const base::FilePath& path) const; 103 const base::FilePath& path) const;
104 bool CanThrottleRequest(const URLRequest& request) const; 104 bool CanThrottleRequest(const URLRequest& request) const;
105 bool CanEnablePrivacyMode(const GURL& url, 105 bool CanEnablePrivacyMode(const GURL& url,
106 const GURL& first_party_for_cookies) const; 106 const GURL& first_party_for_cookies) const;
107 107
108 int NotifyBeforeSocketStreamConnect(SocketStream* socket, 108 int NotifyBeforeSocketStreamConnect(SocketStream* socket,
109 const CompletionCallback& callback); 109 const CompletionCallback& callback);
110 110
111 bool CancelURLRequestWithPolicyViolatingReferrerHeader(
112 const URLRequest& request,
113 const GURL& target_url,
114 const GURL& referrer_url) const;
115
111 private: 116 private:
112 // This is the interface for subclasses of NetworkDelegate to implement. These 117 // This is the interface for subclasses of NetworkDelegate to implement. These
113 // member functions will be called by the respective public notification 118 // member functions will be called by the respective public notification
114 // member function, which will perform basic sanity checking. 119 // member function, which will perform basic sanity checking.
115 120
116 // Called before a request is sent. Allows the delegate to rewrite the URL 121 // Called before a request is sent. Allows the delegate to rewrite the URL
117 // being fetched by modifying |new_url|. If set, the URL must be valid. The 122 // being fetched by modifying |new_url|. If set, the URL must be valid. The
118 // reference fragment from the original URL is not automatically appended to 123 // reference fragment from the original URL is not automatically appended to
119 // |new_url|; callers are responsible for copying the reference fragment if 124 // |new_url|; callers are responsible for copying the reference fragment if
120 // desired. 125 // desired.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // is not tracked by the server. Usually is false, unless user privacy 268 // is not tracked by the server. Usually is false, unless user privacy
264 // settings block cookies from being get or set. 269 // settings block cookies from being get or set.
265 virtual bool OnCanEnablePrivacyMode( 270 virtual bool OnCanEnablePrivacyMode(
266 const GURL& url, 271 const GURL& url,
267 const GURL& first_party_for_cookies) const; 272 const GURL& first_party_for_cookies) const;
268 273
269 // Called before a SocketStream tries to connect. 274 // Called before a SocketStream tries to connect.
270 // See OnBeforeURLRequest for return value description. Returns OK by default. 275 // See OnBeforeURLRequest for return value description. Returns OK by default.
271 virtual int OnBeforeSocketStreamConnect( 276 virtual int OnBeforeSocketStreamConnect(
272 SocketStream* socket, const CompletionCallback& callback); 277 SocketStream* socket, const CompletionCallback& callback);
278
279 // Called when the |referrer_url| for requesting |target_url| during handling
280 // of the |request| is does not comply with the referrer policy (e.g. a
281 // secure referrer for an insecure initial target).
282 // Returns true if the request should be cancelled. Otherwise, the referrer
283 // header is stripped from the request.
284 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
285 const URLRequest& request,
286 const GURL& target_url,
287 const GURL& referrer_url) const;
273 }; 288 };
274 289
275 } // namespace net 290 } // namespace net
276 291
277 #endif // NET_BASE_NETWORK_DELEGATE_H_ 292 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698