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

Side by Side Diff: chrome/browser/extensions/extension_message_service.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_message_service.h" 5 #include "chrome/browser/extensions/extension_message_service.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 content::RenderProcessHost* source = 187 content::RenderProcessHost* source =
188 content::RenderProcessHost::FromID(source_process_id); 188 content::RenderProcessHost::FromID(source_process_id);
189 if (!source) 189 if (!source)
190 return; 190 return;
191 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); 191 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext());
192 192
193 TabContentsWrapper* contents = NULL; 193 TabContentsWrapper* contents = NULL;
194 MessagePort receiver; 194 MessagePort receiver;
195 if (ExtensionTabUtil::GetTabById(tab_id, profile, true, 195 if (ExtensionTabUtil::GetTabById(tab_id, profile, true,
196 NULL, NULL, &contents, NULL)) { 196 NULL, NULL, &contents, NULL)) {
197 receiver.sender = contents->render_view_host(); 197 receiver.sender = contents->tab_contents()->render_view_host();
198 receiver.routing_id = contents->render_view_host()->routing_id(); 198 receiver.routing_id =
199 contents->tab_contents()->render_view_host()->routing_id();
199 } 200 }
200 201
201 if (contents && contents->controller().needs_reload()) { 202 if (contents && contents->tab_contents()->controller().needs_reload()) {
202 // The tab isn't loaded yet. Don't attempt to connect. Treat this as a 203 // The tab isn't loaded yet. Don't attempt to connect. Treat this as a
203 // disconnect. 204 // disconnect.
204 DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL), 205 DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL),
205 GET_OPPOSITE_PORT_ID(receiver_port_id), true); 206 GET_OPPOSITE_PORT_ID(receiver_port_id), true);
206 return; 207 return;
207 } 208 }
208 209
209 TabContents* source_contents = tab_util::GetTabContentsByID( 210 TabContents* source_contents = tab_util::GetTabContentsByID(
210 source_process_id, source_routing_id); 211 source_process_id, source_routing_id);
211 212
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 375
375 if (current->second->opener.sender == sender) { 376 if (current->second->opener.sender == sender) {
376 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), 377 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first),
377 notify_other_port); 378 notify_other_port);
378 } else if (current->second->receiver.sender == sender) { 379 } else if (current->second->receiver.sender == sender) {
379 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), 380 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first),
380 notify_other_port); 381 notify_other_port);
381 } 382 }
382 } 383 }
383 } 384 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_devtools_bridge.cc ('k') | chrome/browser/extensions/extension_page_actions_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698