#pragma once
#include "AbstractDOMWindow.h"
#include "RemoteFrame.h"
#include <JavaScriptCore/Strong.h>
#include <wtf/IsoMalloc.h>
#include <wtf/TypeCasts.h>
namespace JSC {
class CallFrame;
class JSGlobalObject;
class JSObject;
class JSValue;
}
namespace WebCore {
class DOMWindow;
class Document;
class Location;
class RemoteDOMWindow final : public AbstractDOMWindow {
WTF_MAKE_ISO_ALLOCATED_EXPORT(RemoteDOMWindow, WEBCORE_EXPORT);
public:
static Ref<RemoteDOMWindow> create(Ref<RemoteFrame>&& frame, GlobalWindowIdentifier&& identifier)
{
return adoptRef(*new RemoteDOMWindow(WTFMove(frame), WTFMove(identifier)));
}
~RemoteDOMWindow() final;
RemoteFrame* frame() const final { return m_frame.get(); }
ScriptExecutionContext* scriptExecutionContext() const final { return nullptr; }
WindowProxy* self() const;
Location* location() const;
void close(Document&);
bool closed() const;
void focus(DOMWindow& incumbentWindow);
void blur();
unsigned length() const;
WindowProxy* top() const;
WindowProxy* opener() const;
WindowProxy* parent() const;
void postMessage(JSC::JSGlobalObject&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&);
private:
WEBCORE_EXPORT RemoteDOMWindow(Ref<RemoteFrame>&&, GlobalWindowIdentifier&&);
bool isRemoteDOMWindow() const final { return true; }
bool isLocalDOMWindow() const final { return false; }
RefPtr<RemoteFrame> m_frame;
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::RemoteDOMWindow)
static bool isType(const WebCore::AbstractDOMWindow& window) { return window.isRemoteDOMWindow(); }
SPECIALIZE_TYPE_TRAITS_END()