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 "content/browser/download/download_resource_handler.h" | 5 #include "content/browser/download/download_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 void DownloadResourceHandler::OnWillStart( | 166 void DownloadResourceHandler::OnWillStart( |
167 const GURL& url, | 167 const GURL& url, |
168 std::unique_ptr<ResourceController> controller) { | 168 std::unique_ptr<ResourceController> controller) { |
169 controller->Resume(); | 169 controller->Resume(); |
170 } | 170 } |
171 | 171 |
172 // Create a new buffer, which will be handed to the download thread for file | 172 // Create a new buffer, which will be handed to the download thread for file |
173 // writing and deletion. | 173 // writing and deletion. |
174 bool DownloadResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 174 bool DownloadResourceHandler::OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
175 int* buf_size, | 175 int* buf_size) { |
176 int min_size) { | 176 return core_.OnWillRead(buf, buf_size); |
177 return core_.OnWillRead(buf, buf_size, min_size); | |
178 } | 177 } |
179 | 178 |
180 // Pass the buffer to the download file writer. | 179 // Pass the buffer to the download file writer. |
181 void DownloadResourceHandler::OnReadCompleted( | 180 void DownloadResourceHandler::OnReadCompleted( |
182 int bytes_read, | 181 int bytes_read, |
183 std::unique_ptr<ResourceController> controller) { | 182 std::unique_ptr<ResourceController> controller) { |
184 DCHECK(!has_controller()); | 183 DCHECK(!has_controller()); |
185 | 184 |
186 bool defer = false; | 185 bool defer = false; |
187 if (!core_.OnReadCompleted(bytes_read, &defer)) { | 186 if (!core_.OnReadCompleted(bytes_read, &defer)) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 " }", | 275 " }", |
277 request() ? | 276 request() ? |
278 request()->url().spec().c_str() : | 277 request()->url().spec().c_str() : |
279 "<NULL request>", | 278 "<NULL request>", |
280 info->GetChildID(), | 279 info->GetChildID(), |
281 info->GetRequestID(), | 280 info->GetRequestID(), |
282 info->GetRouteID()); | 281 info->GetRouteID()); |
283 } | 282 } |
284 | 283 |
285 } // namespace content | 284 } // namespace content |
OLD | NEW |