Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / InspectorClientImpl.cpp
index 004f247..a9ecb62 100644 (file)
  */
 
 #include "config.h"
-#include "InspectorClientImpl.h"
+#include "web/InspectorClientImpl.h"
 
-#include "WebDevToolsAgentImpl.h"
-#include "WebViewClient.h"
-#include "WebViewImpl.h"
+#include "core/frame/LocalDOMWindow.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
 #include "core/inspector/InspectorInstrumentation.h"
-#include "core/frame/DOMWindow.h"
 #include "core/page/Page.h"
-#include "core/frame/Settings.h"
+#include "platform/JSONValues.h"
 #include "platform/geometry/FloatRect.h"
 #include "public/platform/WebRect.h"
 #include "public/platform/WebURL.h"
 #include "public/platform/WebURLRequest.h"
-#include "wtf/Vector.h"
-
-using namespace WebCore;
+#include "public/web/WebViewClient.h"
+#include "web/WebDevToolsAgentImpl.h"
+#include "web/WebViewImpl.h"
 
 namespace blink {
 
@@ -70,11 +69,16 @@ void InspectorClientImpl::hideHighlight()
         agent->hideHighlight();
 }
 
-bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
+void InspectorClientImpl::sendMessageToFrontend(PassRefPtr<JSONObject> message)
+{
+    if (WebDevToolsAgentImpl* agent = devToolsAgent())
+        agent->sendMessageToFrontend(message);
+}
+
+void InspectorClientImpl::flush()
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        return agent->sendMessageToFrontend(message);
-    return false;
+        agent->flush();
 }
 
 void InspectorClientImpl::updateInspectorStateCookie(const WTF::String& inspectorState)
@@ -83,22 +87,22 @@ void InspectorClientImpl::updateInspectorStateCookie(const WTF::String& inspecto
         agent->updateInspectorStateCookie(inspectorState);
 }
 
-void InspectorClientImpl::clearBrowserCache()
+void InspectorClientImpl::setDeviceMetricsOverride(int width, int height, float deviceScaleFactor, bool mobile, bool fitWindow, float scale, float offsetX, float offsetY)
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->clearBrowserCache();
+        agent->setDeviceMetricsOverride(width, height, deviceScaleFactor, mobile, fitWindow, scale, offsetX, offsetY);
 }
 
-void InspectorClientImpl::clearBrowserCookies()
+void InspectorClientImpl::clearDeviceMetricsOverride()
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->clearBrowserCookies();
+        agent->clearDeviceMetricsOverride();
 }
 
-void InspectorClientImpl::overrideDeviceMetrics(int width, int height, float deviceScaleFactor, bool emulateViewport, bool fitWindow)
+void InspectorClientImpl::setTouchEventEmulationEnabled(bool enabled)
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->overrideDeviceMetrics(width, height, deviceScaleFactor, emulateViewport, fitWindow);
+        agent->setTouchEventEmulationEnabled(enabled);
 }
 
 bool InspectorClientImpl::overridesShowPaintRects()
@@ -131,21 +135,29 @@ void InspectorClientImpl::setShowScrollBottleneckRects(bool show)
     m_inspectedWebView->setShowScrollBottleneckRects(show);
 }
 
-void InspectorClientImpl::requestPageScaleFactor(float scale, const IntPoint& origin)
+void InspectorClientImpl::resetScrollAndPageScaleFactor()
 {
-    m_inspectedWebView->setPageScaleFactor(scale, origin);
+    m_inspectedWebView->resetScrollAndScaleState();
 }
 
-void InspectorClientImpl::getAllocatedObjects(HashSet<const void*>& set)
+float InspectorClientImpl::minimumPageScaleFactor()
 {
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->getAllocatedObjects(set);
+    return m_inspectedWebView->minimumPageScaleFactor();
 }
 
-void InspectorClientImpl::dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>& map)
+float InspectorClientImpl::maximumPageScaleFactor()
 {
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->dumpUncountedAllocatedObjects(map);
+    return m_inspectedWebView->maximumPageScaleFactor();
+}
+
+void InspectorClientImpl::setPageScaleFactor(float pageScaleFactor)
+{
+    m_inspectedWebView->setPageScaleFactor(pageScaleFactor);
+}
+
+void InspectorClientImpl::showContextMenu(float x, float y, PassRefPtr<ContextMenuProvider> menuProvider)
+{
+    m_inspectedWebView->showContextMenuAtPoint(x, y, menuProvider);
 }
 
 void InspectorClientImpl::dispatchKeyEvent(const PlatformKeyboardEvent& event)
@@ -160,10 +172,28 @@ void InspectorClientImpl::dispatchMouseEvent(const PlatformMouseEvent& event)
         agent->dispatchMouseEvent(event);
 }
 
-void InspectorClientImpl::setTraceEventCallback(TraceEventCallback callback)
+void InspectorClientImpl::setTraceEventCallback(const String& categoryFilter, TraceEventCallback callback)
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->setTraceEventCallback(callback);
+        agent->setTraceEventCallback(categoryFilter, callback);
+}
+
+void InspectorClientImpl::enableTracing(const String& categoryFilter)
+{
+    if (WebDevToolsAgentImpl* agent = devToolsAgent())
+        agent->enableTracing(categoryFilter);
+}
+
+void InspectorClientImpl::disableTracing()
+{
+    if (WebDevToolsAgentImpl* agent = devToolsAgent())
+        agent->disableTracing();
+}
+
+void InspectorClientImpl::resetTraceEventCallback()
+{
+    if (WebDevToolsAgentImpl* agent = devToolsAgent())
+        agent->resetTraceEventCallback();
 }
 
 void InspectorClientImpl::startGPUEventsRecording()
@@ -178,6 +208,12 @@ void InspectorClientImpl::stopGPUEventsRecording()
         agent->stopGPUEventsRecording();
 }
 
+void InspectorClientImpl::resumeStartup()
+{
+    if (WebDevToolsAgentImpl* agent = devToolsAgent())
+        agent->resumeStartup();
+}
+
 WebDevToolsAgentImpl* InspectorClientImpl::devToolsAgent()
 {
     return static_cast<WebDevToolsAgentImpl*>(m_inspectedWebView->devToolsAgent());