ChromeClientQt.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /*
  2. * Copyright (C) 2006 Zack Rusin <zack@kde.org>
  3. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  18. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  20. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  21. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  22. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  23. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  24. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef ChromeClientQt_h
  29. #define ChromeClientQt_h
  30. #include "ChromeClient.h"
  31. #include "FloatRect.h"
  32. #include "KURL.h"
  33. #include "QtPlatformPlugin.h"
  34. #include <wtf/PassOwnPtr.h>
  35. #include <wtf/RefCounted.h>
  36. #include <wtf/text/WTFString.h>
  37. QT_BEGIN_NAMESPACE
  38. class QEventLoop;
  39. QT_END_NAMESPACE
  40. class QWebPage;
  41. class QWebPageAdapter;
  42. class QWebFullScreenVideoHandler;
  43. namespace WebCore {
  44. class FileChooser;
  45. class FileIconLoader;
  46. class FloatRect;
  47. class Page;
  48. class RefreshAnimation;
  49. struct FrameLoadRequest;
  50. class QtAbstractWebPopup;
  51. struct ViewportArguments;
  52. #if ENABLE(VIDEO)
  53. class FullScreenVideoQt;
  54. #endif
  55. class TextureMapperLayerClientQt;
  56. class ChromeClientQt : public ChromeClient {
  57. public:
  58. ChromeClientQt(QWebPageAdapter*);
  59. virtual ~ChromeClientQt();
  60. virtual void chromeDestroyed();
  61. virtual void setWindowRect(const FloatRect&);
  62. virtual FloatRect windowRect();
  63. virtual FloatRect pageRect();
  64. virtual void focus();
  65. virtual void unfocus();
  66. virtual bool canTakeFocus(FocusDirection);
  67. virtual void takeFocus(FocusDirection);
  68. virtual void focusedNodeChanged(Node*);
  69. virtual void focusedFrameChanged(Frame*);
  70. virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&);
  71. virtual void show();
  72. virtual bool canRunModal();
  73. virtual void runModal();
  74. virtual void setToolbarsVisible(bool);
  75. virtual bool toolbarsVisible();
  76. virtual void setStatusbarVisible(bool);
  77. virtual bool statusbarVisible();
  78. virtual void setScrollbarsVisible(bool);
  79. virtual bool scrollbarsVisible();
  80. virtual void setMenubarVisible(bool);
  81. virtual bool menubarVisible();
  82. virtual void setResizable(bool);
  83. virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceID);
  84. virtual bool canRunBeforeUnloadConfirmPanel();
  85. virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame*);
  86. virtual void closeWindowSoon();
  87. virtual void runJavaScriptAlert(Frame*, const String&);
  88. virtual bool runJavaScriptConfirm(Frame*, const String&);
  89. virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
  90. virtual bool shouldInterruptJavaScript();
  91. virtual void setStatusbarText(const String&);
  92. virtual KeyboardUIMode keyboardUIMode();
  93. virtual IntRect windowResizerRect() const;
  94. virtual void invalidateRootView(const IntRect&, bool);
  95. virtual void invalidateContentsAndRootView(const IntRect&, bool);
  96. virtual void invalidateContentsForSlowScroll(const IntRect&, bool);
  97. virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
  98. #if USE(TILED_BACKING_STORE)
  99. virtual void delegatedScrollRequested(const IntPoint& scrollPoint);
  100. #endif
  101. virtual IntPoint screenToRootView(const IntPoint&) const;
  102. virtual IntRect rootViewToScreen(const IntRect&) const;
  103. virtual PlatformPageClient platformPageClient() const;
  104. virtual void contentsSizeChanged(Frame*, const IntSize&) const;
  105. virtual void scrollbarsModeDidChange() const { }
  106. virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
  107. virtual void setToolTip(const String&, TextDirection);
  108. virtual void print(Frame*);
  109. #if ENABLE(SQL_DATABASE)
  110. virtual void exceededDatabaseQuota(Frame*, const String&, DatabaseDetails);
  111. #endif
  112. virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
  113. virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
  114. #if USE(ACCELERATED_COMPOSITING)
  115. // This is a hook for WebCore to tell us what we need to do with the GraphicsLayers.
  116. virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
  117. virtual void setNeedsOneShotDrawingSynchronization();
  118. virtual void scheduleCompositingLayerFlush();
  119. virtual CompositingTriggerFlags allowedCompositingTriggers() const;
  120. #endif
  121. virtual bool allowsAcceleratedCompositing() const;
  122. #if USE(TILED_BACKING_STORE)
  123. virtual IntRect visibleRectForTiledBackingStore() const;
  124. #endif
  125. #if ENABLE(TOUCH_EVENTS)
  126. virtual void needTouchEvents(bool) { }
  127. #endif
  128. #if ENABLE(VIDEO) && ((USE(GSTREAMER) && USE(NATIVE_FULLSCREEN_VIDEO)) || USE(QT_MULTIMEDIA))
  129. virtual bool supportsFullscreenForNode(const Node*);
  130. virtual void enterFullscreenForNode(Node*);
  131. virtual void exitFullscreenForNode(Node*);
  132. virtual bool requiresFullscreenForVideoPlayback();
  133. FullScreenVideoQt* fullScreenVideo();
  134. #endif
  135. #if ENABLE(INPUT_TYPE_COLOR)
  136. virtual PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&);
  137. #endif
  138. virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
  139. virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
  140. virtual void formStateDidChange(const Node*) { }
  141. virtual void setCursor(const Cursor&);
  142. virtual void setCursorHiddenUntilMouseMoves(bool) { }
  143. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  144. virtual void scheduleAnimation();
  145. virtual void serviceScriptedAnimations();
  146. #endif
  147. virtual void scrollRectIntoView(const LayoutRect) const { }
  148. virtual bool selectItemWritingDirectionIsNatural();
  149. virtual bool selectItemAlignmentFollowsMenuWritingDirection();
  150. virtual bool hasOpenedPopup() const;
  151. virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
  152. virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
  153. virtual void populateVisitedLinks();
  154. PassOwnPtr<QWebSelectMethod> createSelectPopup() const;
  155. virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const;
  156. virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
  157. virtual void numWheelEventHandlersChanged(unsigned) { }
  158. QWebFullScreenVideoHandler* createFullScreenVideoHandler();
  159. QWebPageAdapter* m_webPage;
  160. KURL lastHoverURL;
  161. String lastHoverTitle;
  162. String lastHoverContent;
  163. bool toolBarsVisible;
  164. bool statusBarVisible;
  165. bool menuBarVisible;
  166. QEventLoop* m_eventLoop;
  167. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  168. OwnPtr<RefreshAnimation> m_refreshAnimation;
  169. #endif
  170. #if ENABLE(VIDEO) && (USE(GSTREAMER) || USE(QT_MULTIMEDIA))
  171. FullScreenVideoQt* m_fullScreenVideo;
  172. #endif
  173. static bool dumpVisitedLinksCallbacks;
  174. mutable QtPlatformPlugin m_platformPlugin;
  175. #if USE(ACCELERATED_COMPOSITING)
  176. OwnPtr<TextureMapperLayerClientQt> m_textureMapperLayerClient;
  177. #endif
  178. };
  179. }
  180. #endif