| 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 9 #include "chrome/browser/download/download_stats.h" | 11 #include "chrome/browser/download/download_stats.h" |
| 10 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 11 #include "content/public/browser/resource_controller.h" | 13 #include "content/public/browser/resource_controller.h" |
| 12 | 14 |
| 13 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 14 #include "content/public/browser/android/download_controller_android.h" | 16 #include "content/public/browser/android/download_controller_android.h" |
| 15 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 16 | 18 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 scoped_ptr<DownloadResourceThrottle::DownloadRequestInfo> info) { | 53 scoped_ptr<DownloadResourceThrottle::DownloadRequestInfo> info) { |
| 52 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 54 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 53 #if defined(OS_ANDROID) | 55 #if defined(OS_ANDROID) |
| 54 content::WebContents* contents = info->web_contents_getter.Run(); | 56 content::WebContents* contents = info->web_contents_getter.Run(); |
| 55 if (!contents) | 57 if (!contents) |
| 56 OnAcquireFileAccessPermissionDone(info.Pass(), false); | 58 OnAcquireFileAccessPermissionDone(info.Pass(), false); |
| 57 content::DownloadControllerAndroid::Get()->AcquireFileAccessPermission( | 59 content::DownloadControllerAndroid::Get()->AcquireFileAccessPermission( |
| 58 contents, base::Bind(&OnAcquireFileAccessPermissionDone, | 60 contents, base::Bind(&OnAcquireFileAccessPermissionDone, |
| 59 base::Passed(info.Pass()))); | 61 base::Passed(info.Pass()))); |
| 60 #else | 62 #else |
| 61 CanDownload(info.Pass()); | 63 CanDownload(std::move(info)); |
| 62 #endif | 64 #endif |
| 63 } | 65 } |
| 64 | 66 |
| 65 } // namespace | 67 } // namespace |
| 66 | 68 |
| 67 DownloadResourceThrottle::DownloadRequestInfo::DownloadRequestInfo( | 69 DownloadResourceThrottle::DownloadRequestInfo::DownloadRequestInfo( |
| 68 scoped_refptr<DownloadRequestLimiter> limiter, | 70 scoped_refptr<DownloadRequestLimiter> limiter, |
| 69 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, | 71 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, |
| 70 const GURL& url, | 72 const GURL& url, |
| 71 const std::string& request_method, | 73 const std::string& request_method, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 148 |
| 147 if (request_deferred_) { | 149 if (request_deferred_) { |
| 148 request_deferred_ = false; | 150 request_deferred_ = false; |
| 149 if (allow) { | 151 if (allow) { |
| 150 controller()->Resume(); | 152 controller()->Resume(); |
| 151 } else { | 153 } else { |
| 152 controller()->Cancel(); | 154 controller()->Cancel(); |
| 153 } | 155 } |
| 154 } | 156 } |
| 155 } | 157 } |
| OLD | NEW |