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/renderer_host/download_throttling_resource_handler.h" | 5 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/download/download_util.h" | 8 #include "chrome/browser/download/download_util.h" |
9 #include "chrome/browser/renderer_host/download_resource_handler.h" | 9 #include "content/browser/download/download_resource_handler.h" |
10 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
11 #include "content/common/resource_response.h" | 11 #include "content/common/resource_response.h" |
12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
13 #include "net/base/mime_sniffer.h" | 13 #include "net/base/mime_sniffer.h" |
14 | 14 |
15 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( | 15 DownloadThrottlingResourceHandler::DownloadThrottlingResourceHandler( |
16 ResourceDispatcherHost* host, | 16 ResourceDispatcherHost* host, |
17 net::URLRequest* request, | 17 net::URLRequest* request, |
18 const GURL& url, | 18 const GURL& url, |
19 int render_process_host_id, | 19 int render_process_host_id, |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 int buf_size; | 201 int buf_size; |
202 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, | 202 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, |
203 tmp_buffer_length_)) { | 203 tmp_buffer_length_)) { |
204 CHECK(buf_size >= tmp_buffer_length_); | 204 CHECK(buf_size >= tmp_buffer_length_); |
205 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); | 205 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); |
206 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); | 206 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); |
207 } | 207 } |
208 tmp_buffer_length_ = 0; | 208 tmp_buffer_length_ = 0; |
209 tmp_buffer_ = NULL; | 209 tmp_buffer_ = NULL; |
210 } | 210 } |
OLD | NEW |