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 "chrome/browser/download/download_throttling_resource_handler.h" | 5 #include "chrome/browser/download/download_throttling_resource_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/download/download_request_limiter.h" | 8 #include "chrome/browser/download/download_request_limiter.h" |
| 9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
| 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 } | 127 } |
| 128 | 128 |
| 129 void DownloadThrottlingResourceHandler::OnRequestClosed() { | 129 void DownloadThrottlingResourceHandler::OnRequestClosed() { |
| 130 DCHECK(!request_closed_); | 130 DCHECK(!request_closed_); |
| 131 if (request_allowed_) | 131 if (request_allowed_) |
| 132 next_handler_->OnRequestClosed(); | 132 next_handler_->OnRequestClosed(); |
| 133 request_closed_ = true; | 133 request_closed_ = true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void DownloadThrottlingResourceHandler::ContinueDownload(bool allow) { | 136 void DownloadThrottlingResourceHandler::ContinueDownload(bool allow) { |
| 137 download_util::RecordDownloadCount( | 137 download_util::RecordDownloadSource(download_util::INITIATED_BY_NAVIGATION); |
|
cbentzel
2012/02/06 19:57:29
Should this be done here or at the BufferedResourc
Randy Smith (Not in Mondays)
2012/02/07 18:20:18
Depends how we're thinking of the stats. I'm more
| |
| 138 download_util::INITIATED_BY_NAVIGATION_COUNT); | |
| 139 if (request_closed_) | 138 if (request_closed_) |
| 140 return; | 139 return; |
| 141 | 140 |
| 142 request_allowed_ = allow; | 141 request_allowed_ = allow; |
| 143 if (allow) { | 142 if (allow) { |
| 144 // And let the request continue. | 143 // And let the request continue. |
| 145 host_->PauseRequest(render_process_host_id_, request_id_, false); | 144 host_->PauseRequest(render_process_host_id_, request_id_, false); |
| 146 } else { | 145 } else { |
| 147 host_->CancelRequest(render_process_host_id_, request_id_, false); | 146 host_->CancelRequest(render_process_host_id_, request_id_, false); |
| 148 } | 147 } |
| 149 } | 148 } |
| OLD | NEW |