Plugin.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/PlatformObject.h>
  8. namespace Web::HTML {
  9. // https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin
  10. class Plugin : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(Plugin, Bindings::PlatformObject);
  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::PlatformObject
  27. virtual Vector<FlyString> 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. };
  32. }