PluginArray.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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#pluginarray
  10. class PluginArray : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(PluginArray, Bindings::PlatformObject);
  12. JS_DECLARE_ALLOCATOR(PluginArray);
  13. public:
  14. virtual ~PluginArray() override;
  15. void refresh() const;
  16. size_t length() const;
  17. JS::GCPtr<Plugin> item(u32 index) const;
  18. JS::GCPtr<Plugin> named_item(FlyString const& name) const;
  19. private:
  20. PluginArray(JS::Realm&);
  21. virtual void initialize(JS::Realm&) override;
  22. // ^Bindings::PlatformObject
  23. virtual Vector<FlyString> supported_property_names() const override;
  24. virtual WebIDL::ExceptionOr<JS::Value> item_value(size_t index) const override;
  25. virtual WebIDL::ExceptionOr<JS::Value> named_item_value(FlyString const& name) const override;
  26. virtual bool is_supported_property_index(u32) const override;
  27. };
  28. }