| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 info->original_mime_type = content_type_header; | 189 info->original_mime_type = content_type_header; |
| 190 | 190 |
| 191 if (!response->head.headers || | 191 if (!response->head.headers || |
| 192 !response->head.headers->EnumerateHeader( | 192 !response->head.headers->EnumerateHeader( |
| 193 NULL, "Accept-Ranges", &accept_ranges_)) { | 193 NULL, "Accept-Ranges", &accept_ranges_)) { |
| 194 accept_ranges_ = ""; | 194 accept_ranges_ = ""; |
| 195 } | 195 } |
| 196 | 196 |
| 197 info->prompt_user_for_save_location = | 197 info->prompt_user_for_save_location = |
| 198 save_info_->prompt_for_save_location && save_info_->file_path.empty(); | 198 save_info_->prompt_for_save_location && save_info_->file_path.empty(); |
| 199 info->referrer_charset = request_->context()->referrer_charset(); | |
| 200 info->save_info = save_info_.Pass(); | 199 info->save_info = save_info_.Pass(); |
| 201 | 200 |
| 202 BrowserThread::PostTask( | 201 BrowserThread::PostTask( |
| 203 BrowserThread::UI, FROM_HERE, | 202 BrowserThread::UI, FROM_HERE, |
| 204 base::Bind(&StartOnUIThread, | 203 base::Bind(&StartOnUIThread, |
| 205 base::Passed(info.Pass()), | 204 base::Passed(info.Pass()), |
| 206 base::Passed(stream_reader.Pass()), | 205 base::Passed(stream_reader.Pass()), |
| 207 // Pass to StartOnUIThread so that variable | 206 // Pass to StartOnUIThread so that variable |
| 208 // access is always on IO thread but function | 207 // access is always on IO thread but function |
| 209 // is called on UI thread. | 208 // is called on UI thread. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // false somewhere in the chain of resource handlers. | 444 // false somewhere in the chain of resource handlers. |
| 446 CallStartedCB(NULL, net::ERR_ACCESS_DENIED); | 445 CallStartedCB(NULL, net::ERR_ACCESS_DENIED); |
| 447 | 446 |
| 448 // Remove output stream callback if a stream exists. | 447 // Remove output stream callback if a stream exists. |
| 449 if (stream_writer_.get()) | 448 if (stream_writer_.get()) |
| 450 stream_writer_->RegisterCallback(base::Closure()); | 449 stream_writer_->RegisterCallback(base::Closure()); |
| 451 | 450 |
| 452 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 451 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
| 453 base::TimeTicks::Now() - download_start_time_); | 452 base::TimeTicks::Now() - download_start_time_); |
| 454 } | 453 } |
| OLD | NEW |