Chromium Code Reviews| 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/renderer/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1126 Feature::Context context_type = ClassifyJavaScriptContext( | 1126 Feature::Context context_type = ClassifyJavaScriptContext( |
| 1127 extension, | 1127 extension, |
| 1128 extension_group, | 1128 extension_group, |
| 1129 UserScriptSlave::GetDataSourceURLForFrame(frame), | 1129 UserScriptSlave::GetDataSourceURLForFrame(frame), |
| 1130 frame->document().securityOrigin()); | 1130 frame->document().securityOrigin()); |
| 1131 | 1131 |
| 1132 ChromeV8Context* context = | 1132 ChromeV8Context* context = |
| 1133 new ChromeV8Context(v8_context, frame, extension, context_type); | 1133 new ChromeV8Context(v8_context, frame, extension, context_type); |
| 1134 v8_context_set_.Add(context); | 1134 v8_context_set_.Add(context); |
| 1135 | 1135 |
| 1136 if (context_type == Feature::CONTENT_SCRIPT_CONTEXT || | |
|
not at google - send to devlin
2014/02/19 18:28:21
did "if (extension)" not work (and allow you to de
| |
| 1137 context_type == Feature::UNBLESSED_EXTENSION_CONTEXT) { | |
| 1138 AddOrRemoveOriginPermissions( | |
| 1139 UpdatedExtensionPermissionsInfo::ADDED, | |
| 1140 extension, | |
| 1141 PermissionsData::GetEffectiveHostPermissions(extension)); | |
| 1142 } | |
| 1143 | |
| 1136 { | 1144 { |
| 1137 scoped_ptr<ModuleSystem> module_system(new ModuleSystem(context, | 1145 scoped_ptr<ModuleSystem> module_system(new ModuleSystem(context, |
| 1138 &source_map_)); | 1146 &source_map_)); |
| 1139 context->set_module_system(module_system.Pass()); | 1147 context->set_module_system(module_system.Pass()); |
| 1140 } | 1148 } |
| 1141 ModuleSystem* module_system = context->module_system(); | 1149 ModuleSystem* module_system = context->module_system(); |
| 1142 | 1150 |
| 1143 // Enable natives in startup. | 1151 // Enable natives in startup. |
| 1144 ModuleSystem::NativesEnabledScope natives_enabled_scope( | 1152 ModuleSystem::NativesEnabledScope natives_enabled_scope( |
| 1145 module_system); | 1153 module_system); |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1684 } | 1692 } |
| 1685 | 1693 |
| 1686 void Dispatcher::ClearPortData(int port_id) { | 1694 void Dispatcher::ClearPortData(int port_id) { |
| 1687 // Only the target port side has entries in |port_to_tab_id_map_|. If | 1695 // Only the target port side has entries in |port_to_tab_id_map_|. If |
| 1688 // |port_id| is a source port, std::map::erase() will just silently fail | 1696 // |port_id| is a source port, std::map::erase() will just silently fail |
| 1689 // here as a no-op. | 1697 // here as a no-op. |
| 1690 port_to_tab_id_map_.erase(port_id); | 1698 port_to_tab_id_map_.erase(port_id); |
| 1691 } | 1699 } |
| 1692 | 1700 |
| 1693 } // namespace extensions | 1701 } // namespace extensions |
| OLD | NEW |