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 <string> | |
Paweł Hajdan Jr.
2011/05/06 18:04:42
nit: Why?
ahendrickson
2011/05/09 15:57:31
Removed.
| |
8 | |
9 #include "base/file_util.h" | |
Paweł Hajdan Jr.
2011/05/06 18:04:42
nit: What's going on with all those #includes? We
ahendrickson
2011/05/09 15:57:31
Sorry about that. I had split this file off from
| |
10 #include "base/stringprintf.h" | |
11 #include "chrome/browser/download/download_manager.h" | |
12 #include "chrome/browser/download/download_util.h" | |
13 #include "chrome/browser/profiles/profile.h" | |
14 #include "chrome/browser/tab_contents/tab_util.h" | |
15 #include "content/browser/browser_thread.h" | |
16 #include "content/browser/renderer_host/resource_dispatcher_host.h" | |
17 #include "content/browser/tab_contents/tab_contents.h" | |
18 | |
19 DownloadProcessHandle::DownloadProcessHandle() | |
20 : child_id_(-1), render_view_id_(-1), request_id_(-1) { | |
21 } | |
22 | |
23 DownloadProcessHandle::DownloadProcessHandle(int child_id, | |
24 int render_view_id, | |
25 int request_id) | |
26 : child_id_(child_id), | |
27 render_view_id_(render_view_id), | |
28 request_id_(request_id) { | |
29 } | |
30 | |
31 TabContents* DownloadProcessHandle::GetTabContents() { | |
32 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
33 return tab_util::GetTabContentsByID(child_id_, render_view_id_); | |
34 } | |
35 | |
36 DownloadManager* DownloadProcessHandle::GetDownloadManager() { | |
37 TabContents* contents = GetTabContents(); | |
38 if (!contents) | |
39 return NULL; | |
40 | |
41 Profile* profile = contents->profile(); | |
42 if (!profile) | |
43 return NULL; | |
44 | |
45 return profile->GetDownloadManager(); | |
46 } | |
OLD | NEW |