Commit 7f30b3dc authored by thatcher's avatar thatcher

WebCore:

        Reviewed by Adam.

        <rdar://problem/5343767> Should have a way to disable the Web Inspector

        This change facilitates the ability to turn the Web Inspector on and off.

        Makes the InspectorClient be required to create a new Page. This also means that
        InspectorController will never be NULL. Adds a new function on Page to test
        if the inspector is enabled.

        * WebCore.exp: New symbol for the Page constructor.
        * WebCore.pro: Add InspectorClientGdk.cpp.
        * WebCoreSources.bkl: ditto.
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::createTokenizer):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::detachFromParent): Don't null check the InspectorCOntroller.
        (WebCore::FrameLoader::dispatchDidCommitLoad): Ditto.
        (WebCore::FrameLoader::dispatchAssignIdentifierToInitialRequest): Ditto.
        (WebCore::FrameLoader::dispatchWillSendRequest): Ditto.
        (WebCore::FrameLoader::dispatchDidReceiveResponse): Ditto.
        (WebCore::FrameLoader::dispatchDidReceiveContentLength): Ditto.
        (WebCore::FrameLoader::dispatchDidFinishLoading): Ditto.
        (WebCore::FrameLoader::dispatchDidLoadResourceFromMemoryCache): Ditto.
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::handleContextMenuEvent): Ask the InspectorController if it is enabled.
        (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
        * page/InspectorController.cpp:
        (WebCore::InspectorController::enabled): Ask the Page's settings if developer extras are enabled.
        (WebCore::InspectorController::inspect): Check if the InspectorController is enabled.
        (WebCore::InspectorController::focusNode): Ditto.
        (WebCore::InspectorController::highlight): Ditto.
        (WebCore::InspectorController::hideHighlight): Ditto.
        (WebCore::InspectorController::addMessageToConsole): Ditto.
        (WebCore::InspectorController::attachWindow): Ditto.
        (WebCore::InspectorController::detachWindow): Ditto.
        (WebCore::InspectorController::windowScriptObjectAvailable): Ditto.
        (WebCore::InspectorController::didCommitLoad): Ditto.
        (WebCore::InspectorController::frameDetachedFromParent): Ditto.
        (WebCore::InspectorController::didLoadResourceFromMemoryCache): Ditto.
        (WebCore::InspectorController::identifierForInitialRequest): Ditto.
        (WebCore::InspectorController::willSendRequest): Ditto.
        (WebCore::InspectorController::didReceiveResponse): Ditto.
        (WebCore::InspectorController::didReceiveContentLength): Ditto.
        (WebCore::InspectorController::didFinishLoading): Ditto.
        (WebCore::InspectorController::didFailLoading): Ditto.
        * page/InspectorController.h:
        * page/Page.cpp:
        (WebCore::Page::Page): Require an InspectorClient.
        (WebCore::Page::~Page): Always call pageDestroyed on the InspectorController.
        (WebCore::Page::inspectorEnabled): Check the WebCore settings if the developer extras are enabled.
        * page/Page.h:
        * page/gdk/InspectorClientGdk.cpp: Added.
        (WebCore::InspectorClientGdk::inspectorDestroyed): Empty stub calling notImplemented.
        (WebCore::InspectorClientGdk::createPage): Ditto.
        (WebCore::InspectorClientGdk::showWindow): Ditto.
        (WebCore::InspectorClientGdk::closeWindow): Ditto.
        (WebCore::InspectorClientGdk::attachWindow): Ditto.
        (WebCore::InspectorClientGdk::detachWindow): Ditto.
        (WebCore::InspectorClientGdk::highlight): Ditto.
        (WebCore::InspectorClientGdk::hideHighlight): Ditto.
        (WebCore::InspectorClientGdk::inspectedURLChanged): Ditto.
        * page/gdk/InspectorClientGdk.h: Added.
        * platform/graphics/svg/SVGImage.cpp:
        (WebCore::SVGImage::dataChanged): Pass in a dummy InspectorClient.
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyInspectorClient::~SVGEmptyInspectorClient): Empty dummy implementation.
        (WebCore::SVGEmptyInspectorClient::inspectorDestroyed): Ditto.
        (WebCore::SVGEmptyInspectorClient::createPage): Ditto.
        (WebCore::SVGEmptyInspectorClient::showWindow): Ditto.
        (WebCore::SVGEmptyInspectorClient::closeWindow): Ditto.
        (WebCore::SVGEmptyInspectorClient::attachWindow): Ditto.
        (WebCore::SVGEmptyInspectorClient::detachWindow): Ditto.
        (WebCore::SVGEmptyInspectorClient::highlight): Ditto.
        (WebCore::SVGEmptyInspectorClient::hideHighlight): Ditto.
        (WebCore::SVGEmptyInspectorClient::inspectedURLChanged): Ditto.

WebKit:

        Reviewed by Adam.

        <rdar://problem/5343767> Should have a way to disable the Web Inspector

        Adds a new DisableWebKitDeveloperExtras default that will force the Web Inspector to be disabled.
        This overrides the WebKitDeveloperExtras and IncludeDebugMenu default. It also disables
        the Web Inspector in Debug builds.

        * WebView/WebView.mm:
        (+[WebView _developerExtrasEnabled]): Check for the DisableWebKitDeveloperExtras default.
        (-[WebView _commonInitializationWithFrameName:groupName:]): Make a new WebInspectorClient when making the Page.

WebKitQt:

        Reviewed by Adam.

        Make the Page with the now required InspectorClient.

        * Api/qwebpage.cpp:
        (QWebPagePrivate::QWebPagePrivate):
        * WebKitPart/WebKitPart.cpp:
        (WebKitPart::initView):

WebKitTools:

        Reviewed by Adam.

        Make the Page with the now required InspectorClient.

        * GdkLauncher/main.cpp:
        (main):

win:

        Reviewed by Adam.

        Make the Page with the now required InspectorClient.

        * WebView.cpp:
        (WebView::initWithFrame):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24422 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d5d1524c
2007-07-18 Timothy Hatcher <timothy@apple.com>
Reviewed by Adam.
<rdar://problem/5343767> Should have a way to disable the Web Inspector
This change facilitates the ability to turn the Web Inspector on and off.
Makes the InspectorClient be required to create a new Page. This also means that
InspectorController will never be NULL. Adds a new function on Page to test
if the inspector is enabled.
* WebCore.exp: New symbol for the Page constructor.
* WebCore.pro: Add InspectorClientGdk.cpp.
* WebCoreSources.bkl: ditto.
* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::createTokenizer):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::detachFromParent): Don't null check the InspectorCOntroller.
(WebCore::FrameLoader::dispatchDidCommitLoad): Ditto.
(WebCore::FrameLoader::dispatchAssignIdentifierToInitialRequest): Ditto.
(WebCore::FrameLoader::dispatchWillSendRequest): Ditto.
(WebCore::FrameLoader::dispatchDidReceiveResponse): Ditto.
(WebCore::FrameLoader::dispatchDidReceiveContentLength): Ditto.
(WebCore::FrameLoader::dispatchDidFinishLoading): Ditto.
(WebCore::FrameLoader::dispatchDidLoadResourceFromMemoryCache): Ditto.
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::handleContextMenuEvent): Ask the InspectorController if it is enabled.
(WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
* page/InspectorController.cpp:
(WebCore::InspectorController::enabled): Ask the Page's settings if developer extras are enabled.
(WebCore::InspectorController::inspect): Check if the InspectorController is enabled.
(WebCore::InspectorController::focusNode): Ditto.
(WebCore::InspectorController::highlight): Ditto.
(WebCore::InspectorController::hideHighlight): Ditto.
(WebCore::InspectorController::addMessageToConsole): Ditto.
(WebCore::InspectorController::attachWindow): Ditto.
(WebCore::InspectorController::detachWindow): Ditto.
(WebCore::InspectorController::windowScriptObjectAvailable): Ditto.
(WebCore::InspectorController::didCommitLoad): Ditto.
(WebCore::InspectorController::frameDetachedFromParent): Ditto.
(WebCore::InspectorController::didLoadResourceFromMemoryCache): Ditto.
(WebCore::InspectorController::identifierForInitialRequest): Ditto.
(WebCore::InspectorController::willSendRequest): Ditto.
(WebCore::InspectorController::didReceiveResponse): Ditto.
(WebCore::InspectorController::didReceiveContentLength): Ditto.
(WebCore::InspectorController::didFinishLoading): Ditto.
(WebCore::InspectorController::didFailLoading): Ditto.
* page/InspectorController.h:
* page/Page.cpp:
(WebCore::Page::Page): Require an InspectorClient.
(WebCore::Page::~Page): Always call pageDestroyed on the InspectorController.
(WebCore::Page::inspectorEnabled): Check the WebCore settings if the developer extras are enabled.
* page/Page.h:
* page/gdk/InspectorClientGdk.cpp: Added.
(WebCore::InspectorClientGdk::inspectorDestroyed): Empty stub calling notImplemented.
(WebCore::InspectorClientGdk::createPage): Ditto.
(WebCore::InspectorClientGdk::showWindow): Ditto.
(WebCore::InspectorClientGdk::closeWindow): Ditto.
(WebCore::InspectorClientGdk::attachWindow): Ditto.
(WebCore::InspectorClientGdk::detachWindow): Ditto.
(WebCore::InspectorClientGdk::highlight): Ditto.
(WebCore::InspectorClientGdk::hideHighlight): Ditto.
(WebCore::InspectorClientGdk::inspectedURLChanged): Ditto.
* page/gdk/InspectorClientGdk.h: Added.
* platform/graphics/svg/SVGImage.cpp:
(WebCore::SVGImage::dataChanged): Pass in a dummy InspectorClient.
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyInspectorClient::~SVGEmptyInspectorClient): Empty dummy implementation.
(WebCore::SVGEmptyInspectorClient::inspectorDestroyed): Ditto.
(WebCore::SVGEmptyInspectorClient::createPage): Ditto.
(WebCore::SVGEmptyInspectorClient::showWindow): Ditto.
(WebCore::SVGEmptyInspectorClient::closeWindow): Ditto.
(WebCore::SVGEmptyInspectorClient::attachWindow): Ditto.
(WebCore::SVGEmptyInspectorClient::detachWindow): Ditto.
(WebCore::SVGEmptyInspectorClient::highlight): Ditto.
(WebCore::SVGEmptyInspectorClient::hideHighlight): Ditto.
(WebCore::SVGEmptyInspectorClient::inspectedURLChanged): Ditto.
2007-07-18 Anders Carlsson <andersca@apple.com>
Make some headers private instead of project.
......@@ -342,12 +342,11 @@ __ZN7WebCore4Node18startIgnoringLeaksEv
__ZN7WebCore4Page12setGroupNameERKNS_6StringE
__ZN7WebCore4Page15backForwardListEv
__ZN7WebCore4Page16setDefersLoadingEb
__ZN7WebCore4Page18setInspectorClientEPNS_15InspectorClientE
__ZN7WebCore4Page23clearUndoRedoOperationsEv
__ZN7WebCore4Page6goBackEv
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientE
__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientE
__ZN7WebCore4PageD1Ev
__ZN7WebCore5Cache11setDisabledEb
__ZN7WebCore5Cache13getStatisticsEv
......
......@@ -820,6 +820,7 @@ gdk-port:SOURCES += \
page/gdk/EventHandlerGdk.cpp \
page/gdk/ContextMenuClientGdk.cpp \
page/gdk/DragControllerGdk.cpp \
page/gdk/InspectorClientGdk.cpp \
loader/gdk/DocumentLoaderGdk.cpp \
loader/gdk/FrameLoaderClientGdk.cpp \
platform/gdk/CookieJarGdk.cpp \
......
......@@ -126,6 +126,7 @@
page/gdk/EventHandlerGdk.cpp
page/gdk/ContextMenuClientGdk.cpp
page/gdk/DragControllerGdk.cpp
page/gdk/InspectorClientGdk.cpp
</set>
<set append="1" var="WEBCORE_SOURCES_LOADER">
......
......@@ -286,8 +286,7 @@ Tokenizer *HTMLDocument::createTokenizer()
bool reportErrors = false;
if (m_frame)
if (Page* page = m_frame->page())
if (InspectorController* controller = page->inspectorController())
reportErrors = controller->windowVisible();
reportErrors = page->inspectorController()->windowVisible();
return new HTMLTokenizer(this, reportErrors);
}
......
......@@ -3019,8 +3019,7 @@ void FrameLoader::detachFromParent()
detachChildren();
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->frameDetachedFromParent(m_frame);
page->inspectorController()->frameDetachedFromParent(m_frame);
m_client->detachedFromParent2();
setDocumentLoader(0);
......@@ -4458,8 +4457,7 @@ void FrameLoader::dispatchDidCommitLoad()
m_client->dispatchDidCommitLoad();
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->didCommitLoad(m_documentLoader.get());
page->inspectorController()->didCommitLoad(m_documentLoader.get());
}
void FrameLoader::dispatchAssignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
......@@ -4467,8 +4465,7 @@ void FrameLoader::dispatchAssignIdentifierToInitialRequest(unsigned long identif
m_client->assignIdentifierToInitialRequest(identifier, loader, request);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->identifierForInitialRequest(identifier, loader, request);
page->inspectorController()->identifierForInitialRequest(identifier, loader, request);
}
void FrameLoader::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
......@@ -4476,8 +4473,7 @@ void FrameLoader::dispatchWillSendRequest(DocumentLoader* loader, unsigned long
m_client->dispatchWillSendRequest(loader, identifier, request, redirectResponse);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->willSendRequest(loader, identifier, request, redirectResponse);
page->inspectorController()->willSendRequest(loader, identifier, request, redirectResponse);
}
void FrameLoader::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r)
......@@ -4485,8 +4481,7 @@ void FrameLoader::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned lo
m_client->dispatchDidReceiveResponse(loader, identifier, r);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->didReceiveResponse(loader, identifier, r);
page->inspectorController()->didReceiveResponse(loader, identifier, r);
}
void FrameLoader::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long identifier, int length)
......@@ -4494,8 +4489,7 @@ void FrameLoader::dispatchDidReceiveContentLength(DocumentLoader* loader, unsign
m_client->dispatchDidReceiveContentLength(loader, identifier, length);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->didReceiveContentLength(loader, identifier, length);
page->inspectorController()->didReceiveContentLength(loader, identifier, length);
}
void FrameLoader::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier)
......@@ -4503,8 +4497,7 @@ void FrameLoader::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long
m_client->dispatchDidFinishLoading(loader, identifier);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->didFinishLoading(loader, identifier);
page->inspectorController()->didFinishLoading(loader, identifier);
}
bool FrameLoader::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
......@@ -4512,8 +4505,7 @@ bool FrameLoader::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader,
bool result = m_client->dispatchDidLoadResourceFromMemoryCache(loader, request, response, length);
if (Page* page = m_frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->didLoadResourceFromMemoryCache(loader, request, response, length);
page->inspectorController()->didLoadResourceFromMemoryCache(loader, request, response, length);
return result;
}
......
......@@ -95,7 +95,7 @@ void ContextMenuController::handleContextMenuEvent(Event* event)
m_contextMenu.set(new ContextMenu(result));
m_contextMenu->populate();
if (m_page->settings()->developerExtrasEnabled())
if (m_page->inspectorController()->enabled())
m_contextMenu->addInspectElementItem();
PlatformMenuDescription customMenu = m_client->getCustomMenuFromDefaultItems(m_contextMenu.get());
......@@ -277,8 +277,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
#endif
case ContextMenuItemTagInspectElement:
if (Page* page = frame->page())
if (InspectorController* inspector = page->inspectorController())
inspector->inspect(result.innerNonSharedNode());
page->inspectorController()->inspect(result.innerNonSharedNode());
break;
default:
break;
......
......@@ -46,6 +46,7 @@
#include "Range.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "Settings.h"
#include "Shared.h"
#include "SharedBuffer.h"
#include "SystemTime.h"
......@@ -481,9 +482,14 @@ InspectorController::~InspectorController()
deleteAllValues(m_consoleMessages);
}
bool InspectorController::enabled() const
{
return m_inspectedPage->settings()->developerExtrasEnabled();
}
void InspectorController::inspect(Node* node)
{
if (!node)
if (!node || !enabled())
return;
if (!m_page) {
......@@ -509,6 +515,9 @@ void InspectorController::inspect(Node* node)
void InspectorController::focusNode()
{
if (!enabled())
return;
ASSERT(m_scriptContext);
ASSERT(m_scriptObject);
ASSERT(m_nodeToFocus);
......@@ -532,13 +541,16 @@ void InspectorController::focusNode()
void InspectorController::highlight(Node* node)
{
if (!enabled())
return;
ASSERT_ARG(node, node);
m_client->highlight(node);
}
void InspectorController::hideHighlight()
{
if (!enabled())
return;
m_client->hideHighlight();
}
......@@ -570,6 +582,9 @@ void InspectorController::setWindowVisible(bool visible)
void InspectorController::addMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceID)
{
if (!enabled())
return;
ConsoleMessage* consoleMessage = new ConsoleMessage(source, level, message, lineNumber, sourceID);
m_consoleMessages.append(consoleMessage);
......@@ -579,17 +594,21 @@ void InspectorController::addMessageToConsole(MessageSource source, MessageLevel
void InspectorController::attachWindow()
{
if (!enabled())
return;
m_client->attachWindow();
}
void InspectorController::detachWindow()
{
if (!enabled())
return;
m_client->detachWindow();
}
void InspectorController::windowScriptObjectAvailable()
{
if (!m_page)
if (!m_page || !enabled())
return;
m_scriptContext = toRef(m_page->mainFrame()->scriptProxy()->interpreter()->globalExec());
......@@ -1075,6 +1094,9 @@ void InspectorController::pruneResources(ResourcesMap* resourceMap, DocumentLoad
void InspectorController::didCommitLoad(DocumentLoader* loader)
{
if (!enabled())
return;
if (loader->frame() == m_inspectedPage->mainFrame()) {
ASSERT(m_mainResource);
// FIXME: Should look into asserting that m_mainResource->loader == loader here.
......@@ -1101,6 +1123,8 @@ void InspectorController::didCommitLoad(DocumentLoader* loader)
void InspectorController::frameDetachedFromParent(Frame* frame)
{
if (!enabled())
return;
if (ResourcesMap* resourceMap = m_frameResources.get(frame))
removeAllResources(resourceMap);
}
......@@ -1140,6 +1164,9 @@ void InspectorController::removeResource(InspectorResource* resource)
void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
{
if (!enabled())
return;
InspectorResource* resource = new InspectorResource(m_nextIdentifier--, loader, loader->frame());
resource->finished = true;
......@@ -1163,6 +1190,9 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader,
void InspectorController::identifierForInitialRequest(unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
if (!enabled())
return;
InspectorResource* resource = new InspectorResource(identifier, loader, loader->frame());
updateResourceRequest(resource, request);
......@@ -1175,6 +1205,9 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier,
void InspectorController::willSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
if (!enabled())
return;
InspectorResource* resource = m_resources.get(identifier).get();
if (!resource)
return;
......@@ -1201,6 +1234,9 @@ void InspectorController::willSendRequest(DocumentLoader* loader, unsigned long
void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& response)
{
if (!enabled())
return;
InspectorResource* resource = m_resources.get(identifier).get();
if (!resource)
return;
......@@ -1217,6 +1253,9 @@ void InspectorController::didReceiveResponse(DocumentLoader*, unsigned long iden
void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
{
if (!enabled())
return;
InspectorResource* resource = m_resources.get(identifier).get();
if (!resource)
return;
......@@ -1229,6 +1268,9 @@ void InspectorController::didReceiveContentLength(DocumentLoader*, unsigned long
void InspectorController::didFinishLoading(DocumentLoader* loader, unsigned long identifier)
{
if (!enabled())
return;
RefPtr<InspectorResource> resource = m_resources.get(identifier);
if (!resource)
return;
......@@ -1248,6 +1290,9 @@ void InspectorController::didFinishLoading(DocumentLoader* loader, unsigned long
void InspectorController::didFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& /*error*/)
{
if (!enabled())
return;
RefPtr<InspectorResource> resource = m_resources.get(identifier);
if (!resource)
return;
......
......@@ -56,6 +56,8 @@ public:
void pageDestroyed() { m_page = 0; }
bool enabled() const;
Page* inspectedPage() const { return m_inspectedPage; }
void inspect(Node*);
......
......@@ -67,12 +67,13 @@ int PageCounter::count = 0;
static PageCounter pageCounter;
#endif
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient)
Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient)
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
, m_dragController(new DragController(this, dragClient))
, m_focusController(new FocusController(this))
, m_contextMenuController(new ContextMenuController(this, contextMenuClient))
, m_inspectorController(new InspectorController(this, inspectorClient))
, m_settings(new Settings(this))
, m_progress(new ProgressTracker)
, m_backForwardList(new BackForwardList(this))
......@@ -104,8 +105,7 @@ Page::~Page()
for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext())
frame->pageDestroyed();
m_editorClient->pageDestroyed();
if (m_inspectorController)
m_inspectorController->pageDestroyed();
m_inspectorController->pageDestroyed();
m_backForwardList->close();
......@@ -224,9 +224,4 @@ void Page::clearUndoRedoOperations()
m_editorClient->clearUndoRedoOperations();
}
void Page::setInspectorClient(InspectorClient* client)
{
m_inspectorController.set(new InspectorController(this, client));
}
} // namespace WebCore
......@@ -57,7 +57,7 @@ namespace WebCore {
static void setNeedsReapplyStyles();
static const HashSet<Page*>* frameNamespace(const String&);
Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*);
Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*);
~Page();
EditorClient* editorClient() const { return m_editorClient; }
......@@ -93,8 +93,6 @@ namespace WebCore {
Settings* settings() const { return m_settings.get(); }
ProgressTracker* progress() const { return m_progress.get(); }
void setInspectorClient(InspectorClient*);
void setParentInspectorController(InspectorController* controller) { m_parentInspectorController = controller; }
InspectorController* parentInspectorController() const { return m_parentInspectorController; }
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "InspectorClientGdk.h"
#include "NotImplemented.h"
namespace WebCore {
void InspectorClientGdk::inspectorDestroyed()
{
notImplemented();
}
Page* InspectorClientGdk::createPage()
{
notImplemented();
return 0;
}
void InspectorClientGdk::showWindow()
{
notImplemented();
}
void InspectorClientGdk::closeWindow()
{
notImplemented();
}
void InspectorClientGdk::attachWindow()
{
notImplemented();
}
void InspectorClientGdk::detachWindow()
{
notImplemented();
}
void InspectorClientGdk::highlight(Node* node)
{
notImplemented();
}
void InspectorClientGdk::hideHighlight()
{
notImplemented();
}
void InspectorClientGdk::inspectedURLChanged(const String&)
{
notImplemented();
}
}
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef InspectorClientGdk_h
#define InspectorClientGdk_h
#include "InspectorClient.h"
namespace WebCore {
class Node;
class Page;
class String;
class InspectorClientGdk : public InspectorClient {
public:
virtual void inspectorDestroyed();
virtual Page* createPage();
virtual void showWindow();
virtual void closeWindow();
virtual void attachWindow();
virtual void detachWindow();
virtual void highlight(Node*);
virtual void hideHighlight();
virtual void inspectedURLChanged(const String& newURL);
};
}
#endif
......@@ -135,10 +135,11 @@ bool SVGImage::dataChanged(bool allDataReceived)
static EditorClient* dummyEditorClient = new SVGEmptyEditorClient;
static ContextMenuClient* dummyContextMenuClient = new SVGEmptyContextMenuClient;
static DragClient* dummyDragClient = new SVGEmptyDragClient;
static InspectorClient* dummyInspectorClient = new SVGEmptyInspectorClient;
// FIXME: If this SVG ends up loading itself, we'll leak this Frame (and associated DOM & render trees).
// The Cache code does not know about CachedImages holding Frames and won't know to break the cycle.
m_page.set(new Page(dummyChromeClient, dummyContextMenuClient, dummyEditorClient, dummyDragClient));
m_page.set(new Page(dummyChromeClient, dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient));
m_frame = new Frame(m_page.get(), 0, dummyFrameLoaderClient);
m_frame->init();
m_frameView = new FrameView(m_frame.get());
......
......@@ -34,6 +34,7 @@
#include "EditorClient.h"
#include "FocusDirection.h"
#include "FrameLoaderClient.h"
#include "InspectorClient.h"
#include "SharedBuffer.h"
/*
......@@ -391,6 +392,25 @@ public:
virtual DragImageRef createDragImageForLink(KURL&, const String& label, Frame*) { return 0; }
virtual void dragControllerDestroyed() { }
};
class SVGEmptyInspectorClient : public InspectorClient {
public:
virtual ~SVGEmptyInspectorClient() {}
virtual void inspectorDestroyed() {};
virtual WebCore::Page* createPage() { return 0; };
virtual void showWindow() {};
virtual void closeWindow() {};
virtual void attachWindow() {};
virtual void detachWindow() {};