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 16 matching lines...) Expand all Loading... |
27 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
28 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
29 #include "net/base/request_priority.h" | 29 #include "net/base/request_priority.h" |
30 #include "net/base/upload_progress.h" | 30 #include "net/base/upload_progress.h" |
31 #include "net/cookies/canonical_cookie.h" | 31 #include "net/cookies/canonical_cookie.h" |
32 #include "net/http/http_request_headers.h" | 32 #include "net/http/http_request_headers.h" |
33 #include "net/http/http_response_info.h" | 33 #include "net/http/http_response_info.h" |
34 #include "net/log/net_log_with_source.h" | 34 #include "net/log/net_log_with_source.h" |
35 #include "net/proxy/proxy_server.h" | 35 #include "net/proxy/proxy_server.h" |
36 #include "net/socket/connection_attempts.h" | 36 #include "net/socket/connection_attempts.h" |
| 37 #include "net/traffic_annotation/network_traffic_annotation.h" |
37 #include "net/url_request/url_request_status.h" | 38 #include "net/url_request/url_request_status.h" |
38 #include "url/gurl.h" | 39 #include "url/gurl.h" |
39 #include "url/origin.h" | 40 #include "url/origin.h" |
40 | 41 |
41 namespace base { | 42 namespace base { |
42 class Value; | 43 class Value; |
43 } // namespace base | 44 } // namespace base |
44 | 45 |
45 namespace net { | 46 namespace net { |
46 | 47 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // or after the response headers are received. | 645 // or after the response headers are received. |
645 void GetConnectionAttempts(ConnectionAttempts* out) const; | 646 void GetConnectionAttempts(ConnectionAttempts* out) const; |
646 | 647 |
647 // Gets the over the wire raw header size of the response after https | 648 // Gets the over the wire raw header size of the response after https |
648 // encryption, 0 for cached responses. | 649 // encryption, 0 for cached responses. |
649 int raw_header_size() const { return raw_header_size_; } | 650 int raw_header_size() const { return raw_header_size_; } |
650 | 651 |
651 // Returns the error status of the request. | 652 // Returns the error status of the request. |
652 // Do not use! Going to be protected! | 653 // Do not use! Going to be protected! |
653 const URLRequestStatus& status() const { return status_; } | 654 const URLRequestStatus& status() const { return status_; } |
| 655 |
| 656 const NetworkTrafficAnnotationTag& traffic_annotation() const { |
| 657 return traffic_annotation_; |
| 658 } |
| 659 |
654 protected: | 660 protected: |
655 // Allow the URLRequestJob class to control the is_pending() flag. | 661 // Allow the URLRequestJob class to control the is_pending() flag. |
656 void set_is_pending(bool value) { is_pending_ = value; } | 662 void set_is_pending(bool value) { is_pending_ = value; } |
657 | 663 |
658 // Allow the URLRequestJob class to set our status too. | 664 // Allow the URLRequestJob class to set our status too. |
659 void set_status(URLRequestStatus status); | 665 void set_status(URLRequestStatus status); |
660 | 666 |
661 // Allow the URLRequestJob to redirect this request. Returns OK if | 667 // Allow the URLRequestJob to redirect this request. Returns OK if |
662 // successful, otherwise an error code is returned. | 668 // successful, otherwise an error code is returned. |
663 int Redirect(const RedirectInfo& redirect_info); | 669 int Redirect(const RedirectInfo& redirect_info); |
(...skipping 15 matching lines...) Expand all Loading... |
679 friend class TestNetworkDelegate; | 685 friend class TestNetworkDelegate; |
680 | 686 |
681 // URLRequests are always created by calling URLRequestContext::CreateRequest. | 687 // URLRequests are always created by calling URLRequestContext::CreateRequest. |
682 // | 688 // |
683 // If no network delegate is passed in, will use the ones from the | 689 // If no network delegate is passed in, will use the ones from the |
684 // URLRequestContext. | 690 // URLRequestContext. |
685 URLRequest(const GURL& url, | 691 URLRequest(const GURL& url, |
686 RequestPriority priority, | 692 RequestPriority priority, |
687 Delegate* delegate, | 693 Delegate* delegate, |
688 const URLRequestContext* context, | 694 const URLRequestContext* context, |
689 NetworkDelegate* network_delegate); | 695 NetworkDelegate* network_delegate, |
| 696 NetworkTrafficAnnotationTag traffic_annotation); |
690 | 697 |
691 // Resumes or blocks a request paused by the NetworkDelegate::OnBeforeRequest | 698 // Resumes or blocks a request paused by the NetworkDelegate::OnBeforeRequest |
692 // handler. If |blocked| is true, the request is blocked and an error page is | 699 // handler. If |blocked| is true, the request is blocked and an error page is |
693 // returned indicating so. This should only be called after Start is called | 700 // returned indicating so. This should only be called after Start is called |
694 // and OnBeforeRequest returns true (signalling that the request should be | 701 // and OnBeforeRequest returns true (signalling that the request should be |
695 // paused). | 702 // paused). |
696 void BeforeRequestComplete(int error); | 703 void BeforeRequestComplete(int error); |
697 | 704 |
698 // TODO(mmenke): Make this take a scoped_ptr. | 705 // TODO(mmenke): Make this take a scoped_ptr. |
699 void StartJob(URLRequestJob* job); | 706 void StartJob(URLRequestJob* job); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 // Timing information for the most recent request. Its start times are | 853 // Timing information for the most recent request. Its start times are |
847 // populated during Start(), and the rest are populated in OnResponseReceived. | 854 // populated during Start(), and the rest are populated in OnResponseReceived. |
848 LoadTimingInfo load_timing_info_; | 855 LoadTimingInfo load_timing_info_; |
849 | 856 |
850 // The proxy server used for this request, if any. | 857 // The proxy server used for this request, if any. |
851 ProxyServer proxy_server_; | 858 ProxyServer proxy_server_; |
852 | 859 |
853 // The raw header size of the response. | 860 // The raw header size of the response. |
854 int raw_header_size_; | 861 int raw_header_size_; |
855 | 862 |
| 863 const NetworkTrafficAnnotationTag traffic_annotation_; |
| 864 |
856 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 865 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
857 }; | 866 }; |
858 | 867 |
859 } // namespace net | 868 } // namespace net |
860 | 869 |
861 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 870 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |