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

Side by Side Diff: chrome/browser/extensions/api/messaging/message_service.cc

Issue 166053003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 2). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: | Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/messaging/message_service.h" 5 #include "chrome/browser/extensions/api/messaging/message_service.h"
6 6
7 #include "base/atomic_sequence_num.h" 7 #include "base/atomic_sequence_num.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/common/extensions/extension_messages.h" 26 #include "chrome/common/extensions/extension_messages.h"
27 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h" 27 #include "chrome/common/extensions/manifest_handlers/externally_connectable.h"
28 #include "content/public/browser/notification_service.h" 28 #include "content/public/browser/notification_service.h"
29 #include "content/public/browser/render_process_host.h" 29 #include "content/public/browser/render_process_host.h"
30 #include "content/public/browser/render_view_host.h" 30 #include "content/public/browser/render_view_host.h"
31 #include "content/public/browser/render_widget_host.h" 31 #include "content/public/browser/render_widget_host.h"
32 #include "content/public/browser/render_widget_host_view.h" 32 #include "content/public/browser/render_widget_host_view.h"
33 #include "content/public/browser/site_instance.h" 33 #include "content/public/browser/site_instance.h"
34 #include "content/public/browser/web_contents.h" 34 #include "content/public/browser/web_contents.h"
35 #include "extensions/browser/extension_system.h" 35 #include "extensions/browser/extension_system.h"
36 #include "extensions/browser/extensions_browser_client.h"
36 #include "extensions/browser/lazy_background_task_queue.h" 37 #include "extensions/browser/lazy_background_task_queue.h"
37 #include "extensions/browser/process_manager.h" 38 #include "extensions/browser/process_manager.h"
38 #include "extensions/common/extension.h" 39 #include "extensions/common/extension.h"
39 #include "extensions/common/manifest_constants.h" 40 #include "extensions/common/manifest_constants.h"
40 #include "extensions/common/manifest_handlers/background_info.h" 41 #include "extensions/common/manifest_handlers/background_info.h"
41 #include "extensions/common/manifest_handlers/incognito_info.h" 42 #include "extensions/common/manifest_handlers/incognito_info.h"
42 #include "net/base/completion_callback.h" 43 #include "net/base/completion_callback.h"
43 #include "url/gurl.h" 44 #include "url/gurl.h"
44 45
46 using content::BrowserContext;
45 using content::SiteInstance; 47 using content::SiteInstance;
46 using content::WebContents; 48 using content::WebContents;
47 49
48 // Since we have 2 ports for every channel, we just index channels by half the 50 // Since we have 2 ports for every channel, we just index channels by half the
49 // port ID. 51 // port ID.
50 #define GET_CHANNEL_ID(port_id) ((port_id) / 2) 52 #define GET_CHANNEL_ID(port_id) ((port_id) / 2)
51 #define GET_CHANNEL_OPENER_ID(channel_id) ((channel_id) * 2) 53 #define GET_CHANNEL_OPENER_ID(channel_id) ((channel_id) * 2)
52 #define GET_CHANNEL_RECEIVERS_ID(channel_id) ((channel_id) * 2 + 1) 54 #define GET_CHANNEL_RECEIVERS_ID(channel_id) ((channel_id) * 2 + 1)
53 55
54 // Port1 is always even, port2 is always odd. 56 // Port1 is always even, port2 is always odd.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 private: 113 private:
112 DISALLOW_COPY_AND_ASSIGN(OpenChannelParams); 114 DISALLOW_COPY_AND_ASSIGN(OpenChannelParams);
113 }; 115 };
114 116
115 namespace { 117 namespace {
116 118
117 static base::StaticAtomicSequenceNumber g_next_channel_id; 119 static base::StaticAtomicSequenceNumber g_next_channel_id;
118 static base::StaticAtomicSequenceNumber g_channel_id_overflow_count; 120 static base::StaticAtomicSequenceNumber g_channel_id_overflow_count;
119 121
120 static content::RenderProcessHost* GetExtensionProcess( 122 static content::RenderProcessHost* GetExtensionProcess(
121 Profile* profile, const std::string& extension_id) { 123 BrowserContext* context,
124 const std::string& extension_id) {
122 SiteInstance* site_instance = 125 SiteInstance* site_instance =
123 ExtensionSystem::Get(profile)->process_manager()->GetSiteInstanceForURL( 126 ExtensionSystem::Get(context)->process_manager()->GetSiteInstanceForURL(
124 Extension::GetBaseURLFromExtensionId(extension_id)); 127 Extension::GetBaseURLFromExtensionId(extension_id));
125 return site_instance->HasProcess() ? site_instance->GetProcess() : NULL; 128 return site_instance->HasProcess() ? site_instance->GetProcess() : NULL;
126 } 129 }
127 130
128 } // namespace 131 } // namespace
129 132
130 content::RenderProcessHost* 133 content::RenderProcessHost*
131 MessageService::MessagePort::GetRenderProcessHost() { 134 MessageService::MessagePort::GetRenderProcessHost() {
132 return NULL; 135 return NULL;
133 } 136 }
(...skipping 18 matching lines...) Expand all
152 DCHECK_EQ(GET_OPPOSITE_PORT_ID(port2_id), port1_id); 155 DCHECK_EQ(GET_OPPOSITE_PORT_ID(port2_id), port1_id);
153 DCHECK_EQ(GET_CHANNEL_ID(port1_id), GET_CHANNEL_ID(port2_id)); 156 DCHECK_EQ(GET_CHANNEL_ID(port1_id), GET_CHANNEL_ID(port2_id));
154 DCHECK_EQ(GET_CHANNEL_ID(port1_id), channel_id); 157 DCHECK_EQ(GET_CHANNEL_ID(port1_id), channel_id);
155 DCHECK_EQ(GET_CHANNEL_OPENER_ID(channel_id), port1_id); 158 DCHECK_EQ(GET_CHANNEL_OPENER_ID(channel_id), port1_id);
156 DCHECK_EQ(GET_CHANNEL_RECEIVERS_ID(channel_id), port2_id); 159 DCHECK_EQ(GET_CHANNEL_RECEIVERS_ID(channel_id), port2_id);
157 160
158 *port1 = port1_id; 161 *port1 = port1_id;
159 *port2 = port2_id; 162 *port2 = port2_id;
160 } 163 }
161 164
162 MessageService::MessageService(Profile* profile) 165 MessageService::MessageService(BrowserContext* context)
163 : lazy_background_task_queue_( 166 : lazy_background_task_queue_(
164 ExtensionSystem::Get(profile)->lazy_background_task_queue()), 167 ExtensionSystem::Get(context)->lazy_background_task_queue()),
165 weak_factory_(this) { 168 weak_factory_(this) {
166 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, 169 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
167 content::NotificationService::AllBrowserContextsAndSources()); 170 content::NotificationService::AllBrowserContextsAndSources());
168 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 171 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
169 content::NotificationService::AllBrowserContextsAndSources()); 172 content::NotificationService::AllBrowserContextsAndSources());
170 } 173 }
171 174
172 MessageService::~MessageService() { 175 MessageService::~MessageService() {
173 STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end()); 176 STLDeleteContainerPairSecondPointers(channels_.begin(), channels_.end());
174 channels_.clear(); 177 channels_.clear();
175 } 178 }
176 179
177 static base::LazyInstance<ProfileKeyedAPIFactory<MessageService> > 180 static base::LazyInstance<ProfileKeyedAPIFactory<MessageService> >
178 g_factory = LAZY_INSTANCE_INITIALIZER; 181 g_factory = LAZY_INSTANCE_INITIALIZER;
179 182
180 // static 183 // static
181 ProfileKeyedAPIFactory<MessageService>* MessageService::GetFactoryInstance() { 184 ProfileKeyedAPIFactory<MessageService>* MessageService::GetFactoryInstance() {
182 return g_factory.Pointer(); 185 return g_factory.Pointer();
183 } 186 }
184 187
185 // static 188 // static
186 MessageService* MessageService::Get(content::BrowserContext* context) { 189 MessageService* MessageService::Get(BrowserContext* context) {
187 Profile* profile = Profile::FromBrowserContext(context); 190 return ProfileKeyedAPIFactory<MessageService>::GetForProfile(context);
188 return ProfileKeyedAPIFactory<MessageService>::GetForProfile(profile);
189 } 191 }
190 192
191 void MessageService::OpenChannelToExtension( 193 void MessageService::OpenChannelToExtension(
192 int source_process_id, int source_routing_id, int receiver_port_id, 194 int source_process_id, int source_routing_id, int receiver_port_id,
193 const std::string& source_extension_id, 195 const std::string& source_extension_id,
194 const std::string& target_extension_id, 196 const std::string& target_extension_id,
195 const GURL& source_url, 197 const GURL& source_url,
196 const std::string& channel_name, 198 const std::string& channel_name,
197 bool include_tls_channel_id) { 199 bool include_tls_channel_id) {
198 content::RenderProcessHost* source = 200 content::RenderProcessHost* source =
199 content::RenderProcessHost::FromID(source_process_id); 201 content::RenderProcessHost::FromID(source_process_id);
200 if (!source) 202 if (!source)
201 return; 203 return;
202 Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); 204 BrowserContext* context = source->GetBrowserContext();
203 205
204 ExtensionSystem* extension_system = ExtensionSystem::Get(profile); 206 ExtensionSystem* extension_system = ExtensionSystem::Get(context);
205 DCHECK(extension_system); 207 DCHECK(extension_system);
206 const Extension* target_extension = extension_system->extension_service()-> 208 const Extension* target_extension = extension_system->extension_service()->
207 extensions()->GetByID(target_extension_id); 209 extensions()->GetByID(target_extension_id);
208 if (!target_extension) { 210 if (!target_extension) {
209 DispatchOnDisconnect( 211 DispatchOnDisconnect(
210 source, receiver_port_id, kReceivingEndDoesntExistError); 212 source, receiver_port_id, kReceivingEndDoesntExistError);
211 return; 213 return;
212 } 214 }
213 215
214 // Only running ephemeral apps can receive messages. Idle cached ephemeral 216 // Only running ephemeral apps can receive messages. Idle cached ephemeral
215 // apps are invisible and should not be connectable. 217 // apps are invisible and should not be connectable.
216 if (target_extension->is_ephemeral() && 218 if (target_extension->is_ephemeral() &&
217 util::IsExtensionIdle(target_extension_id, profile)) { 219 util::IsExtensionIdle(target_extension_id, context)) {
218 DispatchOnDisconnect( 220 DispatchOnDisconnect(
219 source, receiver_port_id, kReceivingEndDoesntExistError); 221 source, receiver_port_id, kReceivingEndDoesntExistError);
220 return; 222 return;
221 } 223 }
222 224
223 bool is_web_connection = false; 225 bool is_web_connection = false;
224 226
225 if (source_extension_id != target_extension_id) { 227 if (source_extension_id != target_extension_id) {
226 // It's an external connection. Check the externally_connectable manifest 228 // It's an external connection. Check the externally_connectable manifest
227 // key if it's present. If it's not, we allow connection from any extension 229 // key if it's present. If it's not, we allow connection from any extension
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // indistinguishable from the extension just not existing. 262 // indistinguishable from the extension just not existing.
261 DispatchOnDisconnect( 263 DispatchOnDisconnect(
262 source, receiver_port_id, kReceivingEndDoesntExistError); 264 source, receiver_port_id, kReceivingEndDoesntExistError);
263 return; 265 return;
264 } 266 }
265 } 267 }
266 268
267 WebContents* source_contents = tab_util::GetWebContentsByID( 269 WebContents* source_contents = tab_util::GetWebContentsByID(
268 source_process_id, source_routing_id); 270 source_process_id, source_routing_id);
269 271
270 if (profile->IsOffTheRecord() && 272 if (context->IsOffTheRecord() &&
271 !util::IsIncognitoEnabled(target_extension_id, profile)) { 273 !util::IsIncognitoEnabled(target_extension_id, context)) {
272 // Give the user a chance to accept an incognito connection if they haven't 274 // Give the user a chance to accept an incognito connection if they haven't
273 // already - but only for spanning-mode incognito. We don't want the 275 // already - but only for spanning-mode incognito. We don't want the
274 // complication of spinning up an additional process here which might need 276 // complication of spinning up an additional process here which might need
275 // to do some setup that we're not expecting. 277 // to do some setup that we're not expecting.
276 if (!is_web_connection || 278 if (!is_web_connection || IncognitoInfo::IsSplitMode(target_extension) ||
277 IncognitoInfo::IsSplitMode(target_extension) || 279 !IncognitoConnectability::Get(context)
278 !IncognitoConnectability::Get(profile)->Query(target_extension, 280 ->Query(target_extension, source_contents, source_url)) {
279 source_contents,
280 source_url)) {
281 DispatchOnDisconnect( 281 DispatchOnDisconnect(
282 source, receiver_port_id, kReceivingEndDoesntExistError); 282 source, receiver_port_id, kReceivingEndDoesntExistError);
283 return; 283 return;
284 } 284 }
285 } 285 }
286 286
287 // Note: we use the source's profile here. If the source is an incognito 287 // Note: we use the source's profile here. If the source is an incognito
288 // process, we will use the incognito EPM to find the right extension process, 288 // process, we will use the incognito EPM to find the right extension process,
289 // which depends on whether the extension uses spanning or split mode. 289 // which depends on whether the extension uses spanning or split mode.
290 MessagePort* receiver = new ExtensionMessagePort( 290 MessagePort* receiver = new ExtensionMessagePort(
291 GetExtensionProcess(profile, target_extension_id), MSG_ROUTING_CONTROL, 291 GetExtensionProcess(context, target_extension_id),
292 MSG_ROUTING_CONTROL,
292 target_extension_id); 293 target_extension_id);
293 294
294 // Include info about the opener's tab (if it was a tab). 295 // Include info about the opener's tab (if it was a tab).
295 scoped_ptr<base::DictionaryValue> source_tab; 296 scoped_ptr<base::DictionaryValue> source_tab;
296 GURL source_url_for_tab; 297 GURL source_url_for_tab;
297 298
298 if (source_contents && ExtensionTabUtil::GetTabId(source_contents) >= 0) { 299 if (source_contents && ExtensionTabUtil::GetTabId(source_contents) >= 0) {
299 // Only the tab id is useful to platform apps for internal use. The 300 // Only the tab id is useful to platform apps for internal use. The
300 // unnecessary bits will be stripped out in 301 // unnecessary bits will be stripped out in
301 // MessagingBindings::DispatchOnConnect(). 302 // MessagingBindings::DispatchOnConnect().
(...skipping 12 matching lines...) Expand all
314 include_tls_channel_id); 315 include_tls_channel_id);
315 316
316 // If the target requests the TLS channel id, begin the lookup for it. 317 // If the target requests the TLS channel id, begin the lookup for it.
317 // The target might also be a lazy background page, checked next, but the 318 // The target might also be a lazy background page, checked next, but the
318 // loading of lazy background pages continues asynchronously, so enqueue 319 // loading of lazy background pages continues asynchronously, so enqueue
319 // messages awaiting TLS channel ID first. 320 // messages awaiting TLS channel ID first.
320 if (include_tls_channel_id) { 321 if (include_tls_channel_id) {
321 pending_tls_channel_id_channels_[GET_CHANNEL_ID(params->receiver_port_id)] 322 pending_tls_channel_id_channels_[GET_CHANNEL_ID(params->receiver_port_id)]
322 = PendingMessagesQueue(); 323 = PendingMessagesQueue();
323 property_provider_.GetDomainBoundCert( 324 property_provider_.GetDomainBoundCert(
324 profile, 325 Profile::FromBrowserContext(context),
325 source_url, 326 source_url,
326 base::Bind(&MessageService::GotDomainBoundCert, 327 base::Bind(&MessageService::GotDomainBoundCert,
327 weak_factory_.GetWeakPtr(), 328 weak_factory_.GetWeakPtr(),
328 base::Passed(make_scoped_ptr(params)))); 329 base::Passed(make_scoped_ptr(params))));
329 return; 330 return;
330 } 331 }
331 332
332 // The target might be a lazy background page. In that case, we have to check 333 // The target might be a lazy background page. In that case, we have to check
333 // if it is loaded and ready, and if not, queue up the task and load the 334 // if it is loaded and ready, and if not, queue up the task and load the
334 // page. 335 // page.
335 if (MaybeAddPendingLazyBackgroundPageOpenChannelTask(profile, 336 if (MaybeAddPendingLazyBackgroundPageOpenChannelTask(
336 target_extension, 337 context, target_extension, params)) {
337 params)) {
338 return; 338 return;
339 } 339 }
340 340
341 OpenChannelImpl(make_scoped_ptr(params)); 341 OpenChannelImpl(make_scoped_ptr(params));
342 } 342 }
343 343
344 void MessageService::OpenChannelToNativeApp( 344 void MessageService::OpenChannelToNativeApp(
345 int source_process_id, 345 int source_process_id,
346 int source_routing_id, 346 int source_routing_id,
347 int receiver_port_id, 347 int receiver_port_id,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 const Message& message) { 647 const Message& message) {
648 // Figure out which port the ID corresponds to. 648 // Figure out which port the ID corresponds to.
649 int dest_port_id = GET_OPPOSITE_PORT_ID(source_port_id); 649 int dest_port_id = GET_OPPOSITE_PORT_ID(source_port_id);
650 MessagePort* port = IS_OPENER_PORT_ID(dest_port_id) ? 650 MessagePort* port = IS_OPENER_PORT_ID(dest_port_id) ?
651 channel->opener.get() : channel->receiver.get(); 651 channel->opener.get() : channel->receiver.get();
652 652
653 port->DispatchOnMessage(message, dest_port_id); 653 port->DispatchOnMessage(message, dest_port_id);
654 } 654 }
655 655
656 bool MessageService::MaybeAddPendingLazyBackgroundPageOpenChannelTask( 656 bool MessageService::MaybeAddPendingLazyBackgroundPageOpenChannelTask(
657 Profile* profile, 657 BrowserContext* context,
658 const Extension* extension, 658 const Extension* extension,
659 OpenChannelParams* params) { 659 OpenChannelParams* params) {
660 if (!BackgroundInfo::HasLazyBackgroundPage(extension)) 660 if (!BackgroundInfo::HasLazyBackgroundPage(extension))
661 return false; 661 return false;
662 662
663 // If the extension uses spanning incognito mode, make sure we're always 663 // If the extension uses spanning incognito mode, make sure we're always
664 // using the original profile since that is what the extension process 664 // using the original profile since that is what the extension process
665 // will use. 665 // will use.
666 if (!IncognitoInfo::IsSplitMode(extension)) 666 if (!IncognitoInfo::IsSplitMode(extension))
667 profile = profile->GetOriginalProfile(); 667 context = ExtensionsBrowserClient::Get()->GetOriginalContext(context);
668 668
669 if (!lazy_background_task_queue_->ShouldEnqueueTask(profile, extension)) 669 if (!lazy_background_task_queue_->ShouldEnqueueTask(context, extension))
670 return false; 670 return false;
671 671
672 pending_lazy_background_page_channels_[ 672 pending_lazy_background_page_channels_
673 GET_CHANNEL_ID(params->receiver_port_id)] = 673 [GET_CHANNEL_ID(params->receiver_port_id)] =
674 PendingLazyBackgroundPageChannel(profile, extension->id()); 674 PendingLazyBackgroundPageChannel(context, extension->id());
675 scoped_ptr<OpenChannelParams> scoped_params(params); 675 scoped_ptr<OpenChannelParams> scoped_params(params);
676 lazy_background_task_queue_->AddPendingTask(profile, extension->id(), 676 lazy_background_task_queue_->AddPendingTask(
677 context,
678 extension->id(),
677 base::Bind(&MessageService::PendingLazyBackgroundPageOpenChannel, 679 base::Bind(&MessageService::PendingLazyBackgroundPageOpenChannel,
678 weak_factory_.GetWeakPtr(), base::Passed(&scoped_params), 680 weak_factory_.GetWeakPtr(),
681 base::Passed(&scoped_params),
679 params->source->GetID())); 682 params->source->GetID()));
680 return true; 683 return true;
681 } 684 }
682 685
683 void MessageService::GotDomainBoundCert(scoped_ptr<OpenChannelParams> params, 686 void MessageService::GotDomainBoundCert(scoped_ptr<OpenChannelParams> params,
684 const std::string& tls_channel_id) { 687 const std::string& tls_channel_id) {
685 params->tls_channel_id.assign(tls_channel_id); 688 params->tls_channel_id.assign(tls_channel_id);
686 int channel_id = GET_CHANNEL_ID(params->receiver_port_id); 689 int channel_id = GET_CHANNEL_ID(params->receiver_port_id);
687 690
688 PendingTlsChannelIdMap::iterator pending_for_tls_channel_id = 691 PendingTlsChannelIdMap::iterator pending_for_tls_channel_id =
689 pending_tls_channel_id_channels_.find(channel_id); 692 pending_tls_channel_id_channels_.find(channel_id);
690 if (pending_for_tls_channel_id == pending_tls_channel_id_channels_.end()) { 693 if (pending_for_tls_channel_id == pending_tls_channel_id_channels_.end()) {
691 NOTREACHED(); 694 NOTREACHED();
692 return; 695 return;
693 } 696 }
694 697
695 Profile* profile = Profile::FromBrowserContext( 698 BrowserContext* context = params->source->GetBrowserContext();
696 params->source->GetBrowserContext());
697 699
698 const Extension* target_extension = ExtensionSystem::Get(profile)-> 700 const Extension* target_extension =
699 extension_service()->extensions()->GetByID(params->target_extension_id); 701 ExtensionSystem::Get(context)->extension_service()->extensions()->GetByID(
702 params->target_extension_id);
700 if (!target_extension) { 703 if (!target_extension) {
701 pending_tls_channel_id_channels_.erase(channel_id); 704 pending_tls_channel_id_channels_.erase(channel_id);
702 DispatchOnDisconnect( 705 DispatchOnDisconnect(
703 params->source, params->receiver_port_id, 706 params->source, params->receiver_port_id,
704 kReceivingEndDoesntExistError); 707 kReceivingEndDoesntExistError);
705 return; 708 return;
706 } 709 }
707 PendingMessagesQueue& pending_messages = pending_for_tls_channel_id->second; 710 PendingMessagesQueue& pending_messages = pending_for_tls_channel_id->second;
708 if (MaybeAddPendingLazyBackgroundPageOpenChannelTask(profile, 711 if (MaybeAddPendingLazyBackgroundPageOpenChannelTask(
709 target_extension, 712 context, target_extension, params.get())) {
710 params.get())) {
711 // Lazy background queue took ownership. Release ours. 713 // Lazy background queue took ownership. Release ours.
712 ignore_result(params.release()); 714 ignore_result(params.release());
713 // Messages queued up waiting for the TLS channel ID now need to be queued 715 // Messages queued up waiting for the TLS channel ID now need to be queued
714 // up for the lazy background page to load. 716 // up for the lazy background page to load.
715 for (PendingMessagesQueue::iterator it = pending_messages.begin(); 717 for (PendingMessagesQueue::iterator it = pending_messages.begin();
716 it != pending_messages.end(); 718 it != pending_messages.end();
717 it++) { 719 it++) {
718 EnqueuePendingMessageForLazyBackgroundLoad(it->first, channel_id, 720 EnqueuePendingMessageForLazyBackgroundLoad(it->first, channel_id,
719 it->second); 721 it->second);
720 } 722 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 } 756 }
755 757
756 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source, 758 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source,
757 int port_id, 759 int port_id,
758 const std::string& error_message) { 760 const std::string& error_message) {
759 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); 761 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, "");
760 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message); 762 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message);
761 } 763 }
762 764
763 } // namespace extensions 765 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/messaging/message_service.h ('k') | chrome/browser/extensions/api/omnibox/omnibox_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698