| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class Delegate { | 45 class Delegate { |
| 46 public: | 46 public: |
| 47 virtual void OnReadyToRead() = 0; | 47 virtual void OnReadyToRead() = 0; |
| 48 virtual void OnStart( | 48 virtual void OnStart( |
| 49 std::unique_ptr<DownloadCreateInfo> download_create_info, | 49 std::unique_ptr<DownloadCreateInfo> download_create_info, |
| 50 std::unique_ptr<ByteStreamReader> stream_reader, | 50 std::unique_ptr<ByteStreamReader> stream_reader, |
| 51 const DownloadUrlParameters::OnStartedCallback& callback) = 0; | 51 const DownloadUrlParameters::OnStartedCallback& callback) = 0; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // All parameters are required. |request| and |delegate| must outlive | 54 // All parameters are required. |request| and |delegate| must outlive |
| 55 // DownloadRequestCore. | 55 // DownloadRequestCore. The request is not the main request if |
| 56 DownloadRequestCore(net::URLRequest* request, Delegate* delegate); | 56 // |is_parallel_request| is true. |
| 57 DownloadRequestCore(net::URLRequest* request, |
| 58 Delegate* delegate, |
| 59 bool is_parallel_request); |
| 57 ~DownloadRequestCore(); | 60 ~DownloadRequestCore(); |
| 58 | 61 |
| 59 // Should be called when the URLRequest::Delegate receives OnResponseStarted. | 62 // Should be called when the URLRequest::Delegate receives OnResponseStarted. |
| 60 // Invokes Delegate::OnStart() with download start parameters. The | 63 // Invokes Delegate::OnStart() with download start parameters. The |
| 61 // |override_mime_type| is used as the MIME type for the download when | 64 // |override_mime_type| is used as the MIME type for the download when |
| 62 // constructing a DownloadCreateInfo object. | 65 // constructing a DownloadCreateInfo object. |
| 63 bool OnResponseStarted(const std::string& override_mime_type); | 66 bool OnResponseStarted(const std::string& override_mime_type); |
| 64 | 67 |
| 65 // Should be called to handle a redirect. The caller should only allow the | 68 // Should be called to handle a redirect. The caller should only allow the |
| 66 // redirect to be followed if the return value is true. | 69 // redirect to be followed if the return value is true. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 171 |
| 169 // Each successful OnWillRead will yield a buffer of this size. | 172 // Each successful OnWillRead will yield a buffer of this size. |
| 170 static const int kReadBufSize = 32768; // bytes | 173 static const int kReadBufSize = 32768; // bytes |
| 171 | 174 |
| 172 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); | 175 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); |
| 173 }; | 176 }; |
| 174 | 177 |
| 175 } // namespace content | 178 } // namespace content |
| 176 | 179 |
| 177 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 180 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
| OLD | NEW |