OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 InitOriginPermissions(extension); | 992 InitOriginPermissions(extension); |
993 | 993 |
994 UpdateActiveExtensions(); | 994 UpdateActiveExtensions(); |
995 } | 995 } |
996 | 996 |
997 void Dispatcher::OnCancelSuspend(const std::string& extension_id) { | 997 void Dispatcher::OnCancelSuspend(const std::string& extension_id) { |
998 DispatchEvent(extension_id, kOnSuspendCanceledEvent, base::ListValue(), | 998 DispatchEvent(extension_id, kOnSuspendCanceledEvent, base::ListValue(), |
999 base::DictionaryValue()); | 999 base::DictionaryValue()); |
1000 } | 1000 } |
1001 | 1001 |
1002 void Dispatcher::OnDeliverMessage(int target_port_id, | 1002 void Dispatcher::OnDeliverMessage(const PortId& target_port_id, |
1003 const Message& message) { | 1003 const Message& message) { |
1004 MessagingBindings::DeliverMessage(*script_context_set_, target_port_id, | 1004 MessagingBindings::DeliverMessage(*script_context_set_, target_port_id, |
1005 message, | 1005 message, |
1006 NULL); // All render frames. | 1006 NULL); // All render frames. |
1007 } | 1007 } |
1008 | 1008 |
1009 void Dispatcher::OnDispatchOnConnect( | 1009 void Dispatcher::OnDispatchOnConnect( |
1010 int target_port_id, | 1010 const PortId& target_port_id, |
1011 const std::string& channel_name, | 1011 const std::string& channel_name, |
1012 const ExtensionMsg_TabConnectionInfo& source, | 1012 const ExtensionMsg_TabConnectionInfo& source, |
1013 const ExtensionMsg_ExternalConnectionInfo& info, | 1013 const ExtensionMsg_ExternalConnectionInfo& info, |
1014 const std::string& tls_channel_id) { | 1014 const std::string& tls_channel_id) { |
1015 DCHECK_EQ(1, target_port_id % 2); // target renderer ports have odd IDs. | 1015 DCHECK(!target_port_id.is_opener); |
1016 | 1016 |
1017 MessagingBindings::DispatchOnConnect(*script_context_set_, target_port_id, | 1017 MessagingBindings::DispatchOnConnect(*script_context_set_, target_port_id, |
1018 channel_name, source, info, | 1018 channel_name, source, info, |
1019 tls_channel_id, | 1019 tls_channel_id, |
1020 NULL); // All render frames. | 1020 NULL); // All render frames. |
1021 } | 1021 } |
1022 | 1022 |
1023 void Dispatcher::OnDispatchOnDisconnect(int port_id, | 1023 void Dispatcher::OnDispatchOnDisconnect(const PortId& port_id, |
1024 const std::string& error_message) { | 1024 const std::string& error_message) { |
1025 MessagingBindings::DispatchOnDisconnect(*script_context_set_, port_id, | 1025 MessagingBindings::DispatchOnDisconnect(*script_context_set_, port_id, |
1026 error_message, | 1026 error_message, |
1027 NULL); // All render frames. | 1027 NULL); // All render frames. |
1028 } | 1028 } |
1029 | 1029 |
1030 void Dispatcher::OnLoaded( | 1030 void Dispatcher::OnLoaded( |
1031 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions) { | 1031 const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions) { |
1032 for (const auto& param : loaded_extensions) { | 1032 for (const auto& param : loaded_extensions) { |
1033 std::string error; | 1033 std::string error; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 // The "guestViewDeny" module must always be loaded last. It registers | 1465 // The "guestViewDeny" module must always be loaded last. It registers |
1466 // error-providing custom elements for the GuestView types that are not | 1466 // error-providing custom elements for the GuestView types that are not |
1467 // available, and thus all of those types must have been checked and loaded | 1467 // available, and thus all of those types must have been checked and loaded |
1468 // (or not loaded) beforehand. | 1468 // (or not loaded) beforehand. |
1469 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1469 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1470 module_system->Require("guestViewDeny"); | 1470 module_system->Require("guestViewDeny"); |
1471 } | 1471 } |
1472 } | 1472 } |
1473 | 1473 |
1474 } // namespace extensions | 1474 } // namespace extensions |
OLD | NEW |