| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/tab_util.h" | 5 #include "chrome/browser/tab_contents/tab_util.h" |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/render_process_host.h" | 7 #include "chrome/browser/renderer_host/render_process_host.h" |
| 8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
| 9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 if (!info) | 22 if (!info) |
| 23 return false; | 23 return false; |
| 24 | 24 |
| 25 *render_process_id = info->process_id; | 25 *render_process_id = info->process_id; |
| 26 *render_view_id = info->route_id; | 26 *render_view_id = info->route_id; |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 | 29 |
| 30 TabContents* tab_util::GetTabContentsByID(int render_process_id, | 30 TabContents* tab_util::GetTabContentsByID(int render_process_id, |
| 31 int render_view_id) { | 31 int render_view_id) { |
| 32 // Ensures that that this method is only ever called on the UI thread. |
| 33 |
| 34 // TODO(yuzo): Fix the callers and uncomment the following. |
| 35 // DCHECK_EQ(MessageLoop::TYPE_UI, MessageLoop::current()->type()); |
| 36 |
| 32 RenderViewHost* render_view_host = | 37 RenderViewHost* render_view_host = |
| 33 RenderViewHost::FromID(render_process_id, render_view_id); | 38 RenderViewHost::FromID(render_process_id, render_view_id); |
| 34 if (!render_view_host) | 39 if (!render_view_host) |
| 35 return NULL; | 40 return NULL; |
| 36 | 41 |
| 37 return render_view_host->delegate()->GetAsTabContents(); | 42 return render_view_host->delegate()->GetAsTabContents(); |
| 38 } | 43 } |
| OLD | NEW |