| OLD | NEW |
| 1 // Copyright (c) 2011 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 CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const OnStartedCallback& started_cb, | 49 const OnStartedCallback& started_cb, |
| 50 const DownloadSaveInfo& save_info); | 50 const DownloadSaveInfo& save_info); |
| 51 | 51 |
| 52 virtual bool OnUploadProgress(int request_id, | 52 virtual bool OnUploadProgress(int request_id, |
| 53 uint64 position, | 53 uint64 position, |
| 54 uint64 size) OVERRIDE; | 54 uint64 size) OVERRIDE; |
| 55 | 55 |
| 56 // Not needed, as this event handler ought to be the final resource. | 56 // Not needed, as this event handler ought to be the final resource. |
| 57 virtual bool OnRequestRedirected(int request_id, | 57 virtual bool OnRequestRedirected(int request_id, |
| 58 const GURL& url, | 58 const GURL& url, |
| 59 ResourceResponse* response, | 59 content::ResourceResponse* response, |
| 60 bool* defer) OVERRIDE; | 60 bool* defer) OVERRIDE; |
| 61 | 61 |
| 62 // Send the download creation information to the download thread. | 62 // Send the download creation information to the download thread. |
| 63 virtual bool OnResponseStarted(int request_id, | 63 virtual bool OnResponseStarted(int request_id, |
| 64 ResourceResponse* response) OVERRIDE; | 64 content::ResourceResponse* response) OVERRIDE; |
| 65 | 65 |
| 66 // Pass-through implementation. | 66 // Pass-through implementation. |
| 67 virtual bool OnWillStart(int request_id, | 67 virtual bool OnWillStart(int request_id, |
| 68 const GURL& url, | 68 const GURL& url, |
| 69 bool* defer) OVERRIDE; | 69 bool* defer) OVERRIDE; |
| 70 | 70 |
| 71 // Create a new buffer, which will be handed to the download thread for file | 71 // Create a new buffer, which will be handed to the download thread for file |
| 72 // writing and deletion. | 72 // writing and deletion. |
| 73 virtual bool OnWillRead(int request_id, | 73 virtual bool OnWillRead(int request_id, |
| 74 net::IOBuffer** buf, | 74 net::IOBuffer** buf, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 base::TimeTicks download_start_time_; // used to collect stats. | 117 base::TimeTicks download_start_time_; // used to collect stats. |
| 118 base::TimeTicks last_read_time_; // used to collect stats. | 118 base::TimeTicks last_read_time_; // used to collect stats. |
| 119 size_t last_buffer_size_; // used to collect stats. | 119 size_t last_buffer_size_; // used to collect stats. |
| 120 static const int kReadBufSize = 32768; // bytes | 120 static const int kReadBufSize = 32768; // bytes |
| 121 static const int kThrottleTimeMs = 200; // milliseconds | 121 static const int kThrottleTimeMs = 200; // milliseconds |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 123 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 126 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| OLD | NEW |