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 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and | 1063 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and |
1064 // consider making this a release CHECK. | 1064 // consider making this a release CHECK. |
1065 NOTREACHED(); | 1065 NOTREACHED(); |
1066 } | 1066 } |
1067 if (param.uses_default_policy_blocked_allowed_hosts) { | 1067 if (param.uses_default_policy_blocked_allowed_hosts) { |
1068 extension->permissions_data()->SetUsesDefaultHostRestrictions(); | 1068 extension->permissions_data()->SetUsesDefaultHostRestrictions(); |
1069 } else { | 1069 } else { |
1070 extension->permissions_data()->SetPolicyHostRestrictions( | 1070 extension->permissions_data()->SetPolicyHostRestrictions( |
1071 param.policy_blocked_hosts, param.policy_allowed_hosts); | 1071 param.policy_blocked_hosts, param.policy_allowed_hosts); |
1072 } | 1072 } |
| 1073 |
| 1074 ExtensionsRendererClient::Get()->OnExtensionAdded(*extension); |
1073 } | 1075 } |
1074 | 1076 |
1075 // Update the available bindings for all contexts. These may have changed if | 1077 // Update the available bindings for all contexts. These may have changed if |
1076 // an externally_connectable extension was loaded that can connect to an | 1078 // an externally_connectable extension was loaded that can connect to an |
1077 // open webpage. | 1079 // open webpage. |
1078 UpdateBindings(std::string()); | 1080 UpdateBindings(std::string()); |
1079 } | 1081 } |
1080 | 1082 |
1081 void Dispatcher::OnMessageInvoke(const std::string& extension_id, | 1083 void Dispatcher::OnMessageInvoke(const std::string& extension_id, |
1082 const std::string& module_name, | 1084 const std::string& module_name, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 void Dispatcher::OnUnloaded(const std::string& id) { | 1166 void Dispatcher::OnUnloaded(const std::string& id) { |
1165 // See comment in OnLoaded for why it would be nice, but perhaps incorrect, | 1167 // See comment in OnLoaded for why it would be nice, but perhaps incorrect, |
1166 // to CHECK here rather than guarding. | 1168 // to CHECK here rather than guarding. |
1167 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and | 1169 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and |
1168 // consider making this a release CHECK. | 1170 // consider making this a release CHECK. |
1169 if (!RendererExtensionRegistry::Get()->Remove(id)) { | 1171 if (!RendererExtensionRegistry::Get()->Remove(id)) { |
1170 NOTREACHED(); | 1172 NOTREACHED(); |
1171 return; | 1173 return; |
1172 } | 1174 } |
1173 | 1175 |
| 1176 ExtensionsRendererClient::Get()->OnExtensionRemoved(id); |
| 1177 |
1174 active_extension_ids_.erase(id); | 1178 active_extension_ids_.erase(id); |
1175 | 1179 |
1176 script_injection_manager_->OnExtensionUnloaded(id); | 1180 script_injection_manager_->OnExtensionUnloaded(id); |
1177 | 1181 |
1178 // If the extension is later reloaded with a different set of permissions, | 1182 // If the extension is later reloaded with a different set of permissions, |
1179 // we'd like it to get a new isolated world ID, so that it can pick up the | 1183 // we'd like it to get a new isolated world ID, so that it can pick up the |
1180 // changed origin whitelist. | 1184 // changed origin whitelist. |
1181 ScriptInjection::RemoveIsolatedWorld(id); | 1185 ScriptInjection::RemoveIsolatedWorld(id); |
1182 | 1186 |
1183 // Inform the bindings system that the contexts will be removed to allow time | 1187 // Inform the bindings system that the contexts will be removed to allow time |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 // The "guestViewDeny" module must always be loaded last. It registers | 1493 // The "guestViewDeny" module must always be loaded last. It registers |
1490 // error-providing custom elements for the GuestView types that are not | 1494 // error-providing custom elements for the GuestView types that are not |
1491 // available, and thus all of those types must have been checked and loaded | 1495 // available, and thus all of those types must have been checked and loaded |
1492 // (or not loaded) beforehand. | 1496 // (or not loaded) beforehand. |
1493 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1497 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1494 module_system->Require("guestViewDeny"); | 1498 module_system->Require("guestViewDeny"); |
1495 } | 1499 } |
1496 } | 1500 } |
1497 | 1501 |
1498 } // namespace extensions | 1502 } // namespace extensions |
OLD | NEW |