Plugin.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. public:
  13. virtual ~Plugin() override;
  14. String const& name() const;
  15. String description() const;
  16. String filename() const;
  17. size_t length() const;
  18. JS::GCPtr<MimeType> item(u32 index) const;
  19. JS::GCPtr<MimeType> named_item(String const& name) const;
  20. private:
  21. Plugin(JS::Realm&, String name);
  22. // https://html.spec.whatwg.org/multipage/system-state.html#concept-plugin-name
  23. String m_name;
  24. virtual void initialize(JS::Realm&) override;
  25. // ^Bindings::LegacyPlatformObject
  26. virtual Vector<DeprecatedString> supported_property_names() const override;
  27. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  28. virtual WebIDL::ExceptionOr<JS::Value> named_item_value(DeprecatedFlyString const& name) const override;
  29. virtual bool is_supported_property_index(u32) const override;
  30. virtual bool supports_indexed_properties() const override { return true; }
  31. virtual bool supports_named_properties() const override { return true; }
  32. virtual bool has_indexed_property_setter() const override { return false; }
  33. virtual bool has_named_property_setter() const override { return false; }
  34. virtual bool has_named_property_deleter() const override { return false; }
  35. virtual bool has_legacy_override_built_ins_interface_extended_attribute() const override { return false; }
  36. virtual bool has_legacy_unenumerable_named_properties_interface_extended_attribute() const override { return true; }
  37. virtual bool has_global_interface_extended_attribute() const override { return false; }
  38. virtual bool indexed_property_setter_has_identifier() const override { return false; }
  39. virtual bool named_property_setter_has_identifier() const override { return false; }
  40. virtual bool named_property_deleter_has_identifier() const override { return false; }
  41. };
  42. }