InspectorClientQt.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. #ifndef InspectorClientQt_h
  30. #define InspectorClientQt_h
  31. #include "InspectorClient.h"
  32. #include "InspectorFrontendChannel.h"
  33. #include "InspectorFrontendClientLocal.h"
  34. #include <QObject>
  35. #include <QString>
  36. #include <wtf/Forward.h>
  37. #include <wtf/OwnPtr.h>
  38. #include <wtf/PassOwnPtr.h>
  39. class QWebPageAdapter;
  40. class QWebPage;
  41. class QWebView;
  42. namespace WebCore {
  43. class InspectorFrontendClientQt;
  44. class InspectorServerRequestHandlerQt;
  45. class Page;
  46. class InspectorClientQt : public InspectorClient, public InspectorFrontendChannel {
  47. public:
  48. explicit InspectorClientQt(QWebPageAdapter*);
  49. virtual void inspectorDestroyed();
  50. virtual WebCore::InspectorFrontendChannel* openInspectorFrontend(WebCore::InspectorController*);
  51. virtual void closeInspectorFrontend();
  52. virtual void bringFrontendToFront();
  53. virtual void highlight();
  54. virtual void hideHighlight();
  55. virtual bool sendMessageToFrontend(const String&);
  56. void releaseFrontendPage();
  57. void attachAndReplaceRemoteFrontend(InspectorServerRequestHandlerQt *channel);
  58. void detachRemoteFrontend();
  59. private:
  60. QWebPageAdapter* m_inspectedWebPage;
  61. QWebPageAdapter* m_frontendWebPage;
  62. InspectorFrontendClientQt* m_frontendClient;
  63. bool m_remoteInspector;
  64. InspectorServerRequestHandlerQt* m_remoteFrontEndChannel;
  65. friend class InspectorServerRequestHandlerQt;
  66. };
  67. class InspectorFrontendClientQt : public InspectorFrontendClientLocal {
  68. public:
  69. InspectorFrontendClientQt(QWebPageAdapter* inspectedWebPage, PassOwnPtr<QObject> inspectorView, WebCore::Page* inspectorPage, InspectorClientQt*);
  70. virtual ~InspectorFrontendClientQt();
  71. virtual void frontendLoaded();
  72. virtual String localizedStringsURL();
  73. virtual void bringToFront();
  74. virtual void closeWindow();
  75. virtual void attachWindow(DockSide);
  76. virtual void detachWindow();
  77. virtual void setAttachedWindowHeight(unsigned);
  78. virtual void setAttachedWindowWidth(unsigned);
  79. virtual void setToolbarHeight(unsigned) OVERRIDE;
  80. virtual void inspectedURLChanged(const String& newURL);
  81. void inspectorClientDestroyed();
  82. private:
  83. void updateWindowTitle();
  84. void destroyInspectorView(bool notifyInspectorController);
  85. QWebPageAdapter* m_inspectedWebPage;
  86. OwnPtr<QObject> m_inspectorView;
  87. QString m_inspectedURL;
  88. bool m_destroyingInspectorView;
  89. InspectorClientQt* m_inspectorClient;
  90. };
  91. }
  92. #endif