OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/js_extension_bindings_system.h" | 5 #include "extensions/renderer/js_extension_bindings_system.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "content/public/child/v8_value_converter.h" | 9 #include "content/public/child/v8_value_converter.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 v8::Context::Scope context_scope(context->v8_context()); | 254 v8::Context::Scope context_scope(context->v8_context()); |
255 | 255 |
256 std::vector<v8::Local<v8::Value>> arguments; | 256 std::vector<v8::Local<v8::Value>> arguments; |
257 arguments.push_back(gin::StringToSymbol(context->isolate(), event_name)); | 257 arguments.push_back(gin::StringToSymbol(context->isolate(), event_name)); |
258 | 258 |
259 { | 259 { |
260 std::unique_ptr<content::V8ValueConverter> converter( | 260 std::unique_ptr<content::V8ValueConverter> converter( |
261 content::V8ValueConverter::create()); | 261 content::V8ValueConverter::create()); |
262 arguments.push_back( | 262 arguments.push_back( |
263 converter->ToV8Value(event_args, context->v8_context())); | 263 converter->ToV8Value(event_args, context->v8_context())); |
264 if (!filtering_info->empty()) { | 264 if (filtering_info && !filtering_info->empty()) { |
265 arguments.push_back( | 265 arguments.push_back( |
266 converter->ToV8Value(filtering_info, context->v8_context())); | 266 converter->ToV8Value(filtering_info, context->v8_context())); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 context->module_system()->CallModuleMethodSafe( | 270 context->module_system()->CallModuleMethodSafe( |
271 kEventBindings, kEventDispatchFunction, arguments.size(), | 271 kEventBindings, kEventDispatchFunction, arguments.size(), |
272 arguments.data()); | 272 arguments.data()); |
273 } | 273 } |
274 | 274 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 std::unique_ptr<NativeHandler>( | 310 std::unique_ptr<NativeHandler>( |
311 new BindingGeneratingNativeHandler(context, api_name, "binding"))); | 311 new BindingGeneratingNativeHandler(context, api_name, "binding"))); |
312 module_system->SetNativeLazyField(bind_object, bind_name, api_bind_name, | 312 module_system->SetNativeLazyField(bind_object, bind_name, api_bind_name, |
313 "binding"); | 313 "binding"); |
314 } else { | 314 } else { |
315 module_system->SetLazyField(bind_object, bind_name, api_name, "binding"); | 315 module_system->SetLazyField(bind_object, bind_name, api_name, "binding"); |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 } // namespace extensions | 319 } // namespace extensions |
OLD | NEW |