| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Calls a method |method_name| in a module |module_name| belonging to the | 142 // Calls a method |method_name| in a module |module_name| belonging to the |
| 143 // module system from |context|. Intended as a callback target from | 143 // module system from |context|. Intended as a callback target from |
| 144 // ScriptContextSet::ForEach. | 144 // ScriptContextSet::ForEach. |
| 145 void CallModuleMethod(const std::string& module_name, | 145 void CallModuleMethod(const std::string& module_name, |
| 146 const std::string& method_name, | 146 const std::string& method_name, |
| 147 const base::ListValue* args, | 147 const base::ListValue* args, |
| 148 ScriptContext* context) { | 148 ScriptContext* context) { |
| 149 v8::HandleScope handle_scope(context->isolate()); | 149 v8::HandleScope handle_scope(context->isolate()); |
| 150 v8::Context::Scope context_scope(context->v8_context()); | 150 v8::Context::Scope context_scope(context->v8_context()); |
| 151 | 151 |
| 152 std::unique_ptr<content::V8ValueConverter> converter( | 152 std::unique_ptr<content::V8ValueConverter> converter = |
| 153 content::V8ValueConverter::create()); | 153 content::V8ValueConverter::Create(); |
| 154 | 154 |
| 155 std::vector<v8::Local<v8::Value>> arguments; | 155 std::vector<v8::Local<v8::Value>> arguments; |
| 156 for (const auto& arg : *args) { | 156 for (const auto& arg : *args) { |
| 157 arguments.push_back(converter->ToV8Value(&arg, context->v8_context())); | 157 arguments.push_back(converter->ToV8Value(&arg, context->v8_context())); |
| 158 } | 158 } |
| 159 | 159 |
| 160 context->module_system()->CallModuleMethodSafe( | 160 context->module_system()->CallModuleMethodSafe( |
| 161 module_name, method_name, &arguments); | 161 module_name, method_name, &arguments); |
| 162 } | 162 } |
| 163 | 163 |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 // The "guestViewDeny" module must always be loaded last. It registers | 1491 // The "guestViewDeny" module must always be loaded last. It registers |
| 1492 // error-providing custom elements for the GuestView types that are not | 1492 // error-providing custom elements for the GuestView types that are not |
| 1493 // available, and thus all of those types must have been checked and loaded | 1493 // available, and thus all of those types must have been checked and loaded |
| 1494 // (or not loaded) beforehand. | 1494 // (or not loaded) beforehand. |
| 1495 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1495 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1496 module_system->Require("guestViewDeny"); | 1496 module_system->Require("guestViewDeny"); |
| 1497 } | 1497 } |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 } // namespace extensions | 1500 } // namespace extensions |
| OLD | NEW |