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

Side by Side Diff: chrome/browser/extensions/extension_tab_id_map.cc

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/extensions/extension_tab_id_map.h" 5 #include "chrome/browser/extensions/extension_tab_id_map.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/sessions/restore_tab_helper.h" 9 #include "chrome/browser/sessions/restore_tab_helper.h"
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 &ExtensionTabIdMap::SetTabAndWindowId, 75 &ExtensionTabIdMap::SetTabAndWindowId,
76 base::Unretained(ExtensionTabIdMap::GetInstance()), 76 base::Unretained(ExtensionTabIdMap::GetInstance()),
77 host->process()->GetID(), host->routing_id(), 77 host->process()->GetID(), host->routing_id(),
78 tab->restore_tab_helper()->session_id().id(), 78 tab->restore_tab_helper()->session_id().id(),
79 tab->restore_tab_helper()->window_id().id())); 79 tab->restore_tab_helper()->window_id().id()));
80 break; 80 break;
81 } 81 }
82 case content::NOTIFICATION_TAB_PARENTED: { 82 case content::NOTIFICATION_TAB_PARENTED: {
83 TabContentsWrapper* tab = 83 TabContentsWrapper* tab =
84 content::Source<TabContentsWrapper>(source).ptr(); 84 content::Source<TabContentsWrapper>(source).ptr();
85 RenderViewHost* host = tab->render_view_host(); 85 RenderViewHost* host = tab->tab_contents()->render_view_host();
86 BrowserThread::PostTask( 86 BrowserThread::PostTask(
87 BrowserThread::IO, FROM_HERE, 87 BrowserThread::IO, FROM_HERE,
88 base::Bind( 88 base::Bind(
89 &ExtensionTabIdMap::SetTabAndWindowId, 89 &ExtensionTabIdMap::SetTabAndWindowId,
90 base::Unretained(ExtensionTabIdMap::GetInstance()), 90 base::Unretained(ExtensionTabIdMap::GetInstance()),
91 host->process()->GetID(), host->routing_id(), 91 host->process()->GetID(), host->routing_id(),
92 tab->restore_tab_helper()->session_id().id(), 92 tab->restore_tab_helper()->session_id().id(),
93 tab->restore_tab_helper()->window_id().id())); 93 tab->restore_tab_helper()->window_id().id()));
94 break; 94 break;
95 } 95 }
96 case content::NOTIFICATION_RETARGETING: { 96 case content::NOTIFICATION_RETARGETING: {
97 content::RetargetingDetails* retargeting_details = 97 content::RetargetingDetails* retargeting_details =
98 content::Details<content::RetargetingDetails>(details).ptr(); 98 content::Details<content::RetargetingDetails>(details).ptr();
99 TabContents* contents = retargeting_details->target_tab_contents; 99 TabContents* contents = retargeting_details->target_tab_contents;
100 TabContentsWrapper* tab = 100 TabContentsWrapper* tab =
101 TabContentsWrapper::GetCurrentWrapperForContents(contents); 101 TabContentsWrapper::GetCurrentWrapperForContents(contents);
102 if (!tab) 102 if (!tab)
103 break; 103 break;
104 RenderViewHost* host = tab->render_view_host(); 104 RenderViewHost* host = tab->tab_contents()->render_view_host();
105 BrowserThread::PostTask( 105 BrowserThread::PostTask(
106 BrowserThread::IO, FROM_HERE, 106 BrowserThread::IO, FROM_HERE,
107 base::Bind( 107 base::Bind(
108 &ExtensionTabIdMap::SetTabAndWindowId, 108 &ExtensionTabIdMap::SetTabAndWindowId,
109 base::Unretained(ExtensionTabIdMap::GetInstance()), 109 base::Unretained(ExtensionTabIdMap::GetInstance()),
110 host->process()->GetID(), host->routing_id(), 110 host->process()->GetID(), host->routing_id(),
111 tab->restore_tab_helper()->session_id().id(), 111 tab->restore_tab_helper()->session_id().id(),
112 tab->restore_tab_helper()->window_id().id())); 112 tab->restore_tab_helper()->window_id().id()));
113 break; 113 break;
114 } 114 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 170 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
171 RenderId render_id(render_process_host_id, routing_id); 171 RenderId render_id(render_process_host_id, routing_id);
172 TabAndWindowIdMap::iterator iter = map_.find(render_id); 172 TabAndWindowIdMap::iterator iter = map_.find(render_id);
173 if (iter != map_.end()) { 173 if (iter != map_.end()) {
174 *tab_id = iter->second.first; 174 *tab_id = iter->second.first;
175 *window_id = iter->second.second; 175 *window_id = iter->second.second;
176 return true; 176 return true;
177 } 177 }
178 return false; 178 return false;
179 } 179 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_tab_helper.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698