| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // DO NOT EDIT: This file is auto-generated by |
| // //third_party/blink/renderer/bindings/scripts/generate_bindings.py |
| // |
| // Use the GN flag `blink_enable_generated_code_formatting=true` to enable |
| // formatting of the generated files. |
| |
| #include "third_party/blink/renderer/bindings/extensions_chromeos/v8/v8_chrome_os.h" |
| |
| #include "third_party/blink/renderer/bindings/core/v8/generated_code_helper.h" |
| #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" |
| #include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h" |
| #include "third_party/blink/renderer/bindings/core/v8/v8_set_return_value_for_core.h" |
| #include "third_party/blink/renderer/bindings/extensions_chromeos/v8/v8_cros_accelerator_event.h" |
| #include "third_party/blink/renderer/bindings/extensions_chromeos/v8/v8_cros_hid.h" |
| #include "third_party/blink/renderer/bindings/extensions_chromeos/v8/v8_cros_window_management.h" |
| #include "third_party/blink/renderer/core/execution_context/execution_context.h" |
| #include "third_party/blink/renderer/extensions/chromeos/chromeos.h" |
| #include "third_party/blink/renderer/extensions/chromeos/system_extensions/hid/cros_hid.h" |
| #include "third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.h" |
| #include "third_party/blink/renderer/platform/bindings/exception_messages.h" |
| #include "third_party/blink/renderer/platform/bindings/idl_member_installer.h" |
| #include "third_party/blink/renderer/platform/bindings/runtime_call_stats.h" |
| #include "third_party/blink/renderer/platform/bindings/v8_binding.h" |
| #include "third_party/blink/renderer/platform/bindings/wrapper_type_info.h" |
| |
| namespace blink { |
| |
| // Construction of WrapperTypeInfo may require non-trivial initialization due |
| // to cross-component address resolution in order to load the pointer to the |
| // parent interface's WrapperTypeInfo. We ignore this issue because the issue |
| // happens only on component builds and the official release builds |
| // (statically-linked builds) are never affected by this issue. |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) |
| #pragma clang diagnostic push |
| #pragma clang diagnostic ignored "-Wglobal-constructors" |
| #endif |
| |
| const WrapperTypeInfo V8ChromeOS::wrapper_type_info_{ |
| gin::kEmbedderBlink, |
| V8ChromeOS::InstallInterfaceTemplate, |
| nullptr, |
| "ChromeOS", |
| nullptr, |
| WrapperTypeInfo::kWrapperTypeObjectPrototype, |
| WrapperTypeInfo::kObjectClassId, |
| WrapperTypeInfo::kNotInheritFromActiveScriptWrappable, |
| WrapperTypeInfo::kIdlInterface, |
| }; |
| |
| #if defined(COMPONENT_BUILD) && defined(WIN32) && defined(__clang__) |
| #pragma clang diagnostic pop |
| #endif |
| |
| const WrapperTypeInfo& ChromeOS::wrapper_type_info_ = |
| V8ChromeOS::wrapper_type_info_; |
| |
| // non-[ActiveScriptWrappable] |
| static_assert(!std::is_base_of<ActiveScriptWrappableBase, ChromeOS>::value, |
| "ChromeOS inherits from ActiveScriptWrappable<> without " |
| "[ActiveScriptWrappable] extended attribute."); |
| static_assert( |
| std::is_same<decltype(&ChromeOS::HasPendingActivity), |
| decltype(&ScriptWrappable::HasPendingActivity)>::value, |
| "ChromeOS is overriding hasPendingActivity() without " |
| "[ActiveScriptWrappable] extended attribute."); |
| |
| namespace { |
| |
| namespace v8_chrome_os { |
| |
| void WindowManagementAttributeGetCallback( |
| const v8::FunctionCallbackInfo<v8::Value>& info) { |
| RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT( |
| info.GetIsolate(), "Blink_ChromeOS_windowManagement_Getter"); |
| BLINK_BINDINGS_TRACE_EVENT("ChromeOS.windowManagement.get"); |
| |
| v8::Local<v8::Object> v8_receiver = info.This(); |
| ChromeOS* blink_receiver = V8ChromeOS::ToWrappableUnsafe(v8_receiver); |
| v8::Local<v8::Context> receiver_context = |
| v8_receiver->GetCreationContextChecked(); |
| ExecutionContext* receiver_execution_context = |
| ExecutionContext::From(receiver_context); |
| ExecutionContext* execution_context = receiver_execution_context; |
| auto&& return_value = blink_receiver->windowManagement(execution_context); |
| bindings::V8SetReturnValue(info, return_value, blink_receiver); |
| } |
| |
| void HidAttributeGetCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
| RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), |
| "Blink_ChromeOS_hid_Getter"); |
| BLINK_BINDINGS_TRACE_EVENT("ChromeOS.hid.get"); |
| |
| v8::Local<v8::Object> v8_receiver = info.This(); |
| ChromeOS* blink_receiver = V8ChromeOS::ToWrappableUnsafe(v8_receiver); |
| v8::Local<v8::Context> receiver_context = |
| v8_receiver->GetCreationContextChecked(); |
| ExecutionContext* receiver_execution_context = |
| ExecutionContext::From(receiver_context); |
| ExecutionContext* execution_context = receiver_execution_context; |
| auto&& return_value = blink_receiver->hid(execution_context); |
| bindings::V8SetReturnValue(info, return_value, blink_receiver); |
| } |
| |
| void CrosAcceleratorEventExposedConstructCallback( |
| v8::Local<v8::Name> v8_property_name, |
| const v8::PropertyCallbackInfo<v8::Value>& info) { |
| RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT( |
| info.GetIsolate(), |
| "Blink_ChromeOS_CrosAcceleratorEvent_ConstructorGetterCallback"); |
| BLINK_BINDINGS_TRACE_EVENT("ChromeOS.CrosAcceleratorEvent"); |
| |
| bindings::V8SetReturnValue(info, V8CrosAcceleratorEvent::GetWrapperTypeInfo(), |
| bindings::V8ReturnValue::kInterfaceObject); |
| } |
| |
| } // namespace v8_chrome_os |
| |
| using namespace v8_chrome_os; |
| |
| } // namespace |
| |
| void V8ChromeOS::InstallInterfaceTemplate( |
| v8::Isolate* isolate, |
| const DOMWrapperWorld& world, |
| v8::Local<v8::Template> interface_template) { |
| const WrapperTypeInfo* const wrapper_type_info = |
| V8ChromeOS::GetWrapperTypeInfo(); |
| v8::Local<v8::FunctionTemplate> interface_function_template = |
| interface_template.As<v8::FunctionTemplate>(); |
| v8::Local<v8::ObjectTemplate> instance_object_template = |
| interface_function_template->InstanceTemplate(); |
| v8::Local<v8::ObjectTemplate> prototype_object_template = |
| interface_function_template->PrototypeTemplate(); |
| v8::Local<v8::FunctionTemplate> parent_interface_template; |
| bindings::SetupIDLInterfaceTemplate( |
| isolate, wrapper_type_info, instance_object_template, |
| prototype_object_template, interface_function_template, |
| parent_interface_template); |
| |
| v8::Local<v8::Template> instance_template = instance_object_template; |
| v8::Local<v8::Template> prototype_template = prototype_object_template; |
| InstallContextIndependentProperties(isolate, world, instance_template, |
| prototype_template, interface_template); |
| } |
| |
| void V8ChromeOS::InstallContextIndependentProperties( |
| v8::Isolate* isolate, |
| const DOMWrapperWorld& world, |
| v8::Local<v8::Template> instance_template, |
| v8::Local<v8::Template> prototype_template, |
| v8::Local<v8::Template> interface_template) { |
| using bindings::IDLMemberInstaller; |
| |
| if (RuntimeEnabledFeatures::BlinkExtensionChromeOSWindowManagementEnabled()) { |
| static const IDLMemberInstaller::AttributeConfig kAttributeTable[] = { |
| {"windowManagement", WindowManagementAttributeGetCallback, nullptr, |
| unsigned(v8::None), |
| unsigned(IDLMemberInstaller::FlagLocation::kPrototype), |
| unsigned(IDLMemberInstaller::FlagWorld::kAllWorlds), |
| unsigned(IDLMemberInstaller::FlagReceiverCheck::kCheck), |
| unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), |
| unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), |
| unsigned(v8::SideEffectType::kHasNoSideEffect), |
| unsigned(V8PrivateProperty::CachedAccessor::kNone)}, |
| }; |
| v8::Local<v8::FunctionTemplate> interface_function_template = |
| interface_template.As<v8::FunctionTemplate>(); |
| v8::Local<v8::Signature> signature = |
| v8::Signature::New(isolate, interface_function_template); |
| IDLMemberInstaller::InstallAttributes( |
| isolate, world, instance_template, prototype_template, |
| interface_template, signature, kAttributeTable); |
| } |
| if (RuntimeEnabledFeatures::BlinkExtensionChromeOSHIDEnabled()) { |
| static const IDLMemberInstaller::AttributeConfig kAttributeTable[] = { |
| {"hid", HidAttributeGetCallback, nullptr, unsigned(v8::None), |
| unsigned(IDLMemberInstaller::FlagLocation::kPrototype), |
| unsigned(IDLMemberInstaller::FlagWorld::kAllWorlds), |
| unsigned(IDLMemberInstaller::FlagReceiverCheck::kCheck), |
| unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), |
| unsigned(IDLMemberInstaller::FlagCrossOriginCheck::kCheck), |
| unsigned(v8::SideEffectType::kHasNoSideEffect), |
| unsigned(V8PrivateProperty::CachedAccessor::kNone)}, |
| }; |
| v8::Local<v8::FunctionTemplate> interface_function_template = |
| interface_template.As<v8::FunctionTemplate>(); |
| v8::Local<v8::Signature> signature = |
| v8::Signature::New(isolate, interface_function_template); |
| IDLMemberInstaller::InstallAttributes( |
| isolate, world, instance_template, prototype_template, |
| interface_template, signature, kAttributeTable); |
| } |
| |
| if (RuntimeEnabledFeatures::BlinkExtensionChromeOSWindowManagementEnabled()) { |
| static const IDLMemberInstaller::ExposedConstructConfig |
| kExposedConstructTable[] = { |
| {"CrosAcceleratorEvent", |
| CrosAcceleratorEventExposedConstructCallback}, |
| }; |
| v8::Local<v8::FunctionTemplate> interface_function_template = |
| interface_template.As<v8::FunctionTemplate>(); |
| v8::Local<v8::Signature> signature = |
| v8::Signature::New(isolate, interface_function_template); |
| IDLMemberInstaller::InstallExposedConstructs( |
| isolate, world, instance_template, prototype_template, |
| interface_template, signature, kExposedConstructTable); |
| } |
| } |
| |
| } // namespace blink |