OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser_context.h" | 9 #include "content/browser/browser_context.h" |
10 #include "content/browser/renderer_host/render_view_host.h" | 10 #include "content/browser/renderer_host/render_view_host.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 if (!render_view_host) | 60 if (!render_view_host) |
61 return NULL; | 61 return NULL; |
62 | 62 |
63 return render_view_host->delegate()->GetAsTabContents(); | 63 return render_view_host->delegate()->GetAsTabContents(); |
64 } | 64 } |
65 | 65 |
66 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { | 66 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { |
67 RenderViewHost* rvh = RenderViewHost::FromID(child_id_, render_view_id_); | 67 RenderViewHost* rvh = RenderViewHost::FromID(child_id_, render_view_id_); |
68 if (rvh == NULL) | 68 if (rvh == NULL) |
69 return NULL; | 69 return NULL; |
70 RenderProcessHost* rph = rvh->process(); | 70 content::RenderProcessHost* rph = rvh->process(); |
71 if (rph == NULL) | 71 if (rph == NULL) |
72 return NULL; | 72 return NULL; |
73 content::BrowserContext* context = rph->browser_context(); | 73 content::BrowserContext* context = rph->GetBrowserContext(); |
74 if (context == NULL) | 74 if (context == NULL) |
75 return NULL; | 75 return NULL; |
76 return context->GetDownloadManager(); | 76 return context->GetDownloadManager(); |
77 } | 77 } |
78 | 78 |
79 void DownloadRequestHandle::PauseRequest() const { | 79 void DownloadRequestHandle::PauseRequest() const { |
80 // The post is safe because ResourceDispatcherHost is guaranteed | 80 // The post is safe because ResourceDispatcherHost is guaranteed |
81 // to outlive the IO thread. | 81 // to outlive the IO thread. |
82 if (rdh_) { | 82 if (rdh_) { |
83 BrowserThread::PostTask( | 83 BrowserThread::PostTask( |
(...skipping 28 matching lines...) Expand all Loading... |
112 std::string DownloadRequestHandle::DebugString() const { | 112 std::string DownloadRequestHandle::DebugString() const { |
113 return base::StringPrintf("{" | 113 return base::StringPrintf("{" |
114 " child_id = %d" | 114 " child_id = %d" |
115 " render_view_id = %d" | 115 " render_view_id = %d" |
116 " request_id = %d" | 116 " request_id = %d" |
117 "}", | 117 "}", |
118 child_id_, | 118 child_id_, |
119 render_view_id_, | 119 render_view_id_, |
120 request_id_); | 120 request_id_); |
121 } | 121 } |
OLD | NEW |