#pragma once
#include "APIObject.h"
#include "Connection.h"
#include "MessageReceiver.h"
#include <inspector/InspectorFrontendChannel.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
class WebPage;
class WebInspector : public API::ObjectImpl<API::Object::Type::BundleInspector>, public IPC::Connection::Client, public Inspector::FrontendChannel {
public:
static Ref<WebInspector> create(WebPage*);
WebPage* page() const { return m_page; }
void updateDockingAvailability();
void sendMessageToFrontend(const String& message) override;
ConnectionType connectionType() const override { return ConnectionType::Local; }
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didClose(IPC::Connection&) override { close(); }
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference) override { close(); }
void connectionEstablished();
void show();
void close();
void openInNewTab(const String& urlString);
void canAttachWindow(bool& result);
void showConsole();
void showResources();
void showTimelines();
void showMainResourceForFrame(uint64_t frameIdentifier);
void setAttached(bool attached) { m_attached = attached; }
void evaluateScriptForTest(const String& script);
void startPageProfiling();
void stopPageProfiling();
void startElementSelection();
void stopElementSelection();
void elementSelectionChanged(bool);
void sendMessageToBackend(const String&);
#if ENABLE(INSPECTOR_SERVER)
void remoteFrontendConnected();
void remoteFrontendDisconnected();
#endif
void disconnectFromPage() { close(); }
private:
friend class WebInspectorClient;
explicit WebInspector(WebPage*);
virtual ~WebInspector();
bool canAttachWindow();
void openFrontendConnection(bool underTest);
void closeFrontendConnection();
void bringToFront();
WebPage* m_page;
RefPtr<IPC::Connection> m_frontendConnection;
bool m_attached { false };
bool m_previousCanAttach { false };
#if ENABLE(INSPECTOR_SERVER)
bool m_remoteFrontendConnected { false };
#endif
};
}