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_process_handle.h" | 5 #include "chrome/browser/download/download_process_handle.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/tab_contents/tab_util.h" | 8 #include "chrome/browser/tab_contents/tab_util.h" |
9 #include "content/browser/browser_thread.h" | 9 #include "content/browser/browser_thread.h" |
10 #include "content/browser/tab_contents/tab_contents.h" | 10 #include "content/browser/tab_contents/tab_contents.h" |
11 | 11 |
12 DownloadProcessHandle::DownloadProcessHandle() | 12 DownloadProcessHandle::DownloadProcessHandle() |
13 : child_id_(-1), render_view_id_(-1), request_id_(-1) { | 13 : child_id_(-1), render_view_id_(-1), request_id_(-1) { |
14 } | 14 } |
15 | 15 |
16 DownloadProcessHandle::DownloadProcessHandle(int child_id, | 16 DownloadProcessHandle::DownloadProcessHandle(int child_id, |
17 int render_view_id, | 17 int render_view_id, |
18 int request_id) | 18 int request_id) |
19 : child_id_(child_id), | 19 : child_id_(child_id), |
20 render_view_id_(render_view_id), | 20 render_view_id_(render_view_id), |
21 request_id_(request_id) { | 21 request_id_(request_id) { |
22 } | 22 } |
23 | 23 |
24 TabContents* DownloadProcessHandle::GetTabContents() { | 24 TabContents* DownloadProcessHandle::GetTabContents() { |
25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
26 return tab_util::GetTabContentsByID(child_id_, render_view_id_); | 26 return tab_util::GetTabContentsByID(child_id_, render_view_id_); |
27 } | 27 } |
28 | 28 |
| 29 TabContentsWrapper* DownloadProcessHandle::GetTabContentsWrapper() { |
| 30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 31 return tab_util::GetTabContentsWrapperByID(child_id_, render_view_id_); |
| 32 } |
| 33 |
29 DownloadManager* DownloadProcessHandle::GetDownloadManager() { | 34 DownloadManager* DownloadProcessHandle::GetDownloadManager() { |
30 TabContents* contents = GetTabContents(); | 35 TabContents* contents = GetTabContents(); |
31 if (!contents) | 36 if (!contents) |
32 return NULL; | 37 return NULL; |
33 | 38 |
34 Profile* profile = contents->profile(); | 39 Profile* profile = contents->profile(); |
35 if (!profile) | 40 if (!profile) |
36 return NULL; | 41 return NULL; |
37 | 42 |
38 return profile->GetDownloadManager(); | 43 return profile->GetDownloadManager(); |
39 } | 44 } |
OLD | NEW |