| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 bool is_active = | 309 bool is_active = |
| 310 active_extension_ids_.find(extension_id) != active_extension_ids_.end(); | 310 active_extension_ids_.find(extension_id) != active_extension_ids_.end(); |
| 311 if (is_active) | 311 if (is_active) |
| 312 CHECK(RendererExtensionRegistry::Get()->Contains(extension_id)); | 312 CHECK(RendererExtensionRegistry::Get()->Contains(extension_id)); |
| 313 return is_active; | 313 return is_active; |
| 314 } | 314 } |
| 315 | 315 |
| 316 void Dispatcher::DidCreateScriptContext( | 316 void Dispatcher::DidCreateScriptContext( |
| 317 blink::WebLocalFrame* frame, | 317 blink::WebLocalFrame* frame, |
| 318 const v8::Local<v8::Context>& v8_context, | 318 const v8::Local<v8::Context>& v8_context, |
| 319 int extension_group, | |
| 320 int world_id) { | 319 int world_id) { |
| 321 const base::TimeTicks start_time = base::TimeTicks::Now(); | 320 const base::TimeTicks start_time = base::TimeTicks::Now(); |
| 322 | 321 |
| 323 ScriptContext* context = script_context_set_->Register( | 322 ScriptContext* context = |
| 324 frame, v8_context, extension_group, world_id); | 323 script_context_set_->Register(frame, v8_context, world_id); |
| 325 | 324 |
| 326 // Initialize origin permissions for content scripts, which can't be | 325 // Initialize origin permissions for content scripts, which can't be |
| 327 // initialized in |OnActivateExtension|. | 326 // initialized in |OnActivateExtension|. |
| 328 if (context->context_type() == Feature::CONTENT_SCRIPT_CONTEXT) | 327 if (context->context_type() == Feature::CONTENT_SCRIPT_CONTEXT) |
| 329 InitOriginPermissions(context->extension()); | 328 InitOriginPermissions(context->extension()); |
| 330 | 329 |
| 331 { | 330 { |
| 332 std::unique_ptr<ModuleSystem> module_system( | 331 std::unique_ptr<ModuleSystem> module_system( |
| 333 new ModuleSystem(context, &source_map_)); | 332 new ModuleSystem(context, &source_map_)); |
| 334 context->set_module_system(std::move(module_system)); | 333 context->set_module_system(std::move(module_system)); |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 // The "guestViewDeny" module must always be loaded last. It registers | 1455 // The "guestViewDeny" module must always be loaded last. It registers |
| 1457 // error-providing custom elements for the GuestView types that are not | 1456 // error-providing custom elements for the GuestView types that are not |
| 1458 // available, and thus all of those types must have been checked and loaded | 1457 // available, and thus all of those types must have been checked and loaded |
| 1459 // (or not loaded) beforehand. | 1458 // (or not loaded) beforehand. |
| 1460 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1459 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1461 module_system->Require("guestViewDeny"); | 1460 module_system->Require("guestViewDeny"); |
| 1462 } | 1461 } |
| 1463 } | 1462 } |
| 1464 | 1463 |
| 1465 } // namespace extensions | 1464 } // namespace extensions |
| OLD | NEW |