Navigator.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. #include <LibWeb/HTML/NavigatorConcurrentHardware.h>
  9. #include <LibWeb/HTML/NavigatorID.h>
  10. #include <LibWeb/HTML/NavigatorLanguage.h>
  11. #include <LibWeb/HTML/NavigatorOnLine.h>
  12. namespace Web::HTML {
  13. class Navigator : public Bindings::PlatformObject
  14. , public NavigatorConcurrentHardwareMixin
  15. , public NavigatorIDMixin
  16. , public NavigatorLanguageMixin
  17. , public NavigatorOnLineMixin {
  18. WEB_PLATFORM_OBJECT(Navigator, Bindings::PlatformObject);
  19. public:
  20. static JS::NonnullGCPtr<Navigator> create(JS::Realm&);
  21. // FIXME: Implement NavigatorContentUtilsMixin
  22. // NavigatorCookies
  23. // FIXME: Hook up to Agent level state
  24. // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-cookieenabled
  25. bool cookie_enabled() const { return true; }
  26. // NavigatorPlugins
  27. // FIXME: Actually support pdf viewing
  28. // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-javaenabled
  29. bool java_enabled() const { return false; }
  30. // https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-pdfviewerenabled
  31. bool pdf_viewer_enabled() const { return false; }
  32. bool webdriver() const;
  33. virtual ~Navigator() override;
  34. private:
  35. explicit Navigator(JS::Realm&);
  36. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  37. };
  38. }