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