| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool OnResponseStarted(const std::string& override_mime_type); | 63 bool OnResponseStarted(const std::string& override_mime_type); |
| 64 | 64 |
| 65 // Should be called to handle a redirect. The caller should only allow the | 65 // Should be called to handle a redirect. The caller should only allow the |
| 66 // redirect to be followed if the return value is true. | 66 // redirect to be followed if the return value is true. |
| 67 bool OnRequestRedirected(); | 67 bool OnRequestRedirected(); |
| 68 | 68 |
| 69 // Starts a read cycle. Creates a new IOBuffer which can be passed into | 69 // Starts a read cycle. Creates a new IOBuffer which can be passed into |
| 70 // URLRequest::Read(). Call OnReadCompleted() when the Read operation | 70 // URLRequest::Read(). Call OnReadCompleted() when the Read operation |
| 71 // completes. | 71 // completes. |
| 72 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 72 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 73 int* buf_size, | 73 int* buf_size); |
| 74 int min_size); | |
| 75 | 74 |
| 76 // Used to notify DownloadRequestCore that the caller is about to abort the | 75 // Used to notify DownloadRequestCore that the caller is about to abort the |
| 77 // outer request. |reason| will be used as the final interrupt reason when | 76 // outer request. |reason| will be used as the final interrupt reason when |
| 78 // OnResponseCompleted() is called. | 77 // OnResponseCompleted() is called. |
| 79 void OnWillAbort(DownloadInterruptReason reason); | 78 void OnWillAbort(DownloadInterruptReason reason); |
| 80 | 79 |
| 81 // Should be called when the Read() operation completes. |defer| will be set | 80 // Should be called when the Read() operation completes. |defer| will be set |
| 82 // to true if reading is to be suspended. In the latter case, once more data | 81 // to true if reading is to be suspended. In the latter case, once more data |
| 83 // can be read, invokes the |on_ready_to_read_callback|. | 82 // can be read, invokes the |on_ready_to_read_callback|. |
| 84 bool OnReadCompleted(int bytes_read, bool* defer); | 83 bool OnReadCompleted(int bytes_read, bool* defer); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 164 |
| 166 // Each successful OnWillRead will yield a buffer of this size. | 165 // Each successful OnWillRead will yield a buffer of this size. |
| 167 static const int kReadBufSize = 32768; // bytes | 166 static const int kReadBufSize = 32768; // bytes |
| 168 | 167 |
| 169 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); | 168 DISALLOW_COPY_AND_ASSIGN(DownloadRequestCore); |
| 170 }; | 169 }; |
| 171 | 170 |
| 172 } // namespace content | 171 } // namespace content |
| 173 | 172 |
| 174 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ | 173 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_CORE_H_ |
| OLD | NEW |