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 "content/browser/renderer_host/buffered_resource_handler.h" | 5 #include "content/browser/renderer_host/buffered_resource_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "content/browser/browser_thread.h" | 13 #include "content/browser/browser_thread.h" |
14 #include "content/browser/download/download_resource_handler.h" | 14 #include "content/browser/download/download_resource_handler.h" |
15 #include "content/browser/download/download_id_factory.h" | |
Miranda Callahan
2011/10/27 17:00:19
nitalpha
benjhayden
2011/10/27 19:04:41
Done.
| |
15 #include "content/browser/plugin_service.h" | 16 #include "content/browser/plugin_service.h" |
16 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 17 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
17 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" | 18 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" |
18 #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" | 19 #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" |
19 #include "content/browser/resource_context.h" | 20 #include "content/browser/resource_context.h" |
20 #include "content/common/resource_response.h" | 21 #include "content/common/resource_response.h" |
21 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
22 #include "content/public/browser/resource_dispatcher_host_delegate.h" | 23 #include "content/public/browser/resource_dispatcher_host_delegate.h" |
23 #include "net/base/io_buffer.h" | 24 #include "net/base/io_buffer.h" |
24 #include "net/base/mime_sniffer.h" | 25 #include "net/base/mime_sniffer.h" |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
310 // know how to display the content. We follow Firefox here and show our | 311 // know how to display the content. We follow Firefox here and show our |
311 // own error page instead of triggering a download. | 312 // own error page instead of triggering a download. |
312 // TODO(abarth): We should abstract the response_code test, but this kind | 313 // TODO(abarth): We should abstract the response_code test, but this kind |
313 // of check is scattered throughout our codebase. | 314 // of check is scattered throughout our codebase. |
314 request_->SimulateError(net::ERR_FILE_NOT_FOUND); | 315 request_->SimulateError(net::ERR_FILE_NOT_FOUND); |
315 return false; | 316 return false; |
316 } | 317 } |
317 | 318 |
318 info->set_is_download(true); | 319 info->set_is_download(true); |
319 | 320 |
320 DownloadId dl_id = info->context()->next_download_id_thunk().Run(); | 321 DownloadId dl_id = info->context()->download_id_factory()->GetNextId(); |
321 | 322 |
322 scoped_refptr<ResourceHandler> handler( | 323 scoped_refptr<ResourceHandler> handler( |
323 new DownloadResourceHandler(host_, | 324 new DownloadResourceHandler(host_, |
324 info->child_id(), | 325 info->child_id(), |
325 info->route_id(), | 326 info->route_id(), |
326 info->request_id(), | 327 info->request_id(), |
327 request_->url(), | 328 request_->url(), |
328 dl_id, | 329 dl_id, |
329 host_->download_file_manager(), | 330 host_->download_file_manager(), |
330 request_, | 331 request_, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 wait_for_plugins_ = false; | 467 wait_for_plugins_ = false; |
467 if (!request_) | 468 if (!request_) |
468 return; | 469 return; |
469 | 470 |
470 ResourceDispatcherHostRequestInfo* info = | 471 ResourceDispatcherHostRequestInfo* info = |
471 ResourceDispatcherHost::InfoForRequest(request_); | 472 ResourceDispatcherHost::InfoForRequest(request_); |
472 host_->PauseRequest(info->child_id(), info->request_id(), false); | 473 host_->PauseRequest(info->child_id(), info->request_id(), false); |
473 if (!CompleteResponseStarted(info->request_id(), false)) | 474 if (!CompleteResponseStarted(info->request_id(), false)) |
474 host_->CancelRequest(info->child_id(), info->request_id(), false); | 475 host_->CancelRequest(info->child_id(), info->request_id(), false); |
475 } | 476 } |
OLD | NEW |