OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | 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" | 9 #include "content/browser/download/download_stats.h" |
11 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
12 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 11 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
13 #include "content/browser/resource_context.h" | 12 #include "content/browser/resource_context.h" |
14 #include "content/public/common/resource_response.h" | 13 #include "content/public/common/resource_response.h" |
15 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
16 #include "net/base/mime_sniffer.h" | 15 #include "net/base/mime_sniffer.h" |
17 | 16 |
18 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( | 17 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
19 ResourceHandler* next_handler, | 18 ResourceHandler* next_handler, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 int buf_size; | 185 int buf_size; |
187 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size, | 186 if (next_handler_->OnWillRead(request_id_, &buffer, &buf_size, |
188 tmp_buffer_length_)) { | 187 tmp_buffer_length_)) { |
189 CHECK(buf_size >= tmp_buffer_length_); | 188 CHECK(buf_size >= tmp_buffer_length_); |
190 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); | 189 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); |
191 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); | 190 next_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); |
192 } | 191 } |
193 tmp_buffer_length_ = 0; | 192 tmp_buffer_length_ = 0; |
194 tmp_buffer_ = NULL; | 193 tmp_buffer_ = NULL; |
195 } | 194 } |
OLD | NEW |