| 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_request_handle.h" | 5 #include "content/browser/download/download_request_handle.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 | 13 |
| 14 using content::BrowserContext; |
| 14 using content::BrowserThread; | 15 using content::BrowserThread; |
| 15 using content::DownloadManager; | 16 using content::DownloadManager; |
| 16 using content::RenderViewHostImpl; | 17 using content::RenderViewHostImpl; |
| 17 | 18 |
| 18 DownloadRequestHandle::~DownloadRequestHandle() { | 19 DownloadRequestHandle::~DownloadRequestHandle() { |
| 19 } | 20 } |
| 20 | 21 |
| 21 DownloadRequestHandle::DownloadRequestHandle() | 22 DownloadRequestHandle::DownloadRequestHandle() |
| 22 : child_id_(-1), | 23 : child_id_(-1), |
| 23 render_view_id_(-1), | 24 render_view_id_(-1), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID( | 50 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID( |
| 50 child_id_, render_view_id_); | 51 child_id_, render_view_id_); |
| 51 if (rvh == NULL) | 52 if (rvh == NULL) |
| 52 return NULL; | 53 return NULL; |
| 53 content::RenderProcessHost* rph = rvh->GetProcess(); | 54 content::RenderProcessHost* rph = rvh->GetProcess(); |
| 54 if (rph == NULL) | 55 if (rph == NULL) |
| 55 return NULL; | 56 return NULL; |
| 56 content::BrowserContext* context = rph->GetBrowserContext(); | 57 content::BrowserContext* context = rph->GetBrowserContext(); |
| 57 if (context == NULL) | 58 if (context == NULL) |
| 58 return NULL; | 59 return NULL; |
| 59 return context->GetDownloadManager(); | 60 return BrowserContext::GetDownloadManager(context); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void DownloadRequestHandle::PauseRequest() const { | 63 void DownloadRequestHandle::PauseRequest() const { |
| 63 BrowserThread::PostTask( | 64 BrowserThread::PostTask( |
| 64 BrowserThread::IO, FROM_HERE, | 65 BrowserThread::IO, FROM_HERE, |
| 65 base::Bind(&DownloadResourceHandler::PauseRequest, handler_)); | 66 base::Bind(&DownloadResourceHandler::PauseRequest, handler_)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void DownloadRequestHandle::ResumeRequest() const { | 69 void DownloadRequestHandle::ResumeRequest() const { |
| 69 BrowserThread::PostTask( | 70 BrowserThread::PostTask( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 80 std::string DownloadRequestHandle::DebugString() const { | 81 std::string DownloadRequestHandle::DebugString() const { |
| 81 return base::StringPrintf("{" | 82 return base::StringPrintf("{" |
| 82 " child_id = %d" | 83 " child_id = %d" |
| 83 " render_view_id = %d" | 84 " render_view_id = %d" |
| 84 " request_id = %d" | 85 " request_id = %d" |
| 85 "}", | 86 "}", |
| 86 child_id_, | 87 child_id_, |
| 87 render_view_id_, | 88 render_view_id_, |
| 88 request_id_); | 89 request_id_); |
| 89 } | 90 } |
| OLD | NEW |