| 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 "content/browser/download/download_resource_handler.h" | 5 #include "content/browser/download/download_resource_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 DownloadResourceHandler::~DownloadResourceHandler() { | 124 DownloadResourceHandler::~DownloadResourceHandler() { |
| 125 if (tab_info_) { | 125 if (tab_info_) { |
| 126 BrowserThread::PostTask( | 126 BrowserThread::PostTask( |
| 127 BrowserThread::UI, FROM_HERE, | 127 BrowserThread::UI, FROM_HERE, |
| 128 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_))); | 128 base::Bind(&DeleteOnUIThread, base::Passed(&tab_info_))); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 // static |
| 133 std::unique_ptr<ResourceHandler> DownloadResourceHandler::Create( |
| 134 net::URLRequest* request) { |
| 135 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 136 std::unique_ptr<ResourceHandler> handler( |
| 137 new DownloadResourceHandler(request)); |
| 138 return handler; |
| 139 } |
| 140 |
| 132 bool DownloadResourceHandler::OnRequestRedirected( | 141 bool DownloadResourceHandler::OnRequestRedirected( |
| 133 const net::RedirectInfo& redirect_info, | 142 const net::RedirectInfo& redirect_info, |
| 134 ResourceResponse* response, | 143 ResourceResponse* response, |
| 135 bool* defer) { | 144 bool* defer) { |
| 136 return core_.OnRequestRedirected(); | 145 return core_.OnRequestRedirected(); |
| 137 } | 146 } |
| 138 | 147 |
| 139 // Send the download creation information to the download thread. | 148 // Send the download creation information to the download thread. |
| 140 bool DownloadResourceHandler::OnResponseStarted( | 149 bool DownloadResourceHandler::OnResponseStarted( |
| 141 ResourceResponse* response, | 150 ResourceResponse* response, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 " }", | 251 " }", |
| 243 request() ? | 252 request() ? |
| 244 request()->url().spec().c_str() : | 253 request()->url().spec().c_str() : |
| 245 "<NULL request>", | 254 "<NULL request>", |
| 246 info->GetChildID(), | 255 info->GetChildID(), |
| 247 info->GetRequestID(), | 256 info->GetRequestID(), |
| 248 info->GetRouteID()); | 257 info->GetRouteID()); |
| 249 } | 258 } |
| 250 | 259 |
| 251 } // namespace content | 260 } // namespace content |
| OLD | NEW |