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 "chrome/browser/download/download_request_handle.h" | 5 #include "chrome/browser/download/download_request_handle.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/tab_contents/tab_util.h" | 9 #include "chrome/browser/tab_contents/tab_util.h" |
10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 TabContents* DownloadRequestHandle::GetTabContents() const { | 54 TabContents* DownloadRequestHandle::GetTabContents() const { |
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
56 return tab_util::GetTabContentsByID(child_id_, render_view_id_); | 56 return tab_util::GetTabContentsByID(child_id_, render_view_id_); |
57 } | 57 } |
58 | 58 |
59 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { | 59 DownloadManager* DownloadRequestHandle::GetDownloadManager() const { |
60 TabContents* contents = GetTabContents(); | 60 TabContents* contents = GetTabContents(); |
61 if (!contents) | 61 if (!contents) |
62 return NULL; | 62 return NULL; |
63 | 63 |
64 Profile* profile = contents->profile(); | 64 Profile* profile = static_cast<Profile*>(contents->browser_context()); |
65 if (!profile) | 65 if (!profile) |
66 return NULL; | 66 return NULL; |
67 | 67 |
68 return profile->GetDownloadManager(); | 68 return profile->GetDownloadManager(); |
69 } | 69 } |
70 | 70 |
71 void DownloadRequestHandle::PauseRequest() const { | 71 void DownloadRequestHandle::PauseRequest() const { |
72 // The post is safe because ResourceDispatcherHost is guaranteed | 72 // The post is safe because ResourceDispatcherHost is guaranteed |
73 // to outlive the IO thread. | 73 // to outlive the IO thread. |
74 if (rdh_) { | 74 if (rdh_) { |
(...skipping 29 matching lines...) Expand all Loading... |
104 std::string DownloadRequestHandle::DebugString() const { | 104 std::string DownloadRequestHandle::DebugString() const { |
105 return base::StringPrintf("{" | 105 return base::StringPrintf("{" |
106 " child_id = %d" | 106 " child_id = %d" |
107 " render_view_id = %d" | 107 " render_view_id = %d" |
108 " request_id = %d" | 108 " request_id = %d" |
109 "}", | 109 "}", |
110 child_id_, | 110 child_id_, |
111 render_view_id_, | 111 render_view_id_, |
112 request_id_); | 112 request_id_); |
113 } | 113 } |
OLD | NEW |