Skip to content
Permalink
Browse files
[EFL] Add Web Inspector to WebKit-EFL
https://bugs.webkit.org/show_bug.cgi?id=83865

Patch by Seokju Kwon <seokju.kwon@samsung.com> on 2012-07-06
Reviewed by Pavel Feldman.

Source/WebKit:

EFL port implementation for Web Inspector.
Prepare Web Inspector resources.

* PlatformEfl.cmake:

Source/WebKit/efl:

EFL port implementation for Web Inspector.
Implementation of InspectorClientEfl and InspectorFrontendClientEfl
for using the Web Inspector in WebKit-EFL with new EWK APIs.

* WebCoreSupport/InspectorClientEfl.cpp:
(WebCore::notifyWebInspectorDestroy):
(WebCore):
(InspectorFrontendSettingsEfl):
(WebCore::InspectorFrontendSettingsEfl::getProperty):
(WebCore::InspectorFrontendSettingsEfl::setProperty):
(WebCore::InspectorClientEfl::InspectorClientEfl):
(WebCore::InspectorClientEfl::~InspectorClientEfl):
(WebCore::InspectorClientEfl::inspectorDestroyed):
(WebCore::InspectorClientEfl::openInspectorFrontend):
(WebCore::InspectorClientEfl::closeInspectorFrontend):
(WebCore::InspectorClientEfl::bringFrontendToFront):
(WebCore::InspectorClientEfl::sendMessageToFrontend):
(WebCore::InspectorClientEfl::releaseFrontendPage):
(WebCore::InspectorClientEfl::inspectorFilesPath):
(WebCore::InspectorFrontendClientEfl::InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::~InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::localizedStringsURL):
(WebCore::InspectorFrontendClientEfl::hiddenPanels):
(WebCore::InspectorFrontendClientEfl::bringToFront):
(WebCore::InspectorFrontendClientEfl::closeWindow):
(WebCore::InspectorFrontendClientEfl::inspectedURLChanged):
(WebCore::InspectorFrontendClientEfl::attachWindow):
(WebCore::InspectorFrontendClientEfl::detachWindow):
(WebCore::InspectorFrontendClientEfl::setAttachedWindowHeight):
(WebCore::InspectorFrontendClientEfl::destroyInspectorWindow):
* WebCoreSupport/InspectorClientEfl.h:
(WebCore):
(InspectorClientEfl):
(InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::disconnectInspectorClient):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):
(ewk_view_web_inspector_show):
(ewk_view_web_inspector_close):
(ewk_view_web_inspector_view_get):
(ewk_view_web_inspector_view_set):
* ewk/ewk_view.h:

Canonical link: https://commits.webkit.org/108505@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@121947 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Seokju Kwon authored and webkit-commit-queue committed Jul 6, 2012
1 parent ea8759f commit 84bae640287a8b852d0b59366b5bc07bbf6347bc
@@ -1,3 +1,15 @@
2012-07-06 Seokju Kwon <seokju.kwon@samsung.com>

[EFL] Add Web Inspector to WebKit-EFL
https://bugs.webkit.org/show_bug.cgi?id=83865

Reviewed by Pavel Feldman.

EFL port implementation for Web Inspector.
Prepare Web Inspector resources.

* PlatformEfl.cmake:

2012-07-05 Kihong Kwon <kihong.kwon@samsung.com>

[EFL] Change class name from NotificationClientEfl to NotificationPresenterClientEfl.
@@ -371,3 +371,23 @@ FOREACH(testName ${EWKUnitTests_BINARIES})
ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}")
SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit")
ENDFOREACH()

IF (ENABLE_INSPECTOR)
SET(WEB_INSPECTOR_DIR ${CMAKE_BINARY_DIR}/WebKit/efl/webinspector)
ADD_DEFINITIONS(-DWEB_INSPECTOR_DIR="${WEB_INSPECTOR_DIR}")
ADD_DEFINITIONS(-DWEB_INSPECTOR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/webinspector")
ADD_CUSTOM_TARGET(
web-inspector-resources ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${WEBCORE_DIR}/inspector/front-end ${WEB_INSPECTOR_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${WEBCORE_DIR}/English.lproj/localizedStrings.js ${WEB_INSPECTOR_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendCommands.js ${WEB_INSPECTOR_DIR}/InspectorBackendCommands.js
DEPENDS ${WebCore_LIBRARY_NAME}
)
INSTALL(DIRECTORY ${WEB_INSPECTOR_DIR}
DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}
FILES_MATCHING PATTERN "*.js"
PATTERN "*.html"
PATTERN "*.css"
PATTERN "*.gif"
PATTERN "*.png")
ENDIF ()
@@ -1,3 +1,54 @@
2012-07-06 Seokju Kwon <seokju.kwon@samsung.com>

[EFL] Add Web Inspector to WebKit-EFL
https://bugs.webkit.org/show_bug.cgi?id=83865

Reviewed by Pavel Feldman.

EFL port implementation for Web Inspector.
Implementation of InspectorClientEfl and InspectorFrontendClientEfl
for using the Web Inspector in WebKit-EFL with new EWK APIs.

* WebCoreSupport/InspectorClientEfl.cpp:
(WebCore::notifyWebInspectorDestroy):
(WebCore):
(InspectorFrontendSettingsEfl):
(WebCore::InspectorFrontendSettingsEfl::getProperty):
(WebCore::InspectorFrontendSettingsEfl::setProperty):
(WebCore::InspectorClientEfl::InspectorClientEfl):
(WebCore::InspectorClientEfl::~InspectorClientEfl):
(WebCore::InspectorClientEfl::inspectorDestroyed):
(WebCore::InspectorClientEfl::openInspectorFrontend):
(WebCore::InspectorClientEfl::closeInspectorFrontend):
(WebCore::InspectorClientEfl::bringFrontendToFront):
(WebCore::InspectorClientEfl::sendMessageToFrontend):
(WebCore::InspectorClientEfl::releaseFrontendPage):
(WebCore::InspectorClientEfl::inspectorFilesPath):
(WebCore::InspectorFrontendClientEfl::InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::~InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::localizedStringsURL):
(WebCore::InspectorFrontendClientEfl::hiddenPanels):
(WebCore::InspectorFrontendClientEfl::bringToFront):
(WebCore::InspectorFrontendClientEfl::closeWindow):
(WebCore::InspectorFrontendClientEfl::inspectedURLChanged):
(WebCore::InspectorFrontendClientEfl::attachWindow):
(WebCore::InspectorFrontendClientEfl::detachWindow):
(WebCore::InspectorFrontendClientEfl::setAttachedWindowHeight):
(WebCore::InspectorFrontendClientEfl::destroyInspectorWindow):
* WebCoreSupport/InspectorClientEfl.h:
(WebCore):
(InspectorClientEfl):
(InspectorFrontendClientEfl):
(WebCore::InspectorFrontendClientEfl::disconnectInspectorClient):
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(_ewk_view_priv_new):
(ewk_view_web_inspector_show):
(ewk_view_web_inspector_close):
(ewk_view_web_inspector_view_get):
(ewk_view_web_inspector_view_set):
* ewk/ewk_view.h:

2012-07-05 Kihong Kwon <kihong.kwon@samsung.com>

[EFL] Change class name from NotificationClientEfl to NotificationPresenterClientEfl.
@@ -21,31 +21,86 @@
#include "config.h"
#include "InspectorClientEfl.h"

#if ENABLE(INSPECTOR)
#include "InspectorController.h"
#include "NotImplemented.h"
#include "PlatformString.h"

using namespace WebCore;
#include "ewk_view_private.h"
#include <unistd.h>

namespace WebCore {

static void notifyWebInspectorDestroy(void* userData, Evas_Object* webview, void* eventInfo)
{
InspectorFrontendClientEfl* inspectorFrontendClient = static_cast<InspectorFrontendClientEfl*>(userData);
if (inspectorFrontendClient)
inspectorFrontendClient->destroyInspectorWindow(true);
}

class InspectorFrontendSettingsEfl : public InspectorFrontendClientLocal::Settings {
public:
virtual String getProperty(const String& name)
{
notImplemented();
return String();
}

virtual void setProperty(const String& name, const String& value)
{
notImplemented();
}
};

InspectorClientEfl::InspectorClientEfl(Evas_Object* webView)
: m_inspectedView(webView)
, m_inspectorView(0)
, m_frontendClient(0)
{
}

InspectorClientEfl::~InspectorClientEfl()
{
if (m_frontendClient) {
m_frontendClient->disconnectInspectorClient();
m_frontendClient = 0;
}
}

void InspectorClientEfl::inspectorDestroyed()
{
closeInspectorFrontend();
delete this;
}

void InspectorClientEfl::openInspectorFrontend(InspectorController*)
{
notImplemented();
evas_object_smart_callback_call(m_inspectedView, "inspector,view,create", 0);

Evas_Object* inspectorView = ewk_view_web_inspector_view_get(m_inspectedView);
if (!inspectorView)
return;

m_inspectorView = inspectorView;

String inspectorUri = inspectorFilesPath();
ewk_view_uri_set(m_inspectorView, inspectorUri.utf8().data());

OwnPtr<InspectorFrontendClientEfl> frontendClient = adoptPtr(new InspectorFrontendClientEfl(m_inspectedView, m_inspectorView, this));
m_frontendClient = frontendClient.get();

InspectorController* controller = EWKPrivate::corePage(m_inspectorView)->inspectorController();
controller->setInspectorFrontendClient(frontendClient.release());
}

void InspectorClientEfl::closeInspectorFrontend()
{
notImplemented();
if (m_frontendClient)
m_frontendClient->destroyInspectorWindow(false);
}

void InspectorClientEfl::bringFrontendToFront()
{
notImplemented();
m_frontendClient->bringToFront();
}

void InspectorClientEfl::highlight()
@@ -58,21 +113,98 @@ void InspectorClientEfl::hideHighlight()
notImplemented();
}

void InspectorClientEfl::populateSetting(const String&, String*)
bool InspectorClientEfl::sendMessageToFrontend(const String& message)
{
Page* frontendPage = EWKPrivate::corePage(m_inspectorView);
return doDispatchMessageOnFrontendPage(frontendPage, message);
}

void InspectorClientEfl::releaseFrontendPage()
{
m_inspectorView = 0;
m_frontendClient = 0;
}

String InspectorClientEfl::inspectorFilesPath()
{
String inspectorFilesPath = makeString("file://", WEB_INSPECTOR_INSTALL_DIR, "/inspector.html");
if (access(inspectorFilesPath.utf8().data(), R_OK)) // On success, zero is returned
inspectorFilesPath = makeString("file://", WEB_INSPECTOR_DIR, "/inspector.html");

return inspectorFilesPath;
}

InspectorFrontendClientEfl::InspectorFrontendClientEfl(Evas_Object* inspectedView, Evas_Object* inspectorView, InspectorClientEfl* inspectorClient)
: InspectorFrontendClientLocal(EWKPrivate::corePage(inspectedView)->inspectorController(), EWKPrivate::corePage(inspectorView), adoptPtr(new InspectorFrontendSettingsEfl()))
, m_inspectedView(inspectedView)
, m_inspectorView(inspectorView)
, m_inspectorClient(inspectorClient)
{
evas_object_smart_callback_add(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy, this);
}

InspectorFrontendClientEfl::~InspectorFrontendClientEfl()
{
evas_object_smart_callback_del(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy);

if (m_inspectorClient) {
m_inspectorClient->releaseFrontendPage();
m_inspectorClient = 0;
}
}

String InspectorFrontendClientEfl::localizedStringsURL()
{
notImplemented();
return String();
}

String InspectorFrontendClientEfl::hiddenPanels()
{
notImplemented();
return String();
}

void InspectorFrontendClientEfl::bringToFront()
{
notImplemented();
}

void InspectorClientEfl::storeSetting(const String&, const String&)
void InspectorFrontendClientEfl::closeWindow()
{
destroyInspectorWindow(true);
}

void InspectorFrontendClientEfl::inspectedURLChanged(const String&)
{
notImplemented();
}

void InspectorFrontendClientEfl::attachWindow()
{
notImplemented();
}

bool InspectorClientEfl::sendMessageToFrontend(const String&)
void InspectorFrontendClientEfl::detachWindow()
{
notImplemented();
return false;
}

void InspectorFrontendClientEfl::setAttachedWindowHeight(unsigned)
{
notImplemented();
}

void InspectorFrontendClientEfl::destroyInspectorWindow(bool notifyInspectorController)
{
if (notifyInspectorController)
EWKPrivate::corePage(m_inspectedView)->inspectorController()->disconnectFrontend();

if (m_inspectorClient)
m_inspectorClient->releaseFrontendPage();

evas_object_smart_callback_call(m_inspectedView, "inspector,view,close", m_inspectorView);
}

}
#endif
@@ -2,7 +2,7 @@
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia
* Copyright (C) 2009-2010 ProFUSION embedded systems
* Copyright (C) 2009-2010 Samsung Electronics
* Copyright (C) 2009-2012 Samsung Electronics
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,13 +33,19 @@
#define InspectorClientEfl_h

#include "InspectorClient.h"
#include "InspectorFrontendClientLocal.h"
#include <Evas.h>
#include <wtf/Forward.h>

namespace WebCore {
class InspectorFrontendClientEfl;
class Page;

class InspectorClientEfl : public WebCore::InspectorClient {
class InspectorClientEfl : public InspectorClient {
public:
InspectorClientEfl(Evas_Object*);
~InspectorClientEfl();

virtual void inspectorDestroyed();

virtual void openInspectorFrontend(InspectorController*);
@@ -49,10 +55,43 @@ class InspectorClientEfl : public WebCore::InspectorClient {
virtual void highlight();
virtual void hideHighlight();

virtual void populateSetting(const String& key, String* value);
virtual void storeSetting(const String& key, const String& value);

virtual bool sendMessageToFrontend(const String&);

void releaseFrontendPage();
String inspectorFilesPath();

private:
Evas_Object* m_inspectedView;
Evas_Object* m_inspectorView;
InspectorFrontendClientEfl* m_frontendClient;
};

class InspectorFrontendClientEfl : public InspectorFrontendClientLocal {
public:
InspectorFrontendClientEfl(Evas_Object*, Evas_Object*, InspectorClientEfl*);
~InspectorFrontendClientEfl();

virtual String localizedStringsURL();
virtual String hiddenPanels();

virtual void bringToFront();
virtual void closeWindow();

virtual void inspectedURLChanged(const String&);

virtual void attachWindow();
virtual void detachWindow();

virtual void setAttachedWindowHeight(unsigned);

void disconnectInspectorClient() { m_inspectorClient = 0; }
void destroyInspectorWindow(bool notifyInspectorController);

private:
Evas_Object* m_inspectedView;
Evas_Object* m_inspectorView;
InspectorClientEfl* m_inspectorClient;

};
}

0 comments on commit 84bae64

Please sign in to comment.