| OLD | NEW |
| 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 Loading... |
| 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 CanCorrectInvalidReferrerHeader(const URLRequest& request, |
| 112 const GURL& target_url, |
| 113 const GURL& referrer_url) const; |
| 114 |
| 111 private: | 115 private: |
| 112 // This is the interface for subclasses of NetworkDelegate to implement. These | 116 // This is the interface for subclasses of NetworkDelegate to implement. These |
| 113 // member functions will be called by the respective public notification | 117 // member functions will be called by the respective public notification |
| 114 // member function, which will perform basic sanity checking. | 118 // member function, which will perform basic sanity checking. |
| 115 | 119 |
| 116 // Called before a request is sent. Allows the delegate to rewrite the URL | 120 // 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 | 121 // 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 | 122 // reference fragment from the original URL is not automatically appended to |
| 119 // |new_url|; callers are responsible for copying the reference fragment if | 123 // |new_url|; callers are responsible for copying the reference fragment if |
| 120 // desired. | 124 // desired. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // is not tracked by the server. Usually is false, unless user privacy | 267 // is not tracked by the server. Usually is false, unless user privacy |
| 264 // settings block cookies from being get or set. | 268 // settings block cookies from being get or set. |
| 265 virtual bool OnCanEnablePrivacyMode( | 269 virtual bool OnCanEnablePrivacyMode( |
| 266 const GURL& url, | 270 const GURL& url, |
| 267 const GURL& first_party_for_cookies) const; | 271 const GURL& first_party_for_cookies) const; |
| 268 | 272 |
| 269 // Called before a SocketStream tries to connect. | 273 // Called before a SocketStream tries to connect. |
| 270 // See OnBeforeURLRequest for return value description. Returns OK by default. | 274 // See OnBeforeURLRequest for return value description. Returns OK by default. |
| 271 virtual int OnBeforeSocketStreamConnect( | 275 virtual int OnBeforeSocketStreamConnect( |
| 272 SocketStream* socket, const CompletionCallback& callback); | 276 SocketStream* socket, const CompletionCallback& callback); |
| 277 |
| 278 // Called when the |referrer_url| for requesting |target_url| during handling |
| 279 // of the |request| is invalid (e.g. a secure referrer for an insecure |
| 280 // target). |
| 281 // Returns true if the referrer header should be omitted, or false if the |
| 282 // request should be cancelled. |
| 283 virtual bool OnCanCorrectInvalidReferrerHeader( |
| 284 const URLRequest& request, |
| 285 const GURL& target_url, |
| 286 const GURL& referrer_url) const; |
| 273 }; | 287 }; |
| 274 | 288 |
| 275 } // namespace net | 289 } // namespace net |
| 276 | 290 |
| 277 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 291 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
| OLD | NEW |