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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 | 349 |
350 // Sets all extra request headers. Any extra request headers set by other | 350 // Sets all extra request headers. Any extra request headers set by other |
351 // methods are overwritten by this method. This method may only be called | 351 // methods are overwritten by this method. This method may only be called |
352 // before Start() is called. It is an error to call it later. | 352 // before Start() is called. It is an error to call it later. |
353 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); | 353 void SetExtraRequestHeaders(const HttpRequestHeaders& headers); |
354 | 354 |
355 const HttpRequestHeaders& extra_request_headers() const { | 355 const HttpRequestHeaders& extra_request_headers() const { |
356 return extra_request_headers_; | 356 return extra_request_headers_; |
357 } | 357 } |
358 | 358 |
359 void set_default_user_agent(const std::string& default_user_agent); | |
360 const std::string& default_user_agent() const { return default_user_agent_; } | |
361 bool has_default_user_agent() const; | |
362 | |
359 // Gets the full request headers sent to the server. | 363 // Gets the full request headers sent to the server. |
360 // | 364 // |
361 // Return true and overwrites headers if it can get the request headers; | 365 // Return true and overwrites headers if it can get the request headers; |
362 // otherwise, returns false and does not modify headers. (Always returns | 366 // otherwise, returns false and does not modify headers. (Always returns |
363 // false for request types that don't have headers, like file requests.) | 367 // false for request types that don't have headers, like file requests.) |
364 // | 368 // |
365 // This is guaranteed to succeed if: | 369 // This is guaranteed to succeed if: |
366 // | 370 // |
367 // 1. A redirect or auth callback is currently running. Once it ends, the | 371 // 1. A redirect or auth callback is currently running. Once it ends, the |
368 // headers may become unavailable as a new request with the new address | 372 // headers may become unavailable as a new request with the new address |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 std::vector<GURL> url_chain_; | 760 std::vector<GURL> url_chain_; |
757 GURL first_party_for_cookies_; | 761 GURL first_party_for_cookies_; |
758 url::Origin initiator_; | 762 url::Origin initiator_; |
759 GURL delegate_redirect_url_; | 763 GURL delegate_redirect_url_; |
760 std::string method_; // "GET", "POST", etc. Should be all uppercase. | 764 std::string method_; // "GET", "POST", etc. Should be all uppercase. |
761 std::string referrer_; | 765 std::string referrer_; |
762 ReferrerPolicy referrer_policy_; | 766 ReferrerPolicy referrer_policy_; |
763 std::string token_binding_referrer_; | 767 std::string token_binding_referrer_; |
764 FirstPartyURLPolicy first_party_url_policy_; | 768 FirstPartyURLPolicy first_party_url_policy_; |
765 HttpRequestHeaders extra_request_headers_; | 769 HttpRequestHeaders extra_request_headers_; |
770 bool has_default_user_agent_; | |
horo
2016/08/21 08:39:37
You can use base::Optional<std::string>.
mmenke
2016/08/21 14:37:39
Given that URLRequest uses empty strings to denote
| |
771 std::string default_user_agent_; | |
766 int load_flags_; // Flags indicating the request type for the load; | 772 int load_flags_; // Flags indicating the request type for the load; |
767 // expected values are LOAD_* enums above. | 773 // expected values are LOAD_* enums above. |
768 | 774 |
769 // Never access methods of the |delegate_| directly. Always use the | 775 // Never access methods of the |delegate_| directly. Always use the |
770 // Notify... methods for this. | 776 // Notify... methods for this. |
771 Delegate* delegate_; | 777 Delegate* delegate_; |
772 | 778 |
773 // Current error status of the job. When no error has been encountered, this | 779 // Current error status of the job. When no error has been encountered, this |
774 // will be SUCCESS. If multiple errors have been encountered, this will be | 780 // will be SUCCESS. If multiple errors have been encountered, this will be |
775 // the first non-SUCCESS status seen. | 781 // the first non-SUCCESS status seen. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 | 853 |
848 // The proxy server used for this request, if any. | 854 // The proxy server used for this request, if any. |
849 HostPortPair proxy_server_; | 855 HostPortPair proxy_server_; |
850 | 856 |
851 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 857 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
852 }; | 858 }; |
853 | 859 |
854 } // namespace net | 860 } // namespace net |
855 | 861 |
856 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 862 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |