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 CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "content/browser/loader/resource_handler.h" | 17 #include "content/browser/loader/resource_handler.h" |
18 #include "content/public/browser/download_interrupt_reasons.h" | 18 #include "content/public/browser/download_interrupt_reasons.h" |
19 #include "content/public/browser/download_save_info.h" | 19 #include "content/public/browser/download_save_info.h" |
20 #include "content/public/browser/download_url_parameters.h" | 20 #include "content/public/browser/download_url_parameters.h" |
21 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" | 21 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" |
| 22 #include "net/traffic_annotation/network_traffic_annotation.h" |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 class HttpResponseHeaders; | 25 class HttpResponseHeaders; |
25 class URLRequest; | 26 class URLRequest; |
26 class URLRequestStatus; | 27 class URLRequestStatus; |
27 } // namespace net | 28 } // namespace net |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 class ByteStreamReader; | 31 class ByteStreamReader; |
31 class ByteStreamWriter; | 32 class ByteStreamWriter; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // Balances a call to PauseRequest(). If no more pauses are outstanding and | 99 // Balances a call to PauseRequest(). If no more pauses are outstanding and |
99 // the reader end of the ByteStream is ready to receive more data, | 100 // the reader end of the ByteStream is ready to receive more data, |
100 // DownloadRequestCore will invoke the |on_ready_to_read_callback| to signal | 101 // DownloadRequestCore will invoke the |on_ready_to_read_callback| to signal |
101 // to the caller that the read cycles should commence. | 102 // to the caller that the read cycles should commence. |
102 void ResumeRequest(); | 103 void ResumeRequest(); |
103 | 104 |
104 std::string DebugString() const; | 105 std::string DebugString() const; |
105 | 106 |
106 static std::unique_ptr<net::URLRequest> CreateRequestOnIOThread( | 107 static std::unique_ptr<net::URLRequest> CreateRequestOnIOThread( |
107 uint32_t download_id, | 108 uint32_t download_id, |
108 DownloadUrlParameters* params); | 109 DownloadUrlParameters* params, |
| 110 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
109 | 111 |
110 // Size of the buffer used between the DownloadRequestCore and the | 112 // Size of the buffer used between the DownloadRequestCore and the |
111 // downstream receiver of its output. | 113 // downstream receiver of its output. |
112 static const int kDownloadByteStreamSize; | 114 static const int kDownloadByteStreamSize; |
113 | 115 |
114 protected: | 116 protected: |
115 net::URLRequest* request() const { return request_; } | 117 net::URLRequest* request() const { return request_; } |
116 | 118 |
117 private: | 119 private: |
118 static DownloadInterruptReason HandleRequestStatus( | 120 static DownloadInterruptReason HandleRequestStatus( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 // Each successful OnWillRead will yield a buffer of this size. | 172 // Each successful OnWillRead will yield a buffer of this size. |
171 static const int kReadBufSize = 32768; // bytes | 173 static const int kReadBufSize = 32768; // bytes |
172 | 174 |
173 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); | 175 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); |
174 }; | 176 }; |
175 | 177 |
176 } // namespace content | 178 } // namespace content |
177 | 179 |
178 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 180 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
OLD | NEW |