| 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 #include "chrome/browser/download/download_throttling_resource_handler.h" | 5 #include "chrome/browser/download/download_throttling_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/download/download_id.h" | |
| 9 #include "content/browser/download/download_resource_handler.h" | |
| 10 #include "content/browser/download/download_stats.h" | 8 #include "content/browser/download/download_stats.h" |
| 11 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 9 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| 12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | |
| 13 #include "content/browser/resource_context.h" | |
| 14 #include "content/common/resource_response.h" | 10 #include "content/common/resource_response.h" |
| 15 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 16 #include "net/base/mime_sniffer.h" | 12 #include "net/base/mime_sniffer.h" |
| 17 | 13 |
| 18 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( | 14 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
| 19 ResourceHandler* next_handler, | 15 ResourceHandler* next_handler, |
| 20 ResourceDispatcherHost* host, | 16 ResourceDispatcherHost* host, |
| 21 DownloadRequestLimiter* limiter, | 17 DownloadRequestLimiter* limiter, |
| 22 net::URLRequest* request, | 18 net::URLRequest* request, |
| 23 const GURL& url, | 19 const GURL& url, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 int buf_size; | 189 int buf_size; |
| 194 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size, | 190 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size, |
| 195 tmp_buffer_length_)) { | 191 tmp_buffer_length_)) { |
| 196 CHECK(buf_size >= tmp_buffer_length_); | 192 CHECK(buf_size >= tmp_buffer_length_); |
| 197 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); | 193 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); |
| 198 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); | 194 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); |
| 199 } | 195 } |
| 200 tmp_buffer_length_ = 0; | 196 tmp_buffer_length_ = 0; |
| 201 tmp_buffer_ = NULL; | 197 tmp_buffer_ = NULL; |
| 202 } | 198 } |
| OLD | NEW |