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