1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 * its contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef InspectorClientQt_h 31 #define InspectorClientQt_h 32 33 #include "InspectorClient.h" 34 #include "InspectorFrontendClientLocal.h" 35 #include "OwnPtr.h" 36 #include "PassOwnPtr.h" 37 #include <QtCore/QString> 38 #include <wtf/Forward.h> 39 40 class QWebPage; 41 class QWebView; 42 43 namespace WebCore { 44 class InspectorFrontendClientQt; 45 class InspectorServerRequestHandlerQt; 46 class Node; 47 class Page; 48 class RemoteFrontendChannel; 49 50 class InspectorClientQt : public InspectorClient { 51 public: 52 InspectorClientQt(QWebPage*); 53 54 virtual void inspectorDestroyed(); 55 56 virtual void openInspectorFrontend(WebCore::InspectorController*); 57 58 virtual void highlight(Node*); 59 virtual void hideHighlight(); 60 61 virtual bool sendMessageToFrontend(const String&); 62 63 void releaseFrontendPage(); 64 65 void attachAndReplaceRemoteFrontend(RemoteFrontendChannel *channel); 66 void detachRemoteFrontend(); 67 68 private: 69 QWebPage* m_inspectedWebPage; 70 QWebPage* m_frontendWebPage; 71 InspectorFrontendClientQt* m_frontendClient; 72 bool m_remoteInspector; 73 74 friend class InspectorServerRequestHandlerQt; 75 }; 76 77 class InspectorFrontendClientQt : public InspectorFrontendClientLocal { 78 public: 79 InspectorFrontendClientQt(QWebPage* inspectedWebPage, PassOwnPtr<QWebView> inspectorView, InspectorClientQt* inspectorClient); 80 virtual ~InspectorFrontendClientQt(); 81 82 virtual void frontendLoaded(); 83 84 virtual String localizedStringsURL(); 85 86 virtual String hiddenPanels(); 87 88 virtual void bringToFront(); 89 virtual void closeWindow(); 90 virtual void disconnectFromBackend(); 91 92 virtual void attachWindow(); 93 virtual void detachWindow(); 94 95 virtual void setAttachedWindowHeight(unsigned height); 96 97 virtual void inspectedURLChanged(const String& newURL); 98 99 void inspectorClientDestroyed(); 100 101 private: 102 void updateWindowTitle(); 103 void destroyInspectorView(bool notifyInspectorController); 104 QWebPage* m_inspectedWebPage; 105 OwnPtr<QWebView> m_inspectorView; 106 QString m_inspectedURL; 107 bool m_destroyingInspectorView; 108 InspectorClientQt* m_inspectorClient; 109 }; 110 } 111 112 #endif 113