Added a preference to disable some Inspector's panels.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Feb 2009 22:20:45 +0000 (22:20 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Feb 2009 22:20:45 +0000 (22:20 +0000)
WebCore:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Added a preference to disable some Inspector's panels (rdar://6419624, rdar://6419645).
        This is controlled via the 'WebKitInspectorHiddenPanels' key; if nothing is specified, all panels are shown.

        Reviewed by Timothy Hatcher.

        * inspector/InspectorClient.h:
        * inspector/InspectorController.cpp:
        (WebCore::hiddenPanels):
        (WebCore::InspectorController::hiddenPanels):
        (WebCore::InspectorController::windowScriptObjectAvailable):
        * inspector/InspectorController.h:
        * inspector/front-end/inspector.js:
        (WebInspector.loaded):
        * loader/EmptyClients.h:
        (WebCore::EmptyInspectorClient::hiddenPanels):

WebKit/gtk:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Stub out InspectorClient::hiddenPanels.

        Reviewed by Timothy Hatcher.

        * WebCoreSupport/InspectorClientGtk.cpp:
        (WebKit::InspectorClient::hiddenPanels):
        * WebCoreSupport/InspectorClientGtk.h:

WebKit/mac:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Added a preference to disable some Inspector's panels (rdar://6419624, rdar://6419645).
        This is controlled via the 'WebKitInspectorHiddenPanels' key; if nothing is specified, all panels are shown.

        Reviewed by Timothy Hatcher.

        * WebCoreSupport/WebInspectorClient.h:
        * WebCoreSupport/WebInspectorClient.mm:
        (WebInspectorClient::hiddenPanels):

WebKit/qt:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Stub out InspectorClientQt::hiddenPanels.

        Reviewed by Timothy Hatcher.

        * WebCoreSupport/InspectorClientQt.cpp:
        (WebCore::InspectorClientQt::hiddenPanels):
        * WebCoreSupport/InspectorClientQt.h:

WebKit/win:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Stub out WebInspectorClient::hiddenPanels.

        Reviewed by Timothy Hatcher.

        * WebCoreSupport/WebInspectorClient.cpp:
        (WebInspectorClient::hiddenPanels):
        * WebCoreSupport/WebInspectorClient.h:

WebKit/wx:

2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>

        Stub out InspectorClientWx::hiddenPanels.

        Reviewed by Timothy Hatcher.

        * WebKitSupport/InspectorClientWx.cpp:
        (WebCore::InspectorClientWx::hiddenPanels):
        * WebKitSupport/InspectorClientWx.h:

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

21 files changed:
WebCore/ChangeLog
WebCore/inspector/InspectorClient.h
WebCore/inspector/InspectorController.cpp
WebCore/inspector/InspectorController.h
WebCore/inspector/front-end/inspector.js
WebCore/loader/EmptyClients.h
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp
WebKit/gtk/WebCoreSupport/InspectorClientGtk.h
WebKit/mac/ChangeLog
WebKit/mac/WebCoreSupport/WebInspectorClient.h
WebKit/mac/WebCoreSupport/WebInspectorClient.mm
WebKit/qt/ChangeLog
WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
WebKit/qt/WebCoreSupport/InspectorClientQt.h
WebKit/win/ChangeLog
WebKit/win/WebCoreSupport/WebInspectorClient.cpp
WebKit/win/WebCoreSupport/WebInspectorClient.h
WebKit/wx/ChangeLog
WebKit/wx/WebKitSupport/InspectorClientWx.cpp
WebKit/wx/WebKitSupport/InspectorClientWx.h

index 623c3dc8f80f88592d60d487294c697adfce9d9a..690e07fbea156e38ce2bd69245bc093f43c65bae 100644 (file)
@@ -1,3 +1,21 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Added a preference to disable some Inspector's panels (rdar://6419624, rdar://6419645).
+        This is controlled via the 'WebKitInspectorHiddenPanels' key; if nothing is specified, all panels are shown.
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorClient.h:
+        * inspector/InspectorController.cpp:
+        (WebCore::hiddenPanels):
+        (WebCore::InspectorController::hiddenPanels):
+        (WebCore::InspectorController::windowScriptObjectAvailable):
+        * inspector/InspectorController.h:
+        * inspector/front-end/inspector.js:
+        (WebInspector.loaded):
+        * loader/EmptyClients.h:
+        (WebCore::EmptyInspectorClient::hiddenPanels):
+
 2009-02-11  David Hyatt  <hyatt@apple.com>
 
         Combine RenderObject::element() and RenderObject::node() into a single function.  
index fcbf79d74b329d25acc0f990cc5d1bcf31798433..25085367f1cf74833c9b92e43f74caf8db117d6c 100644 (file)
@@ -44,6 +44,8 @@ public:
 
     virtual String localizedStringsURL() = 0;
 
+    virtual String hiddenPanels() = 0;
+
     virtual void showWindow() = 0;
     virtual void closeWindow() = 0;
 
index 82357bda186e0c8a2a707375183b07f2a2d0358a..af4f4c4630adcfcb8d060572fd01af81f5045a0e 100644 (file)
@@ -940,6 +940,19 @@ static JSValueRef localizedStrings(JSContextRef ctx, JSObjectRef /*function*/, J
     return JSValueMakeString(ctx, jsStringRef(url).get());
 }
 
+static JSValueRef hiddenPanels(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef thisObject, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
+{
+    InspectorController* controller = reinterpret_cast<InspectorController*>(JSObjectGetPrivate(thisObject));
+    if (!controller)
+        return JSValueMakeUndefined(ctx);
+
+    String hiddenPanels = controller->hiddenPanels();
+    if (hiddenPanels.isNull())
+        return JSValueMakeNull(ctx);
+
+    return JSValueMakeString(ctx, jsStringRef(hiddenPanels).get());
+}
+
 static JSValueRef platform(JSContextRef ctx, JSObjectRef /*function*/, JSObjectRef /*thisObject*/, size_t /*argumentCount*/, const JSValueRef[] /*arguments[]*/, JSValueRef* /*exception*/)
 {
 #if PLATFORM(MAC)
@@ -1269,6 +1282,13 @@ String InspectorController::localizedStringsURL()
     return m_client->localizedStringsURL();
 }
 
+String InspectorController::hiddenPanels()
+{
+    if (!enabled())
+        return String();
+    return m_client->hiddenPanels();
+}
+
 // Trying to inspect something in a frame with JavaScript disabled would later lead to
 // crashes trying to create JavaScript wrappers. Some day we could fix this issue, but
 // for now prevent crashes here by never targeting a node in such a frame.
@@ -1615,6 +1635,7 @@ void InspectorController::windowScriptObjectAvailable()
         { "setSetting", WebCore::setSetting, kJSPropertyAttributeNone },
         { "inspectedWindow", WebCore::inspectedWindow, kJSPropertyAttributeNone },
         { "localizedStringsURL", WebCore::localizedStrings, kJSPropertyAttributeNone },
+        { "hiddenPanels", WebCore::hiddenPanels, kJSPropertyAttributeNone },
         { "platform", WebCore::platform, kJSPropertyAttributeNone },
         { "moveByUnrestricted", WebCore::moveByUnrestricted, kJSPropertyAttributeNone },
         { "setAttachedWindowHeight", WebCore::setAttachedWindowHeight, kJSPropertyAttributeNone },
index 1de7e331d828f70580a2de16e004a0f14b616c46..37c904d31282db396556476db4fec4112f6cc478 100644 (file)
@@ -143,6 +143,7 @@ public:
     void setSetting(const String& key, const Setting&);
 
     String localizedStringsURL();
+    String hiddenPanels();
 
     void inspect(Node*);
     void highlight(Node*);
index 2cf94d95c29b5dec81b62799f0717a08687d26f7..90ffa2b562ddd6da5a4b93badb5f7d8456f56e6d 100644 (file)
@@ -287,10 +287,14 @@ WebInspector.loaded = function()
         databases: new WebInspector.DatabasesPanel()
     };
 
+    var hiddenPanels = (InspectorController.hiddenPanels() || "").split(',');
+
     var toolbarElement = document.getElementById("toolbar");
     var previousToolbarItem = toolbarElement.children[0];
 
     for (var panelName in this.panels) {
+        if (hiddenPanels.indexOf(panelName) !== -1)
+            continue;
         var panel = this.panels[panelName];
         var panelToolbarItem = panel.toolbarItem;
         panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this));
index b0b85fb7382c8060f3d752535a361775d736d7fb..327987320cf8d3a5b28ea6beefa57a20e4952491 100644 (file)
@@ -393,6 +393,8 @@ public:
 
     virtual String localizedStringsURL() { return String(); }
 
+    virtual String hiddenPanels() { return String(); }
+
     virtual void showWindow() { }
     virtual void closeWindow() { }
 
index 896f85a52934ed086a86f0d2fc9fdd2b0d6a4706..21f992d1100f75c0615c5ad2e99fe5ab1601e58c 100644 (file)
@@ -1,3 +1,13 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Stub out InspectorClient::hiddenPanels.
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCoreSupport/InspectorClientGtk.cpp:
+        (WebKit::InspectorClient::hiddenPanels):
+        * WebCoreSupport/InspectorClientGtk.h:
+
 2009-02-07  Holger Hans Peter Freyther  <zecke@selfish.org>
 
         Unreviewed build fix Use toNormalizedRange().
index ba3721a0f82a0b5a1449384b0f974afd8bd6e44f..faa3e28731e7e102e7c8b2629c6349bd50129dd9 100644 (file)
@@ -104,6 +104,12 @@ String InspectorClient::localizedStringsURL()
     return String();
 }
 
+String InspectorClient::hiddenPanels()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClient::showWindow()
 {
     if (!m_webView)
index 4fba55da5c1014f5a8d110132f44b5a5d673fae0..43894b3dbb4ca48e95310a56f7d5aa5bebe1e079 100644 (file)
@@ -52,6 +52,8 @@ namespace WebKit {
 
         virtual WebCore::String localizedStringsURL();
 
+        virtual WebCore::String hiddenPanels();
+
         virtual void showWindow();
         virtual void closeWindow();
 
index d28b10142c6ccb31bbfe25ef4acb3b93379b3022..14cb8e4e459aaa45fdc2d99f08a63c78be1ed262 100644 (file)
@@ -1,3 +1,14 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Added a preference to disable some Inspector's panels (rdar://6419624, rdar://6419645).
+        This is controlled via the 'WebKitInspectorHiddenPanels' key; if nothing is specified, all panels are shown.
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCoreSupport/WebInspectorClient.h:
+        * WebCoreSupport/WebInspectorClient.mm:
+        (WebInspectorClient::hiddenPanels):
+
 2009-02-11  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin Adler.
index 6a807c7efa7ea4124847b9fc24678f673c98b494..41a8fa5b23813d3a35839fa61a568504f03ce212 100644 (file)
@@ -48,6 +48,8 @@ public:
     virtual WebCore::Page* createPage();
     virtual WebCore::String localizedStringsURL();
 
+    virtual WebCore::String hiddenPanels();
+
     virtual void showWindow();
     virtual void closeWindow();
 
index 03d85ae32196d2afb29083531b52be772a55ce3b..cc4cfdb77189bff424ea7cdec7a45d22c28afc0b 100644 (file)
@@ -94,6 +94,14 @@ String WebInspectorClient::localizedStringsURL()
     return String();
 }
 
+String WebInspectorClient::hiddenPanels()
+{
+    NSString *hiddenPanels = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebKitInspectorHiddenPanels"];
+    if (hiddenPanels)
+        return hiddenPanels;
+    return String();
+}
+
 void WebInspectorClient::showWindow()
 {
     updateWindowTitle();
index de982e71f81988a4153ae308843cfb19c403069d..a163a424f5ce3758282a723a7e9e368c0cafa4a8 100644 (file)
@@ -1,3 +1,13 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Stub out InspectorClientQt::hiddenPanels.
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCoreSupport/InspectorClientQt.cpp:
+        (WebCore::InspectorClientQt::hiddenPanels):
+        * WebCoreSupport/InspectorClientQt.h:
+
 2009-02-10  Karsten Heimrich  <kheimric@trolltech.com>
 
         Reviewed by Simon Hausmann.
index 7335280e7fbca3e9e07301ab0bdb47c1c086a803..fe4d43ad622c8854bbf9bcdc02fd4ee91886fd5b 100644 (file)
@@ -114,6 +114,12 @@ String InspectorClientQt::localizedStringsURL()
     return String();
 }
 
+String InspectorClientQt::hiddenPanels()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClientQt::showWindow()
 {
     if (!m_webPage)
index 49c2d566bec4fb4a048ce3c1b80d2ac6616cb8ad..60ed77a6b6566c7d6ca6c054a26a617a8045b324 100644 (file)
@@ -52,6 +52,8 @@ namespace WebCore {
 
         virtual String localizedStringsURL();
 
+        virtual String hiddenPanels();
+
         virtual void showWindow();
         virtual void closeWindow();
         virtual bool windowVisible();
index d28196ad377f4073effe135d0949bc5a0d8fabe2..3e672772c21e4d312d3e4e004073c827db563a6c 100644 (file)
@@ -1,3 +1,13 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Stub out WebInspectorClient::hiddenPanels.
+
+        Reviewed by Timothy Hatcher.
+
+        * WebCoreSupport/WebInspectorClient.cpp:
+        (WebInspectorClient::hiddenPanels):
+        * WebCoreSupport/WebInspectorClient.h:
+
 2009-02-11  Adam Roben  <aroben@apple.com>
 
         Don't release the shared WebHistory instance on quit
index 56cf0df37a3d281ce42a48e02f7d89b2d71ba2ab..5bb1a83a94ee3c07f5a2660a0e59df690230676d 100644 (file)
@@ -201,6 +201,13 @@ String WebInspectorClient::localizedStringsURL()
     return CFURLGetString(url.get());
 }
 
+
+String WebInspectorClient::hiddenPanels()
+{
+    // FIXME: implement this
+    return String();
+}
+
 void WebInspectorClient::showWindow()
 {
     showWindowWithoutNotifications();
index 86317f6ad47238616685752160df13f2e02ea8a4..b49778848ee3eb0f8259ef409f7d8c7886e5bb55 100644 (file)
@@ -50,6 +50,8 @@ public:
 
     virtual WebCore::String localizedStringsURL();
 
+    virtual WebCore::String hiddenPanels();
+
     virtual void showWindow();
     virtual void closeWindow();
     virtual bool windowVisible();
index 2debb890eea842fe974d9bdab2a8fe3dbebe9cec..9c7833767246675482477c9315acdf3d54d8816d 100644 (file)
@@ -1,3 +1,13 @@
+2009-02-11  Dimitri Dupuis-latour  <dupuislatour@apple.com>
+
+        Stub out InspectorClientWx::hiddenPanels.
+
+        Reviewed by Timothy Hatcher.
+
+        * WebKitSupport/InspectorClientWx.cpp:
+        (WebCore::InspectorClientWx::hiddenPanels):
+        * WebKitSupport/InspectorClientWx.h:
+
 2009-02-06  Geoffrey Garen  <ggaren@apple.com>
 
         Build fix.
index 9e87da6f34b572d0f6937324fcbdc84f7c67628d..75e4595a0aeea812eecf376db786adb9c85b04c0 100644 (file)
@@ -59,6 +59,12 @@ String InspectorClientWx::localizedStringsURL()
     return String();
 }
 
+String InspectorClientWx::hiddenPanels()
+{
+    notImplemented();
+    return String();
+}
+
 void InspectorClientWx::showWindow()
 {
     notImplemented();
index 6dd05dffa6232be3e8eec777acd6dee0f3b2357b..ad3ad5bb90c6971ffe7136d7db0e529f61d900f4 100644 (file)
@@ -45,6 +45,8 @@ public:
 
     virtual String localizedStringsURL();
 
+    virtual String hiddenPanels();
+
     virtual void showWindow();
     virtual void closeWindow();