| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 5 #ifndef CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| 6 #define CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 6 #define CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 // |factory| and |client| must stay alive during the lifetime of the returned | 28 // |factory| and |client| must stay alive during the lifetime of the returned |
| 29 // object. | 29 // object. |
| 30 static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart( | 30 static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart( |
| 31 mojom::URLLoaderFactory* factory, | 31 mojom::URLLoaderFactory* factory, |
| 32 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, | 32 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, |
| 33 int32_t routing_id, | 33 int32_t routing_id, |
| 34 int32_t request_id, | 34 int32_t request_id, |
| 35 uint32_t options, | 35 uint32_t options, |
| 36 std::unique_ptr<ResourceRequest> url_request, | 36 std::unique_ptr<ResourceRequest> url_request, |
| 37 mojom::URLLoaderClient* client); | 37 mojom::URLLoaderClient* client, |
| 38 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation); |
| 38 | 39 |
| 39 ~ThrottlingURLLoader() override; | 40 ~ThrottlingURLLoader() override; |
| 40 | 41 |
| 41 void FollowRedirect(); | 42 void FollowRedirect(); |
| 42 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); | 43 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 ThrottlingURLLoader(std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, | 46 ThrottlingURLLoader( |
| 46 mojom::URLLoaderClient* client); | 47 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, |
| 48 mojom::URLLoaderClient* client, |
| 49 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation); |
| 47 | 50 |
| 48 void Start(mojom::URLLoaderFactory* factory, | 51 void Start(mojom::URLLoaderFactory* factory, |
| 49 int32_t routing_id, | 52 int32_t routing_id, |
| 50 int32_t request_id, | 53 int32_t request_id, |
| 51 uint32_t options, | 54 uint32_t options, |
| 52 std::unique_ptr<ResourceRequest> url_request); | 55 std::unique_ptr<ResourceRequest> url_request); |
| 53 | 56 |
| 54 // mojom::URLLoaderClient implementation: | 57 // mojom::URLLoaderClient implementation: |
| 55 void OnReceiveResponse(const ResourceResponseHead& response_head, | 58 void OnReceiveResponse(const ResourceResponseHead& response_head, |
| 56 const base::Optional<net::SSLInfo>& ssl_info, | 59 const base::Optional<net::SSLInfo>& ssl_info, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 mojom::DownloadedTempFilePtr downloaded_file_; | 105 mojom::DownloadedTempFilePtr downloaded_file_; |
| 103 | 106 |
| 104 // Set if redirect is deferred. | 107 // Set if redirect is deferred. |
| 105 net::RedirectInfo redirect_info_; | 108 net::RedirectInfo redirect_info_; |
| 106 | 109 |
| 107 // Set if request is deferred and SetPriority() is called. | 110 // Set if request is deferred and SetPriority() is called. |
| 108 bool set_priority_cached_ = false; | 111 bool set_priority_cached_ = false; |
| 109 net::RequestPriority priority_ = net::MINIMUM_PRIORITY; | 112 net::RequestPriority priority_ = net::MINIMUM_PRIORITY; |
| 110 int32_t intra_priority_value_ = 0; | 113 int32_t intra_priority_value_ = 0; |
| 111 | 114 |
| 115 const net::MutableNetworkTrafficAnnotationTag traffic_annotation_; |
| 116 |
| 112 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); | 117 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); |
| 113 }; | 118 }; |
| 114 | 119 |
| 115 } // namespace content | 120 } // namespace content |
| 116 | 121 |
| 117 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 122 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| OLD | NEW |