summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/tab_util.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 00:59:16 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 00:59:16 +0000
commitf3ec774a2c177d3c6845553d3bf9735a7b8a5907 (patch)
treeed09ccf69300383bd4b2e8ac7c8b9d1bdeead07b /chrome/browser/tab_contents/tab_util.cc
parentbb515eda39129537a089a062c3db3152e63f24d9 (diff)
downloadchromium_src-f3ec774a2c177d3c6845553d3bf9735a7b8a5907.zip
chromium_src-f3ec774a2c177d3c6845553d3bf9735a7b8a5907.tar.gz
chromium_src-f3ec774a2c177d3c6845553d3bf9735a7b8a5907.tar.bz2
Move a bunch of TabContents related files into a tab_contents subdir
Review URL: http://codereview.chromium.org/18250 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/tab_util.cc')
-rw-r--r--chrome/browser/tab_contents/tab_util.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/tab_util.cc b/chrome/browser/tab_contents/tab_util.cc
new file mode 100644
index 0000000..a1a2f4e
--- /dev/null
+++ b/chrome/browser/tab_contents/tab_util.cc
@@ -0,0 +1,39 @@
+// Copyright (c) 2006-2008 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/tab_contents/tab_util.h"
+
+#include "chrome/browser/render_view_host.h"
+#include "chrome/browser/render_process_host.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
+#include "chrome/browser/tab_contents/web_contents.h"
+#include "net/url_request/url_request.h"
+
+bool tab_util::GetTabContentsID(URLRequest* request,
+ int* render_process_id,
+ int* render_view_id) {
+
+ if (!request || !render_process_id || !render_view_id)
+ return false;
+
+ ResourceDispatcherHost::ExtraRequestInfo* info =
+ ResourceDispatcherHost::ExtraInfoForRequest(request);
+ if (!info)
+ return false;
+
+ *render_process_id = info->render_process_host_id;
+ *render_view_id = info->render_view_id;
+ return true;
+}
+
+WebContents* tab_util::GetWebContentsByID(int render_process_id,
+ int render_view_id) {
+ RenderViewHost* render_view_host =
+ RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!render_view_host)
+ return NULL;
+
+ return static_cast<WebContents*>(render_view_host->delegate());
+}
+