Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(927)

Side by Side Diff: content/browser/download/download_request_handle.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl.cc ('k') | content/browser/download/mhtml_generation_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698