#ifndef WebInspector_h
#define WebInspector_h
#include "APIObject.h"
#include "Connection.h"
#include "MessageReceiver.h"
#include <WebCore/InspectorForwarding.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 WebCore::InspectorFrontendChannel {
public:
static Ref<WebInspector> create(WebPage*);
WebPage* page() const { return m_page; }
void updateDockingAvailability();
virtual bool sendMessageToFrontend(const String& message) override;
void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
void didClose(IPC::Connection&) override { close(); }
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference, IPC::StringReference) override { close(); }
virtual IPC::ProcessType localProcessType() override { return IPC::ProcessType::Web; }
virtual IPC::ProcessType remoteProcessType() override { return IPC::ProcessType::UI; }
void connectionEstablished();
void show();
void close();
void openInNewTab(const String& urlString);
void canAttachWindow(bool& result);
void showConsole();
void showResources();
void showMainResourceForFrame(uint64_t frameIdentifier);
void setAttached(bool attached) { m_attached = attached; }
void evaluateScriptForTest(const String& script);
void startPageProfiling();
void stopPageProfiling();
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 createInspectorPage(bool underTest);
void closeFrontend();
void bringToFront();
WebPage* m_page;
RefPtr<IPC::Connection> m_frontendConnection;
bool m_attached;
bool m_previousCanAttach;
#if ENABLE(INSPECTOR_SERVER)
bool m_remoteFrontendConnected;
#endif
};
}
#endif // WebInspector_h