| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 const std::string& method_name, | 168 const std::string& method_name, |
| 169 const base::ListValue* args, | 169 const base::ListValue* args, |
| 170 ScriptContext* context) { | 170 ScriptContext* context) { |
| 171 v8::HandleScope handle_scope(context->isolate()); | 171 v8::HandleScope handle_scope(context->isolate()); |
| 172 v8::Context::Scope context_scope(context->v8_context()); | 172 v8::Context::Scope context_scope(context->v8_context()); |
| 173 | 173 |
| 174 std::unique_ptr<content::V8ValueConverter> converter( | 174 std::unique_ptr<content::V8ValueConverter> converter( |
| 175 content::V8ValueConverter::create()); | 175 content::V8ValueConverter::create()); |
| 176 | 176 |
| 177 std::vector<v8::Local<v8::Value>> arguments; | 177 std::vector<v8::Local<v8::Value>> arguments; |
| 178 for (base::ListValue::const_iterator it = args->begin(); it != args->end(); | 178 for (const auto& arg : *args) { |
| 179 ++it) { | 179 arguments.push_back(converter->ToV8Value(arg.get(), context->v8_context())); |
| 180 arguments.push_back(converter->ToV8Value(*it, context->v8_context())); | |
| 181 } | 180 } |
| 182 | 181 |
| 183 context->module_system()->CallModuleMethod( | 182 context->module_system()->CallModuleMethod( |
| 184 module_name, method_name, &arguments); | 183 module_name, method_name, &arguments); |
| 185 } | 184 } |
| 186 | 185 |
| 187 // This handles the "chrome." root API object in script contexts. | 186 // This handles the "chrome." root API object in script contexts. |
| 188 class ChromeNativeHandler : public ObjectBackedNativeHandler { | 187 class ChromeNativeHandler : public ObjectBackedNativeHandler { |
| 189 public: | 188 public: |
| 190 explicit ChromeNativeHandler(ScriptContext* context) | 189 explicit ChromeNativeHandler(ScriptContext* context) |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 // The "guestViewDeny" module must always be loaded last. It registers | 1650 // The "guestViewDeny" module must always be loaded last. It registers |
| 1652 // error-providing custom elements for the GuestView types that are not | 1651 // error-providing custom elements for the GuestView types that are not |
| 1653 // available, and thus all of those types must have been checked and loaded | 1652 // available, and thus all of those types must have been checked and loaded |
| 1654 // (or not loaded) beforehand. | 1653 // (or not loaded) beforehand. |
| 1655 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1654 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1656 module_system->Require("guestViewDeny"); | 1655 module_system->Require("guestViewDeny"); |
| 1657 } | 1656 } |
| 1658 } | 1657 } |
| 1659 | 1658 |
| 1660 } // namespace extensions | 1659 } // namespace extensions |
| OLD | NEW |