| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // Send the download creation information to the download thread. | 30 // Send the download creation information to the download thread. |
| 31 bool OnResponseStarted(int request_id, ResourceResponse* response); | 31 bool OnResponseStarted(int request_id, ResourceResponse* response); |
| 32 | 32 |
| 33 // Create a new buffer, which will be handed to the download thread for file | 33 // Create a new buffer, which will be handed to the download thread for file |
| 34 // writing and deletion. | 34 // writing and deletion. |
| 35 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 35 bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 36 int min_size); | 36 int min_size); |
| 37 | 37 |
| 38 bool OnReadCompleted(int request_id, int* bytes_read); | 38 bool OnReadCompleted(int request_id, int* bytes_read); |
| 39 | 39 |
| 40 bool OnResponseCompleted(int request_id, const URLRequestStatus& status); | 40 bool OnResponseCompleted(int request_id, |
| 41 const URLRequestStatus& status, |
| 42 const std::string& security_info); |
| 41 | 43 |
| 42 // If the content-length header is not present (or contains something other | 44 // If the content-length header is not present (or contains something other |
| 43 // than numbers), the incoming content_length is -1 (unknown size). | 45 // than numbers), the incoming content_length is -1 (unknown size). |
| 44 // Set the content length to 0 to indicate unknown size to DownloadManager. | 46 // Set the content length to 0 to indicate unknown size to DownloadManager. |
| 45 void set_content_length(const int64& content_length); | 47 void set_content_length(const int64& content_length); |
| 46 | 48 |
| 47 void set_content_disposition(const std::string& content_disposition); | 49 void set_content_disposition(const std::string& content_disposition); |
| 48 | 50 |
| 49 void CheckWriteProgress(); | 51 void CheckWriteProgress(); |
| 50 | 52 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 base::OneShotTimer<DownloadResourceHandler> pause_timer_; | 69 base::OneShotTimer<DownloadResourceHandler> pause_timer_; |
| 68 | 70 |
| 69 static const int kReadBufSize = 32768; // bytes | 71 static const int kReadBufSize = 32768; // bytes |
| 70 static const size_t kLoadsToWrite = 100; // number of data buffers queued | 72 static const size_t kLoadsToWrite = 100; // number of data buffers queued |
| 71 static const int kThrottleTimeMs = 200; // milliseconds | 73 static const int kThrottleTimeMs = 200; // milliseconds |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 75 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ | 78 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ |
| OLD | NEW |