| 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> | 7 #include <utility> |
| 8 | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/download/download_stats.h" | 11 #include "chrome/browser/download/download_stats.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/resource_controller.h" | 13 #include "content/public/browser/resource_controller.h" |
| 14 | 14 |
| 15 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 16 #include "content/public/browser/android/download_controller_android.h" | 16 #include "content/public/browser/android/download_controller_android.h" |
| 17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
| 18 | 18 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 &CanDownloadOnUIThread, | 97 &CanDownloadOnUIThread, |
| 98 base::Passed(scoped_ptr<DownloadRequestInfo>(new DownloadRequestInfo( | 98 base::Passed(scoped_ptr<DownloadRequestInfo>(new DownloadRequestInfo( |
| 99 limiter, web_contents_getter, url, request_method, | 99 limiter, web_contents_getter, url, request_method, |
| 100 base::Bind(&OnCanDownloadDecided, AsWeakPtr())))))); | 100 base::Bind(&OnCanDownloadDecided, AsWeakPtr())))))); |
| 101 } | 101 } |
| 102 | 102 |
| 103 DownloadResourceThrottle::~DownloadResourceThrottle() { | 103 DownloadResourceThrottle::~DownloadResourceThrottle() { |
| 104 } | 104 } |
| 105 | 105 |
| 106 void DownloadResourceThrottle::WillStartRequest(bool* defer) { | 106 void DownloadResourceThrottle::WillStartRequest(bool* defer) { |
| 107 TRACE_EVENT0("toplevel", "DownloadResourceThrottle::WillStartRequest"); |
| 107 WillDownload(defer); | 108 WillDownload(defer); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void DownloadResourceThrottle::WillRedirectRequest( | 111 void DownloadResourceThrottle::WillRedirectRequest( |
| 111 const net::RedirectInfo& redirect_info, | 112 const net::RedirectInfo& redirect_info, |
| 112 bool* defer) { | 113 bool* defer) { |
| 113 WillDownload(defer); | 114 WillDownload(defer); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void DownloadResourceThrottle::WillProcessResponse(bool* defer) { | 117 void DownloadResourceThrottle::WillProcessResponse(bool* defer) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 if (request_deferred_) { | 152 if (request_deferred_) { |
| 152 request_deferred_ = false; | 153 request_deferred_ = false; |
| 153 if (allow) { | 154 if (allow) { |
| 154 controller()->Resume(); | 155 controller()->Resume(); |
| 155 } else { | 156 } else { |
| 156 controller()->Cancel(); | 157 controller()->Cancel(); |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 } | 160 } |
| OLD | NEW |