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( | |
| 138 download_util::INITIATED_BY_NAVIGATION_COUNT); | |
| 139 if (request_closed_) | 137 if (request_closed_) |
| 140 return; | 138 return; |
| 141 | 139 |
| 142 request_allowed_ = allow; | 140 request_allowed_ = allow; |
| 143 if (allow) { | 141 if (allow) { |
| 144 // And let the request continue. | 142 // And let the request continue. |
| 143 download_util::RecordDownloadSource(download_util::INITIATED_BY_NAVIGATION); | |
| 145 host_->PauseRequest(render_process_host_id_, request_id_, false); | 144 host_->PauseRequest(render_process_host_id_, request_id_, false); |
| 146 } else { | 145 } else { |
| 146 download_util::RecordDownloadSource(download_util::BLOCKED_BY_THROTTLING); | |
|
cbentzel
2012/02/07 18:29:32
I don't like having this as a separate source, as
Randy Smith (Not in Mondays)
2012/02/07 19:28:14
Moved into a "Counts" histogram at the chrome laye
| |
| 147 host_->CancelRequest(render_process_host_id_, request_id_, false); | 147 host_->CancelRequest(render_process_host_id_, request_id_, false); |
| 148 } | 148 } |
| 149 } | 149 } |
| OLD | NEW |