| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "net/base/auth.h" | 15 #include "net/base/auth.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 18 #include "net/cookies/canonical_cookie.h" | 18 #include "net/cookies/canonical_cookie.h" |
| 19 #include "net/proxy/proxy_retry_info.h" | 19 #include "net/proxy/proxy_retry_info.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class FilePath; | 24 class FilePath; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace url { |
| 28 class Origin; |
| 29 } |
| 30 |
| 27 namespace net { | 31 namespace net { |
| 28 | 32 |
| 29 // NOTE: Layering violations! | 33 // NOTE: Layering violations! |
| 30 // We decided to accept these violations (depending | 34 // We decided to accept these violations (depending |
| 31 // on other net/ submodules from net/base/), because otherwise NetworkDelegate | 35 // on other net/ submodules from net/base/), because otherwise NetworkDelegate |
| 32 // would have to be broken up into too many smaller interfaces targeted to each | 36 // would have to be broken up into too many smaller interfaces targeted to each |
| 33 // submodule. Also, since the lower levels in net/ may callback into higher | 37 // submodule. Also, since the lower levels in net/ may callback into higher |
| 34 // levels, we may encounter dangerous casting issues. | 38 // levels, we may encounter dangerous casting issues. |
| 35 // | 39 // |
| 36 // NOTE: It is not okay to add any compile-time dependencies on symbols outside | 40 // NOTE: It is not okay to add any compile-time dependencies on symbols outside |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 bool CanEnablePrivacyMode(const GURL& url, | 109 bool CanEnablePrivacyMode(const GURL& url, |
| 106 const GURL& first_party_for_cookies) const; | 110 const GURL& first_party_for_cookies) const; |
| 107 | 111 |
| 108 bool AreExperimentalCookieFeaturesEnabled() const; | 112 bool AreExperimentalCookieFeaturesEnabled() const; |
| 109 | 113 |
| 110 bool CancelURLRequestWithPolicyViolatingReferrerHeader( | 114 bool CancelURLRequestWithPolicyViolatingReferrerHeader( |
| 111 const URLRequest& request, | 115 const URLRequest& request, |
| 112 const GURL& target_url, | 116 const GURL& target_url, |
| 113 const GURL& referrer_url) const; | 117 const GURL& referrer_url) const; |
| 114 | 118 |
| 119 bool CanQueueReportingReport(const url::Origin& origin) const; |
| 120 bool CanSendReportingReport(const url::Origin& origin) const; |
| 121 bool CanSetReportingClient(const url::Origin& origin, |
| 122 const GURL& endpoint) const; |
| 123 bool CanUseReportingClient(const url::Origin& origin, |
| 124 const GURL& endpoint) const; |
| 125 |
| 115 private: | 126 private: |
| 116 // This is the interface for subclasses of NetworkDelegate to implement. These | 127 // This is the interface for subclasses of NetworkDelegate to implement. These |
| 117 // member functions will be called by the respective public notification | 128 // member functions will be called by the respective public notification |
| 118 // member function, which will perform basic sanity checking. | 129 // member function, which will perform basic sanity checking. |
| 119 // | 130 // |
| 120 // (NetworkDelegateImpl has default implementations of these member functions. | 131 // (NetworkDelegateImpl has default implementations of these member functions. |
| 121 // NetworkDelegate implementations should consider subclassing | 132 // NetworkDelegate implementations should consider subclassing |
| 122 // NetworkDelegateImpl.) | 133 // NetworkDelegateImpl.) |
| 123 | 134 |
| 124 // Called before a request is sent. Allows the delegate to rewrite the URL | 135 // Called before a request is sent. Allows the delegate to rewrite the URL |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 296 |
| 286 // Called when the |referrer_url| for requesting |target_url| during handling | 297 // Called when the |referrer_url| for requesting |target_url| during handling |
| 287 // of the |request| is does not comply with the referrer policy (e.g. a | 298 // of the |request| is does not comply with the referrer policy (e.g. a |
| 288 // secure referrer for an insecure initial target). | 299 // secure referrer for an insecure initial target). |
| 289 // Returns true if the request should be cancelled. Otherwise, the referrer | 300 // Returns true if the request should be cancelled. Otherwise, the referrer |
| 290 // header is stripped from the request. | 301 // header is stripped from the request. |
| 291 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 302 virtual bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 292 const URLRequest& request, | 303 const URLRequest& request, |
| 293 const GURL& target_url, | 304 const GURL& target_url, |
| 294 const GURL& referrer_url) const = 0; | 305 const GURL& referrer_url) const = 0; |
| 306 |
| 307 virtual bool OnCanQueueReportingReport(const url::Origin& origin) const = 0; |
| 308 |
| 309 virtual bool OnCanSendReportingReport(const url::Origin& origin) const = 0; |
| 310 |
| 311 virtual bool OnCanSetReportingClient(const url::Origin& origin, |
| 312 const GURL& endpoint) const = 0; |
| 313 |
| 314 virtual bool OnCanUseReportingClient(const url::Origin& origin, |
| 315 const GURL& endpoint) const = 0; |
| 295 }; | 316 }; |
| 296 | 317 |
| 297 } // namespace net | 318 } // namespace net |
| 298 | 319 |
| 299 #endif // NET_BASE_NETWORK_DELEGATE_H_ | 320 #endif // NET_BASE_NETWORK_DELEGATE_H_ |
| OLD | NEW |