| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); | 49 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer); |
| 50 | 50 |
| 51 // Create a new buffer, which will be handed to the download thread for file | 51 // Create a new buffer, which will be handed to the download thread for file |
| 52 // writing and deletion. | 52 // writing and deletion. |
| 53 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, | 53 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 54 int min_size); | 54 int min_size); |
| 55 | 55 |
| 56 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 56 virtual bool OnReadCompleted(int request_id, int* bytes_read); |
| 57 | 57 |
| 58 virtual bool OnResponseCompleted(int request_id, | 58 virtual bool OnResponseCompleted(int request_id, |
| 59 const URLRequestStatus& status, | 59 const net::URLRequestStatus& status, |
| 60 const std::string& security_info); | 60 const std::string& security_info); |
| 61 virtual void OnRequestClosed(); | 61 virtual void OnRequestClosed(); |
| 62 | 62 |
| 63 // If the content-length header is not present (or contains something other | 63 // If the content-length header is not present (or contains something other |
| 64 // than numbers), the incoming content_length is -1 (unknown size). | 64 // than numbers), the incoming content_length is -1 (unknown size). |
| 65 // Set the content length to 0 to indicate unknown size to DownloadManager. | 65 // Set the content length to 0 to indicate unknown size to DownloadManager. |
| 66 void set_content_length(const int64& content_length); | 66 void set_content_length(const int64& content_length); |
| 67 | 67 |
| 68 void set_content_disposition(const std::string& content_disposition); | 68 void set_content_disposition(const std::string& content_disposition); |
| 69 | 69 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 base::TimeTicks download_start_time_; // used to collect stats. | 116 base::TimeTicks download_start_time_; // used to collect stats. |
| 117 | 117 |
| 118 static const int kReadBufSize = 32768; // bytes | 118 static const int kReadBufSize = 32768; // bytes |
| 119 static const size_t kLoadsToWrite = 100; // number of data buffers queued | 119 static const size_t kLoadsToWrite = 100; // number of data buffers queued |
| 120 static const int kThrottleTimeMs = 200; // milliseconds | 120 static const int kThrottleTimeMs = 200; // milliseconds |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 122 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ | 125 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_RESOURCE_HANDLER_H_ |
| OLD | NEW |