OLD | NEW |
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 // the channel opens. | 559 // the channel opens. |
560 EnqueuePendingMessage(source_port_id, channel_id, message); | 560 EnqueuePendingMessage(source_port_id, channel_id, message); |
561 return; | 561 return; |
562 } | 562 } |
563 | 563 |
564 DispatchMessage(source_port_id, iter->second, message); | 564 DispatchMessage(source_port_id, iter->second, message); |
565 } | 565 } |
566 | 566 |
567 void MessageService::PostMessageFromNativeProcess(int port_id, | 567 void MessageService::PostMessageFromNativeProcess(int port_id, |
568 const std::string& message) { | 568 const std::string& message) { |
569 PostMessage(port_id, Message(message, false /* user_gesture */)); | 569 PostMessage(port_id, Message(message, false /* user_gesture */, 0.0)); |
570 } | 570 } |
571 | 571 |
572 void MessageService::Observe(int type, | 572 void MessageService::Observe(int type, |
573 const content::NotificationSource& source, | 573 const content::NotificationSource& source, |
574 const content::NotificationDetails& details) { | 574 const content::NotificationDetails& details) { |
575 switch (type) { | 575 switch (type) { |
576 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: | 576 case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: |
577 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { | 577 case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { |
578 content::RenderProcessHost* renderer = | 578 content::RenderProcessHost* renderer = |
579 content::Source<content::RenderProcessHost>(source).ptr(); | 579 content::Source<content::RenderProcessHost>(source).ptr(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 } | 757 } |
758 | 758 |
759 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source, | 759 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source, |
760 int port_id, | 760 int port_id, |
761 const std::string& error_message) { | 761 const std::string& error_message) { |
762 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); | 762 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); |
763 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message); | 763 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message); |
764 } | 764 } |
765 | 765 |
766 } // namespace extensions | 766 } // namespace extensions |
OLD | NEW |