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