| 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_URL_REQUEST_URL_REQUEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 public base::SupportsUserData { | 74 public base::SupportsUserData { |
| 75 public: | 75 public: |
| 76 // Callback function implemented by protocol handlers to create new jobs. | 76 // Callback function implemented by protocol handlers to create new jobs. |
| 77 // The factory may return NULL to indicate an error, which will cause other | 77 // The factory may return NULL to indicate an error, which will cause other |
| 78 // factories to be queried. If no factory handles the request, then the | 78 // factories to be queried. If no factory handles the request, then the |
| 79 // default job will be used. | 79 // default job will be used. |
| 80 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, | 80 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, |
| 81 NetworkDelegate* network_delegate, | 81 NetworkDelegate* network_delegate, |
| 82 const std::string& scheme); | 82 const std::string& scheme); |
| 83 | 83 |
| 84 // Referrer policies (see set_referrer_policy): During server redirects, the | 84 // A ReferrerPolicy for the request can be set with |
| 85 // referrer header might be cleared, if the protocol changes from HTTPS to | 85 // set_referrer_policy() and controls the contents of the Referer |
| 86 // HTTP. This is the default behavior of URLRequest, corresponding to | 86 // header when URLRequest follows server redirects. |
| 87 // CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE. Alternatively, the | |
| 88 // referrer policy can be set to strip the referrer down to an origin upon | |
| 89 // cross-origin navigation (ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN), or | |
| 90 // never change the referrer header (NEVER_CLEAR_REFERRER). Embedders will | |
| 91 // want to use these options when implementing referrer policy support | |
| 92 // (https://w3c.github.io/webappsec/specs/referrer-policy/). | |
| 93 // | |
| 94 // REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN is a slight variant | |
| 95 // on CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: If the request | |
| 96 // downgrades from HTTPS to HTTP, the referrer will be cleared. If the request | |
| 97 // transitions cross-origin (but does not downgrade), the referrer's | |
| 98 // granularity will be reduced (currently stripped down to an origin rather | |
| 99 // than a full URL). Same-origin requests will send the full referrer. | |
| 100 enum ReferrerPolicy { | 87 enum ReferrerPolicy { |
| 88 // Clear the referrer header if the protocol changes from HTTPS to |
| 89 // HTTP. This is the default behavior of URLRequest. |
| 101 CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 90 CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
| 91 // A slight variant on |
| 92 // CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE: If the |
| 93 // request downgrades from HTTPS to HTTP, the referrer will be |
| 94 // cleared. If the request transitions cross-origin (but does not |
| 95 // downgrade), the referrer's granularity will be reduced (currently |
| 96 // stripped down to an origin rather than a full URL). Same-origin |
| 97 // requests will send the full referrer. |
| 102 REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN, | 98 REDUCE_REFERRER_GRANULARITY_ON_TRANSITION_CROSS_ORIGIN, |
| 99 // Strip the referrer down to an origin upon cross-origin navigation. |
| 103 ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN, | 100 ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN, |
| 101 // Never change the referrer. |
| 104 NEVER_CLEAR_REFERRER, | 102 NEVER_CLEAR_REFERRER, |
| 103 // Strip the referrer down to the origin regardless of the redirect |
| 104 // location. |
| 105 ORIGIN, |
| 106 // Always clear the referrer regardless of the redirect location. |
| 107 NO_REFERRER, |
| 108 MAX_REFERRER_POLICY |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 // First-party URL redirect policy: During server redirects, the first-party | 111 // First-party URL redirect policy: During server redirects, the first-party |
| 108 // URL for cookies normally doesn't change. However, if the request is a | 112 // URL for cookies normally doesn't change. However, if the request is a |
| 109 // top-level first-party request, the first-party URL should be updated to the | 113 // top-level first-party request, the first-party URL should be updated to the |
| 110 // URL on every redirect. | 114 // URL on every redirect. |
| 111 enum FirstPartyURLPolicy { | 115 enum FirstPartyURLPolicy { |
| 112 NEVER_CHANGE_FIRST_PARTY_URL, | 116 NEVER_CHANGE_FIRST_PARTY_URL, |
| 113 UPDATE_FIRST_PARTY_URL_ON_REDIRECT, | 117 UPDATE_FIRST_PARTY_URL_ON_REDIRECT, |
| 114 }; | 118 }; |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 | 860 |
| 857 // The proxy server used for this request, if any. | 861 // The proxy server used for this request, if any. |
| 858 HostPortPair proxy_server_; | 862 HostPortPair proxy_server_; |
| 859 | 863 |
| 860 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 864 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
| 861 }; | 865 }; |
| 862 | 866 |
| 863 } // namespace net | 867 } // namespace net |
| 864 | 868 |
| 865 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 869 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
| OLD | NEW |