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

Unified Diff: chrome/browser/download/download_process_handle.cc

Issue 6932046: Added DownloadProcessHandle class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments. Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_process_handle.h ('k') | chrome/browser/download/download_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_process_handle.cc
diff --git a/chrome/browser/download/download_process_handle.cc b/chrome/browser/download/download_process_handle.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f4c7f321ddda56d2205eceee447831c98efcbbde
--- /dev/null
+++ b/chrome/browser/download/download_process_handle.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/download/download_process_handle.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/tab_contents/tab_util.h"
+#include "content/browser/browser_thread.h"
+#include "content/browser/tab_contents/tab_contents.h"
+
+DownloadProcessHandle::DownloadProcessHandle()
+ : child_id_(-1), render_view_id_(-1), request_id_(-1) {
+}
+
+DownloadProcessHandle::DownloadProcessHandle(int child_id,
+ int render_view_id,
+ int request_id)
+ : child_id_(child_id),
+ render_view_id_(render_view_id),
+ request_id_(request_id) {
+}
+
+TabContents* DownloadProcessHandle::GetTabContents() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return tab_util::GetTabContentsByID(child_id_, render_view_id_);
+}
+
+DownloadManager* DownloadProcessHandle::GetDownloadManager() {
+ TabContents* contents = GetTabContents();
+ if (!contents)
+ return NULL;
+
+ Profile* profile = contents->profile();
+ if (!profile)
+ return NULL;
+
+ return profile->GetDownloadManager();
+}
« no previous file with comments | « chrome/browser/download/download_process_handle.h ('k') | chrome/browser/download/download_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698