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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 134 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
135 "Download in progress"); | 135 "Download in progress"); |
136 } | 136 } |
137 | 137 |
138 bool DownloadResourceHandler::OnUploadProgress(uint64 position, | 138 bool DownloadResourceHandler::OnUploadProgress(uint64 position, |
139 uint64 size) { | 139 uint64 size) { |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 bool DownloadResourceHandler::OnRequestRedirected( | 143 bool DownloadResourceHandler::OnRequestRedirected( |
144 const GURL& url, | 144 const net::RedirectInfo& redirect_info, |
145 ResourceResponse* response, | 145 ResourceResponse* response, |
146 bool* defer) { | 146 bool* defer) { |
mmenke
2014/07/17 16:55:09
Was code you removed redundant, or should we be se
davidben
2014/07/17 22:03:54
Hrm, oh it's not quite redundant because requests
| |
147 // We treat a download as a main frame load, and thus update the policy URL | |
148 // on redirects. | |
149 request()->set_first_party_for_cookies(url); | |
150 return true; | 147 return true; |
151 } | 148 } |
152 | 149 |
153 // Send the download creation information to the download thread. | 150 // Send the download creation information to the download thread. |
154 bool DownloadResourceHandler::OnResponseStarted( | 151 bool DownloadResourceHandler::OnResponseStarted( |
155 ResourceResponse* response, | 152 ResourceResponse* response, |
156 bool* defer) { | 153 bool* defer) { |
157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
158 // There can be only one (call) | 155 // There can be only one (call) |
159 DCHECK(!on_response_started_called_); | 156 DCHECK(!on_response_started_called_); |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
528 // tab_info_ must be destroyed on UI thread, since | 525 // tab_info_ must be destroyed on UI thread, since |
529 // InitializeDownloadTabInfoOnUIThread might still be using it. | 526 // InitializeDownloadTabInfoOnUIThread might still be using it. |
530 if (tab_info_) | 527 if (tab_info_) |
531 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, tab_info_); | 528 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, tab_info_); |
532 | 529 |
533 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 530 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
534 base::TimeTicks::Now() - download_start_time_); | 531 base::TimeTicks::Now() - download_start_time_); |
535 } | 532 } |
536 | 533 |
537 } // namespace content | 534 } // namespace content |
OLD | NEW |