2011-02-03 Yury Semikhatsky <yurys@chromium.org>
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 11:34:05 +0000 (11:34 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Feb 2011 11:34:05 +0000 (11:34 +0000)
        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCore.exp.in:
        * inspector/CodeGeneratorInspector.pm:
        * inspector/InspectorClient.h:
        * inspector/InspectorFrontendClientLocal.cpp:
        (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
        (WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
        (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
        * inspector/InspectorFrontendClientLocal.h: ports that provide in-process implementation of the inspector front-end can
        provide platform-specific settings accessor.
        (WebCore::InspectorFrontendClientLocal::Settings::Settings):
        (WebCore::InspectorFrontendClientLocal::Settings::~Settings):
        (WebCore::InspectorFrontendClientLocal::Settings::inspectorAttachedHeight):
        (WebCore::InspectorFrontendClientLocal::Settings::storeInspectorAttachedHeight):
        * loader/EmptyClients.h:
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCoreSupport/WebInspectorClientCF.cpp:
        (populateSetting):
        (storeSetting):
        (WebInspectorClient::createFrontendSettings):
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCoreSupport/InspectorClientGtk.cpp:
        (WebKit::InspectorFrontendClient::InspectorFrontendClient):
        * WebCoreSupport/InspectorClientGtk.h:
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCoreSupport/WebInspectorClient.h:
        * WebCoreSupport/WebInspectorClient.mm:
        (WebInspectorClient::openInspectorFrontend):
        (WebInspectorFrontendClient::WebInspectorFrontendClient):
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCoreSupport/InspectorClientQt.cpp:
        (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
        * WebCoreSupport/InspectorClientQt.h:
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebCoreSupport/WebInspectorClient.cpp:
        (WebInspectorClient::openInspectorFrontend):
        (WebInspectorFrontendClient::WebInspectorFrontendClient):
        * WebCoreSupport/WebInspectorClient.h:
2011-02-03  Yury Semikhatsky  <yurys@chromium.org>

        Reviewed by Pavel Feldman.

        Web Inspector: remove settings related methods from InspectorClient
        https://bugs.webkit.org/show_bug.cgi?id=53686

        * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
        (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77617 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/inspector/CodeGeneratorInspector.pm
Source/WebCore/inspector/InspectorClient.h
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorFrontendClientLocal.h
Source/WebCore/loader/EmptyClients.h
Source/WebKit/cf/ChangeLog
Source/WebKit/cf/WebCoreSupport/WebInspectorClientCF.cpp
Source/WebKit/chromium/src/InspectorClientImpl.cpp
Source/WebKit/chromium/src/InspectorClientImpl.h
Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
Source/WebKit/chromium/src/WebDevToolsAgentImpl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h
Source/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
Source/WebKit/qt/WebCoreSupport/InspectorClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp

index 075a5df..ddd311d 100644 (file)
@@ -1,3 +1,25 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCore.exp.in:
+        * inspector/CodeGeneratorInspector.pm:
+        * inspector/InspectorClient.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::InspectorFrontendClientLocal):
+        (WebCore::InspectorFrontendClientLocal::changeAttachedWindowHeight):
+        (WebCore::InspectorFrontendClientLocal::restoreAttachedWindowHeight):
+        * inspector/InspectorFrontendClientLocal.h: ports that provide in-process implementation of the inspector front-end can
+        provide platform-specific settings accessor.
+        (WebCore::InspectorFrontendClientLocal::Settings::Settings):
+        (WebCore::InspectorFrontendClientLocal::Settings::~Settings):
+        (WebCore::InspectorFrontendClientLocal::Settings::inspectorAttachedHeight):
+        (WebCore::InspectorFrontendClientLocal::Settings::storeInspectorAttachedHeight):
+        * loader/EmptyClients.h:
+
 2011-02-03  Anton Muhin  <antonm@chromium.org>
 
         Reviewed by Adam Barth.
index 5a6b056..637afbd 100644 (file)
@@ -1231,6 +1231,7 @@ __ZTVN7WebCore12ChromeClientE
 __ZTVN7WebCore17FileChooserClientE
 __ZTVN7WebCore17FrameLoaderClientE
 __ZTVN7WebCore25HistoryPropertyListWriterE
+__ZTVN7WebCore28InspectorFrontendClientLocal8SettingsE
 _filenameByFixingIllegalCharacters
 _hasCaseInsensitiveSubstring
 _hasCaseInsensitiveSuffix
@@ -1424,7 +1425,7 @@ __ZN7WebCore28InspectorFrontendClientLocal19requestDetachWindowEv
 __ZN7WebCore28InspectorFrontendClientLocal19windowObjectClearedEv
 __ZN7WebCore28InspectorFrontendClientLocal26changeAttachedWindowHeightEj
 __ZN7WebCore28InspectorFrontendClientLocal27restoreAttachedWindowHeightEv
-__ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageE
+__ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageEN3WTF10PassOwnPtrINS0_8SettingsEEE
 __ZN7WebCore28InspectorFrontendClientLocalD2Ev
 __ZNK7WebCore14InspectorAgent15profilerEnabledEv
 __ZNK7WebCore14InspectorAgent17drawNodeHighlightERNS_15GraphicsContextE
index 2ab5ecf..a4c77a5 100644 (file)
@@ -462,7 +462,7 @@ sub generateArgumentGetters
     my $return  = $typeTransform{$type}{"return"} ? $typeTransform{$type}{"return"} : $typeTransform{$type}{"param"};
 
     my $typeString = camelCase($type);
-    push(@backendConstantDeclarations, "$return get$typeString(InspectorObject* object, const String& name, InspectorArray* protocolErrors);");
+    push(@backendConstantDeclarations, "    $return get$typeString(InspectorObject* object, const String& name, InspectorArray* protocolErrors);");
     my $getterBody = << "EOF";
 
 $return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, InspectorArray* protocolErrors)
index 3b8007e..d24ce4d 100644 (file)
@@ -45,9 +45,6 @@ public:
     virtual void highlight(Node*) = 0;
     virtual void hideHighlight() = 0;
 
-    virtual void populateSetting(const String& key, String* value) = 0;
-    virtual void storeSetting(const String& key, const String& value) = 0;
-
     virtual bool sendMessageToFrontend(const String& message) = 0;
 
     // Navigation can cause some WebKit implementations to change the view / page / inspector controller instance.
index 5e9b441..cecbc76 100644 (file)
@@ -38,7 +38,6 @@
 #include "Frame.h"
 #include "FrameView.h"
 #include "InspectorBackendDispatcher.h"
-#include "InspectorClient.h"
 #include "InspectorController.h"
 #include "InspectorFrontendHost.h"
 #include "Page.h"
@@ -53,10 +52,20 @@ static const unsigned defaultAttachedHeight = 300;
 static const float minimumAttachedHeight = 250.0f;
 static const float maximumAttachedHeightRatio = 0.75f;
 
-InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController* inspectorController, Page* frontendPage)
+String InspectorFrontendClientLocal::Settings::getProperty(const String&)
+{
+    return String();
+}
+
+void InspectorFrontendClientLocal::Settings::setProperty(const String&, const String&)
+{
+}
+
+InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController* inspectorController, Page* frontendPage, PassOwnPtr<Settings> settings)
     : m_inspectorController(inspectorController)
     , m_frontendPage(frontendPage)
     , m_frontendScriptState(0)
+    , m_settings(settings)
 {
 }
 
@@ -109,7 +118,7 @@ void InspectorFrontendClientLocal::changeAttachedWindowHeight(unsigned height)
 {
     unsigned totalHeight = m_frontendPage->mainFrame()->view()->visibleHeight() + m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
     unsigned attachedHeight = constrainedAttachedWindowHeight(height, totalHeight);
-    m_inspectorController->inspectorClient()->storeSetting(inspectorAttachedHeightSetting, String::number(attachedHeight));
+    m_settings->setProperty(inspectorAttachedHeightSetting, String::number(attachedHeight));
     setAttachedWindowHeight(attachedHeight);
 }
 
@@ -135,8 +144,7 @@ void InspectorFrontendClientLocal::setAttachedWindow(bool attached)
 void InspectorFrontendClientLocal::restoreAttachedWindowHeight()
 {
     unsigned inspectedPageHeight = m_inspectorController->inspectedPage()->mainFrame()->view()->visibleHeight();
-    String value;
-    m_inspectorController->inspectorClient()->populateSetting(inspectorAttachedHeightSetting, &value);
+    String value = m_settings->getProperty(inspectorAttachedHeightSetting);
     unsigned preferredHeight = value.isEmpty() ? defaultAttachedHeight : value.toUInt();
     
     // This call might not go through (if the window starts out detached), but if the window is initially created attached,
index 19f6ad1..238a262 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "InspectorFrontendClient.h"
 #include "ScriptState.h"
+#include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 
 namespace WebCore {
@@ -44,7 +45,15 @@ class Page;
 class InspectorFrontendClientLocal : public InspectorFrontendClient {
     WTF_MAKE_NONCOPYABLE(InspectorFrontendClientLocal); WTF_MAKE_FAST_ALLOCATED;
 public:
-    InspectorFrontendClientLocal(InspectorController*, Page*);
+    class Settings {
+    public:
+        Settings() { }
+        virtual ~Settings() { }
+        virtual String getProperty(const String& name);
+        virtual void setProperty(const String& name, const String& value);
+    };
+
+    InspectorFrontendClientLocal(InspectorController*, Page*, PassOwnPtr<Settings>);
     virtual ~InspectorFrontendClientLocal();
     
     virtual void windowObjectCleared();
@@ -76,6 +85,7 @@ private:
     ScriptState* m_frontendScriptState;
     // TODO(yurys): this ref shouldn't be needed.
     RefPtr<InspectorFrontendHost> m_frontendHost;
+    OwnPtr<InspectorFrontendClientLocal::Settings> m_settings;
 };
 
 } // namespace WebCore
index 433755b..23faa57 100644 (file)
@@ -570,8 +570,6 @@ public:
     virtual void highlight(Node*) { }
     virtual void hideHighlight() { }
 
-    virtual void populateSetting(const String&, String*) { }
-    virtual void storeSetting(const String&, const String&) { }
     virtual bool sendMessageToFrontend(const String&) { return false; }
 };
 
index e2c2c83..b418540 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCoreSupport/WebInspectorClientCF.cpp:
+        (populateSetting):
+        (storeSetting):
+        (WebInspectorClient::createFrontendSettings):
+
 2011-01-26  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Pavel Feldman.
index 6bf5dbd..b9afa1a 100644 (file)
 #include <CoreFoundation/CoreFoundation.h>
 
 #include <WebCore/Frame.h>
+#include <WebCore/InspectorFrontendClientLocal.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformString.h>
 
+#include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/Vector.h>
 
@@ -73,7 +75,7 @@ static inline CFStringRef createKeyForPreferences(const String& key)
     return CFStringCreateWithFormat(0, 0, CFSTR("WebKit Web Inspector Setting - %@"), keyCFString.get());
 }
 
-void WebInspectorClient::populateSetting(const String& key, String* setting)
+static void populateSetting(const String& key, String* setting)
 {
     RetainPtr<CFStringRef> preferencesKey(AdoptCF, createKeyForPreferences(key));
     RetainPtr<CFPropertyListRef> value(AdoptCF, CFPreferencesCopyAppValue(preferencesKey.get(), kCFPreferencesCurrentApplication));
@@ -90,7 +92,7 @@ void WebInspectorClient::populateSetting(const String& key, String* setting)
         *setting = "";
 }
 
-void WebInspectorClient::storeSetting(const String& key, const String& setting)
+static void storeSetting(const String& key, const String& setting)
 {
     RetainPtr<CFPropertyListRef> objectToStore;
     objectToStore.adoptCF(setting.createCFString());
@@ -123,3 +125,23 @@ void WebInspectorClient::releaseFrontendPage()
 {
     m_frontendPage = 0;
 }
+
+WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> WebInspectorClient::createFrontendSettings()
+{
+    class InspectorFrontendSettingsCF : public WebCore::InspectorFrontendClientLocal::Settings {
+    public:
+        virtual ~InspectorFrontendSettingsCF() { }
+        virtual String getProperty(const String& name)
+        {
+            String value;
+            populateSetting(name, &value);
+            return value;
+        }
+
+        virtual void setProperty(const String& name, const String& value)
+        {
+            storeSetting(name, value);
+        }
+    };
+    return adoptPtr<WebCore::InspectorFrontendClientLocal::Settings>(new InspectorFrontendSettingsCF());
+}
index 77150bb..1ed5284 100644 (file)
@@ -81,18 +81,6 @@ void InspectorClientImpl::hideHighlight()
         agent->hideHighlight();
 }
 
-void InspectorClientImpl::populateSetting(const String& key, String* value)
-{
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->populateSetting(key, value);
-}
-
-void InspectorClientImpl::storeSetting(const String& key, const String& value)
-{
-    if (WebDevToolsAgentImpl* agent = devToolsAgent())
-        agent->storeSetting(key, value);
-}
-
 bool InspectorClientImpl::sendMessageToFrontend(const WTF::String& message)
 {
     if (WebDevToolsAgentImpl* agent = devToolsAgent())
index 78d34e3..cc91454 100644 (file)
@@ -53,9 +53,6 @@ public:
     virtual void highlight(WebCore::Node*);
     virtual void hideHighlight();
 
-    virtual void populateSetting(const WTF::String& key, WTF::String* value);
-    virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
     virtual bool sendMessageToFrontend(const WTF::String&);
 
     virtual void updateInspectorStateCookie(const WTF::String&);
index cf89640..5c039f1 100644 (file)
@@ -332,18 +332,6 @@ void WebDevToolsAgentImpl::hideHighlight()
         m_webViewImpl->client()->didInvalidateRect(damagedRect);
 }
 
-void WebDevToolsAgentImpl::populateSetting(const String& key, String* value)
-{
-    WebString string;
-    m_webViewImpl->inspectorSetting(key, &string);
-    *value = string;
-}
-
-void WebDevToolsAgentImpl::storeSetting(const String& key, const String& value)
-{
-    m_webViewImpl->setInspectorSetting(key, value);
-}
-
 bool WebDevToolsAgentImpl::sendMessageToFrontend(const String& message)
 {
     WebDevToolsAgentImpl* devToolsAgent = static_cast<WebDevToolsAgentImpl*>(m_webViewImpl->devToolsAgent());
index 681eedb..2bc197d 100644 (file)
@@ -93,8 +93,6 @@ public:
     virtual void openInspectorFrontend(WebCore::InspectorController*);
     virtual void highlight(WebCore::Node*);
     virtual void hideHighlight();
-    virtual void populateSetting(const WTF::String& key, WTF::String* value);
-    virtual void storeSetting(const WTF::String& key, const WTF::String& value);
     virtual void updateInspectorStateCookie(const WTF::String&);
     virtual bool sendMessageToFrontend(const WTF::String&);
 
index d26c929..a591be4 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorFrontendClient::InspectorFrontendClient):
+        * WebCoreSupport/InspectorClientGtk.h:
+
 2011-02-03  Adam Langley  <agl@chromium.org>
 
         Reviewed by Adam Barth.
index 31af243..bd6a198 100644 (file)
@@ -40,6 +40,64 @@ static void notifyWebViewDestroyed(WebKitWebView* webView, InspectorFrontendClie
     inspectorFrontendClient->destroyInspectorWindow(true);
 }
 
+namespace {
+
+class InspectorFrontendSettingsGtk : public InspectorFrontendClientLocal::Settings {
+private:
+    virtual ~InspectorFrontendSettingsGtk() { }
+#ifdef HAVE_GSETTINGS
+    static bool shouldIgnoreSetting(const String& key)
+    {
+        // GSettings considers trying to fetch or set a setting that is
+        // not backed by a schema as programmer error, and aborts the
+        // program's execution. We check here to avoid having an unhandled
+        // setting as a fatal error.
+        LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data());
+        return true;
+    }
+
+    virtual String getProperty(const String& name)
+    {
+        if (shouldIgnoreSetting(name))
+            return String();
+
+        GSettings* settings = inspectorGSettings();
+        if (!settings)
+            return String();
+
+        GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, name.utf8().data()));
+        return String(g_variant_get_string(variant.get(), 0));
+    }
+
+    virtual void setProperty(const String& name, const String& value)
+    {
+        // Avoid setting unknown keys to avoid aborting the execution.
+        if (shouldIgnoreSetting(name))
+            return;
+
+        GSettings* settings = inspectorGSettings();
+        if (!settings)
+            return;
+
+        GRefPtr<GVariant> variant = adoptGRef(g_variant_new_string(value.utf8().data()));
+        g_settings_set_value(settings, name.utf8().data(), variant.get());
+    }
+#else
+    virtual String getProperty(const String&)
+    {
+        notImplemented();
+        return String();
+    }
+
+    virtual void setProperty(const String&, const String&)
+    {
+        notImplemented();
+    }
+#endif // HAVE_GSETTINGS
+};
+
+} // namespace
+
 InspectorClient::InspectorClient(WebKitWebView* webView)
     : m_inspectedWebView(webView)
     , m_frontendPage(0)
@@ -113,117 +171,6 @@ void InspectorClient::hideHighlight()
     gtk_widget_queue_draw(GTK_WIDGET(m_inspectedWebView));
 }
 
-#ifdef HAVE_GSETTINGS
-static String toGSettingName(String inspectorSettingName)
-{
-    if (inspectorSettingName == "resourceTrackingEnabled")
-        return String("resource-tracking-enabled");
-
-    if (inspectorSettingName == "xhrMonitor")
-        return String("xhr-monitor-enabled");
-
-    if (inspectorSettingName == "frontendSettings")
-        return String("frontend-settings");
-
-    if (inspectorSettingName == "debuggerEnabled")
-        return String("debugger-enabled");
-
-    if (inspectorSettingName == "profilerEnabled")
-        return String("profiler-enabled");
-
-    return inspectorSettingName;
-}
-
-static String truthStringFromVariant(GVariant* variant)
-{
-    if (g_variant_get_boolean(variant))
-        return String("true");
-
-    return String("false");
-}
-
-static GVariant* variantFromTruthString(const String& truth)
-{
-    if (truth == "true")
-        return g_variant_new_boolean(TRUE);
-
-    return g_variant_new_boolean(FALSE);
-}
-
-static bool shouldIgnoreSetting(const String& key)
-{
-    // Ignore this setting for now, it doesn't seem to be used for
-    // anything right now.
-    if (key == "lastActivePanel")
-        return true;
-
-    // GSettings considers trying to fetch or set a setting that is
-    // not backed by a schema as programmer error, and aborts the
-    // program's execution. We check here to avoid having an unhandled
-    // setting as a fatal error.
-    if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
-        || key == "frontendSettings" || key == "debuggerEnabled"
-        || key == "profilerEnabled")
-        return false;
-
-    LOG_VERBOSE(NotYetImplemented, "Unknown key ignored: %s", key.ascii().data());
-    return true;
-}
-
-void InspectorClient::populateSetting(const String& key, String* value)
-{
-    if (shouldIgnoreSetting(key))
-        return;
-
-    GSettings* settings = inspectorGSettings();
-    if (!settings)
-        return;
-
-    GRefPtr<GVariant> variant = adoptGRef(g_settings_get_value(settings, toGSettingName(key).utf8().data()));
-
-    if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
-        || key == "debuggerEnabled" || key == "profilerEnabled")
-        *value = truthStringFromVariant(variant.get());
-    else if (key == "frontendSettings")
-        *value = String(g_variant_get_string(variant.get(), 0));
-}
-
-void InspectorClient::storeSetting(const String& key, const String& value)
-{
-    if (shouldIgnoreSetting(key))
-        return;
-
-    GSettings* settings = inspectorGSettings();
-    if (!settings)
-        return;
-
-    GRefPtr<GVariant> variant(0);
-
-    // Set the key with the appropriate type, and also avoid setting
-    // unknown keys to avoid aborting the execution.
-    if (key == "resourceTrackingEnabled" || key == "xhrMonitor"
-        || key == "debuggerEnabled" || key == "profilerEnabled")
-        variant = adoptGRef(variantFromTruthString(value));
-    else if (key == "frontendSettings")
-        variant = adoptGRef(g_variant_new_string(value.utf8().data()));
-
-    if (!variant)
-        return;
-
-    g_settings_set_value(settings, toGSettingName(key).utf8().data(), variant.get());
-}
-#else
-void InspectorClient::populateSetting(const String&, String*)
-{
-    notImplemented();
-}
-
-void InspectorClient::storeSetting(const String&, const String&)
-{
-    notImplemented();
-}
-#endif // HAVE_GSETTINGS
-
 bool InspectorClient::sendMessageToFrontend(const String& message)
 {
     return doDispatchMessageOnFrontendPage(m_frontendPage, message);
@@ -244,7 +191,7 @@ const char* InspectorClient::inspectorFilesPath()
 }
 
 InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView, WebKitWebView* inspectorWebView, WebKitWebInspector* webInspector, Page* inspectorPage, InspectorClient* inspectorClient)
-    : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage)
+    : InspectorFrontendClientLocal(core(inspectedWebView)->inspectorController(), inspectorPage, new InspectorFrontendSettingsGtk())
     , m_inspectorWebView(inspectorWebView)
     , m_inspectedWebView(inspectedWebView)
     , m_webInspector(webInspector)
index 08038f6..d5918ba 100644 (file)
@@ -59,9 +59,6 @@ namespace WebKit {
         virtual void highlight(WebCore::Node*);
         virtual void hideHighlight();
 
-        virtual void populateSetting(const WTF::String& key, WTF::String* value);
-        virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
         virtual bool sendMessageToFrontend(const WTF::String&);
 
         void releaseFrontendPage();
index 83c2781..132d0e0 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorClient::openInspectorFrontend):
+        (WebInspectorFrontendClient::WebInspectorFrontendClient):
+
 2011-02-03  James Kozianski  <koz@chromium.org>
 
         Reviewed by Dimitri Glazkov.
index cb928e5..108c2cc 100644 (file)
@@ -30,6 +30,7 @@
 #import <WebCore/InspectorFrontendClientLocal.h>
 #import <WebCore/PlatformString.h>
 
+#import <wtf/Forward.h>
 #import <wtf/RetainPtr.h>
 
 #ifdef __OBJC__
@@ -59,9 +60,6 @@ public:
     virtual void highlight(WebCore::Node*);
     virtual void hideHighlight();
 
-    virtual void populateSetting(const WTF::String& key, WTF::String* value);
-    virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
     virtual bool sendMessageToFrontend(const WTF::String&);
 
     bool inspectorStartsAttached();
@@ -70,6 +68,8 @@ public:
     void releaseFrontendPage();
 
 private:
+    WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
+
     WebView *m_webView;
     RetainPtr<WebNodeHighlighter> m_highlighter;
     WebCore::Page* m_frontendPage;
@@ -78,7 +78,7 @@ private:
 
 class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal {
 public:
-    WebInspectorFrontendClient(WebView*, WebInspectorWindowController*, WebCore::InspectorController*, WebCore::Page*);
+    WebInspectorFrontendClient(WebView*, WebInspectorWindowController*, WebCore::InspectorController*, WebCore::Page*, WTF::PassOwnPtr<Settings>);
 
     virtual void frontendLoaded();
 
index 18746b3..d47784f 100644 (file)
@@ -102,7 +102,7 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon
     [windowController.get() setInspectorClient:this];
 
     m_frontendPage = core([windowController.get() webView]);
-    WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage);
+    WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_webView, windowController.get(), inspectorController, m_frontendPage, createFrontendSettings());
     m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
 
     [[m_webView inspector] setFrontend:[[WebInspectorFrontend alloc] initWithFrontendClient:frontendClient]];
@@ -118,8 +118,8 @@ void WebInspectorClient::hideHighlight()
     [m_highlighter.get() hideHighlight];
 }
 
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage)
-    : InspectorFrontendClientLocal(inspectorController,  frontendPage)
+WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, WebInspectorWindowController* windowController, InspectorController* inspectorController, Page* frontendPage, WTF::PassOwnPtr<Settings> settings)
+    : InspectorFrontendClientLocal(inspectorController,  frontendPage, settings)
     , m_inspectedWebView(inspectedWebView)
     , m_windowController(windowController)
 {
index 1d9ec99..955e1e1 100644 (file)
@@ -1,3 +1,14 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore::InspectorFrontendClientQt::InspectorFrontendClientQt):
+        * WebCoreSupport/InspectorClientQt.h:
+
 2011-02-03  Adam Langley  <agl@chromium.org>
 
         Reviewed by Adam Barth.
index 1b06e2e..6aec5e2 100644 (file)
@@ -55,9 +55,6 @@ namespace WebCore {
 static const QLatin1String settingStoragePrefix("Qt/QtWebKit/QWebInspector/");
 static const QLatin1String settingStorageTypeSuffix(".type");
 
-static String variantToSetting(const QVariant& qvariant);
-static QVariant settingToVariant(const String& value);
-
 class InspectorClientWebPage : public QWebPage {
     Q_OBJECT
     friend class InspectorClientQt;
@@ -97,6 +94,85 @@ public slots:
     }
 };
 
+namespace {
+
+#if ENABLE(INSPECTOR)
+class InspectorFrontendSettingsQt : public InspectorFrontendClientLocal::Settings {
+public:
+    virtual ~InspectorFrontendSettingsQt() { }
+    virtual String getProperty(const String& name)
+    {
+#ifdef QT_NO_SETTINGS
+        Q_UNUSED(name)
+        Q_UNUSED(value)
+        qWarning("QWebInspector: QSettings is not supported by Qt.");
+        return String();
+#else
+        QSettings qsettings;
+        if (qsettings.status() == QSettings::AccessError) {
+            // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called
+            qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].",
+                     qPrintable(static_cast<QString>(name)));
+            return String();
+        }
+
+        QString settingKey(settingStoragePrefix + QString(name));
+        QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString();
+        QVariant storedValue = qsettings.value(settingKey);
+        storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data()));
+        return variantToSetting(storedValue);
+#endif // QT_NO_SETTINGS
+    }
+
+    virtual void setProperty(const String& name, const String& value)
+    {
+#ifdef QT_NO_SETTINGS
+        Q_UNUSED(name)
+        Q_UNUSED(value)
+        qWarning("QWebInspector: QSettings is not supported by Qt.");
+#else
+        QSettings qsettings;
+        if (qsettings.status() == QSettings::AccessError) {
+            qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].",
+                     qPrintable(static_cast<QString>(name)));
+            return;
+        }
+
+        QVariant valueToStore = settingToVariant(value);
+        QString settingKey(settingStoragePrefix + QString(name));
+        qsettings.setValue(settingKey, valueToStore);
+        qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
+#endif // QT_NO_SETTINGS
+    }
+
+private:
+    static String variantToSetting(const QVariant& qvariant)
+    {
+        String retVal;
+
+        switch (qvariant.type()) {
+        case QVariant::Bool:
+            retVal = qvariant.toBool() ? "true" : "false";
+        case QVariant::String:
+            retVal = qvariant.toString();
+        default:
+            break;
+        }
+
+        return retVal;
+    }
+
+    static QVariant settingToVariant(const String& setting)
+    {
+        QVariant retVal;
+        retVal.setValue(static_cast<QString>(setting));
+        return retVal;
+    }
+};
+#endif // ENABLE(INSPECTOR)
+
+}
+
 #if USE(V8)
 static void ensureDebuggerScriptLoaded()
 {
@@ -213,50 +289,6 @@ void InspectorClientQt::hideHighlight()
     notImplemented();
 }
 
-void InspectorClientQt::populateSetting(const String& key, String* setting)
-{
-#ifdef QT_NO_SETTINGS
-    Q_UNUSED(key)
-    Q_UNUSED(setting)
-    qWarning("QWebInspector: QSettings is not supported by Qt.");
-#else
-    QSettings qsettings;
-    if (qsettings.status() == QSettings::AccessError) {
-        // QCoreApplication::setOrganizationName and QCoreApplication::setApplicationName haven't been called
-        qWarning("QWebInspector: QSettings couldn't read configuration setting [%s].",
-                 qPrintable(static_cast<QString>(key)));
-        return;
-    }
-
-    QString settingKey(settingStoragePrefix + QString(key));
-    QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString();
-    QVariant storedValue = qsettings.value(settingKey);
-    storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data()));
-    *setting = variantToSetting(storedValue);
-#endif // QT_NO_SETTINGS
-}
-
-void InspectorClientQt::storeSetting(const String& key, const String& setting)
-{
-#ifdef QT_NO_SETTINGS
-    Q_UNUSED(key)
-    Q_UNUSED(setting)
-    qWarning("QWebInspector: QSettings is not supported by Qt.");
-#else
-    QSettings qsettings;
-    if (qsettings.status() == QSettings::AccessError) {
-        qWarning("QWebInspector: QSettings couldn't persist configuration setting [%s].",
-                 qPrintable(static_cast<QString>(key)));
-        return;
-    }
-
-    QVariant valueToStore = settingToVariant(setting);
-    QString settingKey(settingStoragePrefix + QString(key));
-    qsettings.setValue(settingKey, valueToStore);
-    qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
-#endif // QT_NO_SETTINGS
-}
-
 bool InspectorClientQt::sendMessageToFrontend(const String& message)
 {
 #if ENABLE(INSPECTOR)
@@ -276,32 +308,9 @@ bool InspectorClientQt::sendMessageToFrontend(const String& message)
 #endif
 }
 
-static String variantToSetting(const QVariant& qvariant)
-{
-    String retVal;
-
-    switch (qvariant.type()) {
-    case QVariant::Bool:
-        retVal = qvariant.toBool() ? "true" : "false";
-    case QVariant::String:
-        retVal = qvariant.toString();
-    default:
-        break;
-    }
-
-    return retVal;
-}
-
-static QVariant settingToVariant(const String& setting)
-{
-    QVariant retVal;
-    retVal.setValue(static_cast<QString>(setting));
-    return retVal;
-}
-
 #if ENABLE(INSPECTOR)
 InspectorFrontendClientQt::InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient)
-    : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page
+    : InspectorFrontendClientLocal(inspectedWebPage->d->page->inspectorController(), inspectorView->page()->d->page, new InspectorFrontendSettingsQt())
     , m_inspectedWebPage(inspectedWebPage)
     , m_inspectorView(inspectorView)
     , m_destroyingInspectorView(false)
index 64a2d0c..c16fabe 100644 (file)
@@ -58,9 +58,6 @@ public:
     virtual void highlight(Node*);
     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();
index 5e648db..381f2fa 100644 (file)
@@ -1,3 +1,15 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorClient::openInspectorFrontend):
+        (WebInspectorFrontendClient::WebInspectorFrontendClient):
+        * WebCoreSupport/WebInspectorClient.h:
+
 2011-02-03  Adam Langley  <agl@chromium.org>
 
         Reviewed by Adam Barth.
index dee2516..2922485 100644 (file)
@@ -173,7 +173,7 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon
         return;
 
     m_frontendPage = core(frontendWebView.get());
-    WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this);
+    WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this, createFrontendSettings());
     m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
     m_frontendHwnd = frontendHwnd;
 }
@@ -206,8 +206,8 @@ void WebInspectorClient::updateHighlight()
         m_highlight->update();
 }
 
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frontendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient)
-    : InspectorFrontendClientLocal(inspectedWebView->page()->inspectorController(),  core(frontendWebView.get()))
+WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frontendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient, PassOwnPtr<Settings> settings)
+    : InspectorFrontendClientLocal(inspectedWebView->page()->inspectorController(),  core(frontendWebView.get()), settings)
     , m_inspectedWebView(inspectedWebView)
     , m_inspectedWebViewHwnd(inspectedWebViewHwnd)
     , m_inspectorClient(inspectorClient)
index 2c4bcdf..a059559 100644 (file)
@@ -34,6 +34,7 @@
 #include <WebCore/InspectorFrontendClientLocal.h>
 #include <WebCore/PlatformString.h>
 #include <WebCore/WindowMessageListener.h>
+#include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
 #include <windows.h>
 
@@ -58,9 +59,6 @@ public:
     virtual void highlight(WebCore::Node*);
     virtual void hideHighlight();
 
-    virtual void populateSetting(const WTF::String& key, WTF::String* value);
-    virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
     virtual bool sendMessageToFrontend(const WTF::String&);
 
     bool inspectorStartsAttached();
@@ -77,6 +75,7 @@ public:
 
 private:
     ~WebInspectorClient();
+    WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
 
     WebView* m_inspectedWebView;
     WebCore::Page* m_frontendPage;
@@ -88,7 +87,7 @@ private:
 
 class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal, WebCore::WindowMessageListener {
 public:
-    WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frotnendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient);
+    WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frotnendWebView, HWND frontendWebViewHwnd, WebInspectorClient*, WTF::PassOwnPtr<Settings>);
 
     virtual void frontendLoaded();
     
index 6fcacfb..361ac37 100644 (file)
@@ -1,3 +1,13 @@
+2011-02-03  Yury Semikhatsky  <yurys@chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: remove settings related methods from InspectorClient
+        https://bugs.webkit.org/show_bug.cgi?id=53686
+
+        * WebProcess/WebCoreSupport/WebInspectorFrontendClient.cpp:
+        (WebKit::WebInspectorFrontendClient::WebInspectorFrontendClient):
+
 2011-02-03  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Dan Bernstein.
index 3e1f8c3..6298293 100644 (file)
@@ -41,7 +41,7 @@ using namespace WebCore;
 namespace WebKit {
 
 WebInspectorFrontendClient::WebInspectorFrontendClient(WebPage* page, WebPage* inspectorPage)
-    : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage())
+    : InspectorFrontendClientLocal(page->corePage()->inspectorController(), inspectorPage->corePage(), new Settings())
     , m_page(page)
 {
 }