PageDebuggable.cpp [plain text]
#include "config.h"
#include "PageDebuggable.h"
#if ENABLE(REMOTE_INSPECTOR)
#include "Document.h"
#include "Frame.h"
#include "InspectorController.h"
#include "Page.h"
#include "Settings.h"
#include <JavaScriptCore/InspectorAgentBase.h>
namespace WebCore {
using namespace Inspector;
PageDebuggable::PageDebuggable(Page& page)
: m_page(page)
{
}
String PageDebuggable::name() const
{
if (!m_nameOverride.isNull())
return m_nameOverride;
if (!m_page.mainFrame().document())
return String();
return m_page.mainFrame().document()->title();
}
String PageDebuggable::url() const
{
if (!m_page.mainFrame().document())
return String();
String url = m_page.mainFrame().document()->url().string();
return url.isEmpty() ? "about:blank"_s : url;
}
bool PageDebuggable::hasLocalDebugger() const
{
return m_page.inspectorController().hasLocalFrontend();
}
void PageDebuggable::connect(FrontendChannel& channel, bool isAutomaticConnection, bool immediatelyPause)
{
m_page.inspectorController().connectFrontend(channel, isAutomaticConnection, immediatelyPause);
}
void PageDebuggable::disconnect(FrontendChannel& channel)
{
m_page.inspectorController().disconnectFrontend(channel);
}
void PageDebuggable::dispatchMessageFromRemote(const String& message)
{
m_page.inspectorController().dispatchMessageFromFrontend(message);
}
void PageDebuggable::setIndicating(bool indicating)
{
m_page.inspectorController().setIndicating(indicating);
}
void PageDebuggable::setNameOverride(const String& name)
{
m_nameOverride = name;
update();
}
}
#endif // ENABLE(REMOTE_INSPECTOR)