| 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_resource_throttle.h" | 5 #include "chrome/browser/download/download_resource_throttle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/download/download_util.h" | 8 #include "chrome/browser/download/download_util.h" |
| 9 #include "content/public/browser/resource_controller.h" | 9 #include "content/public/browser/resource_controller.h" |
| 10 | 10 |
| 11 DownloadResourceThrottle::DownloadResourceThrottle( | 11 DownloadResourceThrottle::DownloadResourceThrottle( |
| 12 DownloadRequestLimiter* limiter, | 12 DownloadRequestLimiter* limiter, |
| 13 int render_process_id, | 13 int render_process_id, |
| 14 int render_view_id, | 14 int render_view_id, |
| 15 int request_id, | 15 int request_id, |
| 16 const std::string& request_method) | 16 const std::string& request_method, |
| 17 bool has_auth) |
| 17 : querying_limiter_(true), | 18 : querying_limiter_(true), |
| 18 request_allowed_(false), | 19 request_allowed_(false), |
| 19 request_deferred_(false) { | 20 request_deferred_(false) { |
| 20 limiter->CanDownloadOnIOThread( | 21 limiter->CanDownloadOnIOThread( |
| 21 render_process_id, | 22 render_process_id, |
| 22 render_view_id, | 23 render_view_id, |
| 23 request_id, | 24 request_id, |
| 24 request_method, | 25 request_method, |
| 26 has_auth, |
| 25 base::Bind(&DownloadResourceThrottle::ContinueDownload, | 27 base::Bind(&DownloadResourceThrottle::ContinueDownload, |
| 26 AsWeakPtr())); | 28 AsWeakPtr())); |
| 27 } | 29 } |
| 28 | 30 |
| 29 DownloadResourceThrottle::~DownloadResourceThrottle() { | 31 DownloadResourceThrottle::~DownloadResourceThrottle() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 void DownloadResourceThrottle::WillStartRequest(bool* defer) { | 34 void DownloadResourceThrottle::WillStartRequest(bool* defer) { |
| 33 WillDownload(defer); | 35 WillDownload(defer); |
| 34 } | 36 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 72 |
| 71 if (request_deferred_) { | 73 if (request_deferred_) { |
| 72 request_deferred_ = false; | 74 request_deferred_ = false; |
| 73 if (allow) { | 75 if (allow) { |
| 74 controller()->Resume(); | 76 controller()->Resume(); |
| 75 } else { | 77 } else { |
| 76 controller()->Cancel(); | 78 controller()->Cancel(); |
| 77 } | 79 } |
| 78 } | 80 } |
| 79 } | 81 } |
| OLD | NEW |