Plugin.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) 2023, Luke Wilde <lukew@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/LegacyPlatformObject.h>
  8. namespace Web::HTML {
  9. // https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin
  10. class Plugin : public Bindings::LegacyPlatformObject {
  11. WEB_PLATFORM_OBJECT(Plugin, Bindings::LegacyPlatformObject);
  12. JS_DECLARE_ALLOCATOR(Plugin);
  13. public:
  14. virtual ~Plugin() override;
  15. String const& name() const;
  16. String description() const;
  17. String filename() const;
  18. size_t length() const;
  19. JS::GCPtr<MimeType> item(u32 index) const;
  20. JS::GCPtr<MimeType> named_item(FlyString const& name) const;
  21. private:
  22. Plugin(JS::Realm&, String name);
  23. // https://html.spec.whatwg.org/multipage/system-state.html#concept-plugin-name
  24. String m_name;
  25. virtual void initialize(JS::Realm&) override;
  26. // ^Bindings::LegacyPlatformObject
  27. virtual Vector<String> supported_property_names() const override;
  28. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  29. virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
  30. virtual bool is_supported_property_index(u32) const override;
  31. virtual bool supports_indexed_properties() const override { return true; }
  32. virtual bool supports_named_properties() const override { return true; }
  33. virtual bool has_indexed_property_setter() const override { return false; }
  34. virtual bool has_named_property_setter() const override { return false; }
  35. virtual bool has_named_property_deleter() const override { return false; }
  36. virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
  37. virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return true; }
  38. virtual bool has_global_interface_extended_attribute() const override { return false; }
  39. virtual bool indexed_property_setter_has_identifier() const override { return false; }
  40. virtual bool named_property_setter_has_identifier() const override { return false; }
  41. virtual bool named_property_deleter_has_identifier() const override { return false; }
  42. };
  43. }