OLD | NEW |
1 // Copyright (c) 2011 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.h" | 9 #include "content/browser/renderer_host/render_view_host.h" |
10 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 10 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
11 #include "content/browser/tab_contents/tab_contents.h" | 11 #include "content/browser/tab_contents/tab_contents.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 : rdh_(rdh), | 49 : rdh_(rdh), |
50 child_id_(child_id), | 50 child_id_(child_id), |
51 render_view_id_(render_view_id), | 51 render_view_id_(render_view_id), |
52 request_id_(request_id) { | 52 request_id_(request_id) { |
53 // ResourceDispatcherHost should not be null for non-default instances | 53 // ResourceDispatcherHost should not be null for non-default instances |
54 // of DownloadRequestHandle. | 54 // of DownloadRequestHandle. |
55 DCHECK(rdh); | 55 DCHECK(rdh); |
56 } | 56 } |
57 | 57 |
58 TabContents* DownloadRequestHandle::GetTabContents() const { | 58 TabContents* DownloadRequestHandle::GetTabContents() const { |
59 RenderViewHost* render_view_host = | 59 RenderViewHostImpl* render_view_host = |
60 RenderViewHost::FromID(child_id_, render_view_id_); | 60 RenderViewHostImpl::FromID(child_id_, render_view_id_); |
61 if (!render_view_host) | 61 if (!render_view_host) |
62 return NULL; | 62 return NULL; |
63 | 63 |
64 return static_cast<TabContents*>( | 64 return static_cast<TabContents*>( |
65 render_view_host->delegate()->GetAsWebContents()); | 65 render_view_host->GetDelegate()->GetAsWebContents()); |
66 } | 66 } |
67 | 67 |
68 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { | 68 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { |
69 RenderViewHost* rvh = RenderViewHost::FromID(child_id_, render_view_id_); | 69 RenderViewHostImpl* rvh = RenderViewHostImpl::FromID( |
| 70 child_id_, render_view_id_); |
70 if (rvh == NULL) | 71 if (rvh == NULL) |
71 return NULL; | 72 return NULL; |
72 content::RenderProcessHost* rph = rvh->process(); | 73 content::RenderProcessHost* rph = rvh->GetProcess(); |
73 if (rph == NULL) | 74 if (rph == NULL) |
74 return NULL; | 75 return NULL; |
75 content::BrowserContext* context = rph->GetBrowserContext(); | 76 content::BrowserContext* context = rph->GetBrowserContext(); |
76 if (context == NULL) | 77 if (context == NULL) |
77 return NULL; | 78 return NULL; |
78 return context->GetDownloadManager(); | 79 return context->GetDownloadManager(); |
79 } | 80 } |
80 | 81 |
81 void DownloadRequestHandle::PauseRequest() const { | 82 void DownloadRequestHandle::PauseRequest() const { |
82 // The post is safe because ResourceDispatcherHost is guaranteed | 83 // The post is safe because ResourceDispatcherHost is guaranteed |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 std::string DownloadRequestHandle::DebugString() const { | 115 std::string DownloadRequestHandle::DebugString() const { |
115 return base::StringPrintf("{" | 116 return base::StringPrintf("{" |
116 " child_id = %d" | 117 " child_id = %d" |
117 " render_view_id = %d" | 118 " render_view_id = %d" |
118 " request_id = %d" | 119 " request_id = %d" |
119 "}", | 120 "}", |
120 child_id_, | 121 child_id_, |
121 render_view_id_, | 122 render_view_id_, |
122 request_id_); | 123 request_id_); |
123 } | 124 } |
OLD | NEW |