Chromium Code Reviews| 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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Send the download creation information to the download thread. | 93 // Send the download creation information to the download thread. |
| 94 bool DownloadResourceHandler::OnResponseStarted( | 94 bool DownloadResourceHandler::OnResponseStarted( |
| 95 int request_id, | 95 int request_id, |
| 96 content::ResourceResponse* response) { | 96 content::ResourceResponse* response) { |
| 97 VLOG(20) << __FUNCTION__ << "()" << DebugString() | 97 VLOG(20) << __FUNCTION__ << "()" << DebugString() |
| 98 << " request_id = " << request_id; | 98 << " request_id = " << request_id; |
| 99 download_start_time_ = base::TimeTicks::Now(); | 99 download_start_time_ = base::TimeTicks::Now(); |
| 100 | 100 |
| 101 if (request_->url().scheme() == "file" || | |
| 102 request_->url().scheme() == "data") { | |
| 103 CallStartedCB(download_id_, net::ERR_DISALLOWED_URL_SCHEME); | |
|
ahendrickson
2012/03/20 19:56:35
Should we be doing a test at the time when we dete
Randy Smith (Not in Mondays)
2012/03/21 19:48:36
Andy and I talked offline, and agreed that doing i
| |
| 104 return false; | |
| 105 } | |
| 106 | |
| 101 // If it's a download, we don't want to poison the cache with it. | 107 // If it's a download, we don't want to poison the cache with it. |
| 102 request_->StopCaching(); | 108 request_->StopCaching(); |
| 103 | 109 |
| 104 std::string content_disposition; | 110 std::string content_disposition; |
| 105 request_->GetResponseHeaderByName("content-disposition", | 111 request_->GetResponseHeaderByName("content-disposition", |
| 106 &content_disposition); | 112 &content_disposition); |
| 107 set_content_disposition(content_disposition); | 113 set_content_disposition(content_disposition); |
| 108 set_content_length(response->content_length); | 114 set_content_length(response->content_length); |
| 109 | 115 |
| 110 const ResourceRequestInfoImpl* request_info = | 116 const ResourceRequestInfoImpl* request_info = |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 " }", | 435 " }", |
| 430 request_ ? | 436 request_ ? |
| 431 request_->url().spec().c_str() : | 437 request_->url().spec().c_str() : |
| 432 "<NULL request>", | 438 "<NULL request>", |
| 433 download_id_.local(), | 439 download_id_.local(), |
| 434 global_id_.child_id, | 440 global_id_.child_id, |
| 435 global_id_.request_id, | 441 global_id_.request_id, |
| 436 render_view_id_, | 442 render_view_id_, |
| 437 save_info_.file_path.value().c_str()); | 443 save_info_.file_path.value().c_str()); |
| 438 } | 444 } |
| OLD | NEW |