2022-10-09 02:53:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2023-02-28 00:23:53 +00:00
|
|
|
#include <LibWeb/HTML/MimeTypeArray.h>
|
2023-09-18 16:29:51 +00:00
|
|
|
#include <LibWeb/HTML/NavigatorBeacon.h>
|
2022-10-09 02:53:08 +00:00
|
|
|
#include <LibWeb/HTML/NavigatorConcurrentHardware.h>
|
2024-10-08 13:51:30 +00:00
|
|
|
#include <LibWeb/HTML/NavigatorDeviceMemory.h>
|
2022-10-09 02:53:08 +00:00
|
|
|
#include <LibWeb/HTML/NavigatorID.h>
|
|
|
|
#include <LibWeb/HTML/NavigatorLanguage.h>
|
|
|
|
#include <LibWeb/HTML/NavigatorOnLine.h>
|
2023-02-28 00:23:53 +00:00
|
|
|
#include <LibWeb/HTML/PluginArray.h>
|
2024-05-25 11:40:44 +00:00
|
|
|
#include <LibWeb/HTML/UserActivation.h>
|
2024-09-04 22:52:56 +00:00
|
|
|
#include <LibWeb/MediaCapabilitiesAPI/MediaCapabilities.h>
|
2024-08-13 19:56:19 +00:00
|
|
|
#include <LibWeb/StorageAPI/NavigatorStorage.h>
|
2022-10-09 02:53:08 +00:00
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class Navigator : public Bindings::PlatformObject
|
2023-09-18 16:29:51 +00:00
|
|
|
, public NavigatorBeaconMixin
|
2022-10-09 02:53:08 +00:00
|
|
|
, public NavigatorConcurrentHardwareMixin
|
2024-10-08 13:51:30 +00:00
|
|
|
, public NavigatorDeviceMemoryMixin
|
2022-10-09 02:53:08 +00:00
|
|
|
, public NavigatorIDMixin
|
|
|
|
, public NavigatorLanguageMixin
|
2024-08-13 19:56:19 +00:00
|
|
|
, public NavigatorOnLineMixin
|
|
|
|
, public StorageAPI::NavigatorStorage {
|
2022-10-09 02:53:08 +00:00
|
|
|
WEB_PLATFORM_OBJECT(Navigator, Bindings::PlatformObject);
|
2023-11-19 18:47:52 +00:00
|
|
|
JS_DECLARE_ALLOCATOR(Navigator);
|
2022-10-09 02:53:08 +00:00
|
|
|
|
|
|
|
public:
|
2023-08-13 11:05:26 +00:00
|
|
|
[[nodiscard]] static JS::NonnullGCPtr<Navigator> create(JS::Realm&);
|
2022-10-09 02:53:08 +00:00
|
|
|
|
|
|
|
// FIXME: Implement NavigatorContentUtilsMixin
|
|
|
|
|
|
|
|
// NavigatorCookies
|
|
|
|
// FIXME: Hook up to Agent level state
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-cookieenabled
|
|
|
|
bool cookie_enabled() const { return true; }
|
|
|
|
|
|
|
|
// NavigatorPlugins
|
|
|
|
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-javaenabled
|
|
|
|
bool java_enabled() const { return false; }
|
|
|
|
|
2023-02-28 00:20:09 +00:00
|
|
|
bool pdf_viewer_enabled() const;
|
2022-10-09 02:53:08 +00:00
|
|
|
|
2022-10-12 21:52:58 +00:00
|
|
|
bool webdriver() const;
|
|
|
|
|
2023-08-13 11:05:26 +00:00
|
|
|
[[nodiscard]] JS::NonnullGCPtr<MimeTypeArray> mime_types();
|
|
|
|
[[nodiscard]] JS::NonnullGCPtr<PluginArray> plugins();
|
2023-11-10 18:29:20 +00:00
|
|
|
[[nodiscard]] JS::NonnullGCPtr<Clipboard::Clipboard> clipboard();
|
2024-05-25 11:40:44 +00:00
|
|
|
[[nodiscard]] JS::NonnullGCPtr<UserActivation> user_activation();
|
2023-02-28 00:23:53 +00:00
|
|
|
|
2024-07-02 19:55:21 +00:00
|
|
|
Optional<FlyString> do_not_track() const;
|
|
|
|
|
2024-08-22 17:09:35 +00:00
|
|
|
JS::NonnullGCPtr<ServiceWorkerContainer> service_worker();
|
|
|
|
|
2024-09-04 22:52:56 +00:00
|
|
|
JS::NonnullGCPtr<MediaCapabilitiesAPI::MediaCapabilities> media_capabilities();
|
|
|
|
|
2024-04-11 19:28:30 +00:00
|
|
|
static WebIDL::Long max_touch_points();
|
|
|
|
|
2022-10-09 02:53:08 +00:00
|
|
|
virtual ~Navigator() override;
|
|
|
|
|
2023-02-28 00:23:53 +00:00
|
|
|
protected:
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2022-10-09 02:53:08 +00:00
|
|
|
private:
|
|
|
|
explicit Navigator(JS::Realm&);
|
2023-01-10 11:28:20 +00:00
|
|
|
|
2023-08-07 06:41:28 +00:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2023-02-28 00:23:53 +00:00
|
|
|
|
2024-08-13 19:56:19 +00:00
|
|
|
// ^StorageAPI::NavigatorStorage
|
|
|
|
virtual Bindings::PlatformObject const& this_navigator_storage_object() const override { return *this; }
|
|
|
|
|
2023-02-28 00:23:53 +00:00
|
|
|
JS::GCPtr<PluginArray> m_plugin_array;
|
|
|
|
JS::GCPtr<MimeTypeArray> m_mime_type_array;
|
2023-11-10 18:29:20 +00:00
|
|
|
|
|
|
|
// https://w3c.github.io/clipboard-apis/#dom-navigator-clipboard
|
|
|
|
JS::GCPtr<Clipboard::Clipboard> m_clipboard;
|
2024-05-25 11:40:44 +00:00
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/interaction.html#dom-navigator-useractivation
|
|
|
|
JS::GCPtr<UserActivation> m_user_activation;
|
2024-08-22 17:09:35 +00:00
|
|
|
|
|
|
|
// https://w3c.github.io/ServiceWorker/#navigator-serviceworker
|
|
|
|
JS::GCPtr<ServiceWorkerContainer> m_service_worker_container;
|
2024-09-04 22:52:56 +00:00
|
|
|
|
|
|
|
// https://w3c.github.io/media-capabilities/#dom-navigator-mediacapabilities
|
|
|
|
JS::GCPtr<MediaCapabilitiesAPI::MediaCapabilities> m_media_capabilities;
|
2022-10-09 02:53:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|