ChromeClientManx.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
  3. * Copyright (C) 2012 Sony Computer Entertainment Inc.
  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. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  15. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  16. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  18. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifndef ChromeClientManx_h
  27. #define ChromeClientManx_h
  28. #include "ChromeClient.h"
  29. #include "FocusDirection.h"
  30. #include "IntRect.h"
  31. #include "KURL.h"
  32. class ChromeClientListener;
  33. namespace WebKit {
  34. class WebViewPrivate;
  35. }
  36. namespace WebCore {
  37. class ChromeClientManx : public ChromeClient {
  38. public:
  39. ChromeClientManx(WebKit::WebViewPrivate*);
  40. virtual ~ChromeClientManx();
  41. virtual void chromeDestroyed();
  42. virtual void* webView() const { return 0; }
  43. virtual void setWindowRect(const FloatRect&);
  44. virtual FloatRect windowRect();
  45. virtual FloatRect pageRect();
  46. virtual void focus();
  47. virtual void unfocus();
  48. virtual bool canTakeFocus(FocusDirection);
  49. virtual void takeFocus(FocusDirection);
  50. virtual void focusedNodeChanged(Node*);
  51. virtual void focusedFrameChanged(Frame*);
  52. virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&);
  53. virtual Page* createModalDialog(Frame*, const FrameLoadRequest&);
  54. virtual void show();
  55. virtual bool canRunModal();
  56. virtual void runModal();
  57. virtual void setToolbarsVisible(bool);
  58. virtual bool toolbarsVisible();
  59. virtual void setStatusbarVisible(bool);
  60. virtual bool statusbarVisible();
  61. virtual void setScrollbarsVisible(bool);
  62. virtual bool scrollbarsVisible();
  63. virtual void setMenubarVisible(bool);
  64. virtual bool menubarVisible();
  65. virtual void createSelectPopup(PopupMenuClient*, int index, const IntRect&);
  66. virtual bool destroySelectPopup();
  67. virtual void setResizable(bool);
  68. virtual void addMessageToConsole(MessageSource,
  69. MessageLevel,
  70. const String& message,
  71. unsigned lineNumber,
  72. unsigned columnNumber,
  73. const String& sourceID);
  74. virtual bool canRunBeforeUnloadConfirmPanel();
  75. virtual bool runBeforeUnloadConfirmPanel(const String& message,
  76. Frame*);
  77. virtual void closeWindowSoon();
  78. virtual void runJavaScriptAlert(Frame*, const String&);
  79. virtual bool runJavaScriptConfirm(Frame*, const String&);
  80. virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
  81. virtual void setStatusbarText(const String&);
  82. virtual bool shouldInterruptJavaScript();
  83. virtual WebCore::KeyboardUIMode keyboardUIMode();
  84. virtual bool tabsToLinks() const;
  85. virtual IntRect windowResizerRect() const;
  86. virtual void elementDidFocus(const Node*);
  87. virtual void elementDidBlur(const Node*);
  88. // Methods used by HostWindow.
  89. virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
  90. virtual void updateBackingStore();
  91. virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
  92. virtual void invalidateRootView(const IntRect&, bool);
  93. virtual void invalidateContentsAndRootView(const IntRect&, bool);
  94. virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
  95. virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
  96. #if USE(TILED_BACKING_STORE)
  97. virtual void delegatedScrollRequested(const IntPoint&);
  98. virtual IntRect visibleRectForTiledBackingStore() const;
  99. #endif
  100. virtual IntPoint screenToRootView(const IntPoint&) const;
  101. virtual IntRect rootViewToScreen(const IntRect&) const;
  102. virtual PlatformPageClient platformPageClient() const;
  103. virtual void scrollbarsModeDidChange() const { }
  104. virtual void setCursor(const WebCore::Cursor&);
  105. virtual void setCursorHiddenUntilMouseMoves(bool);
  106. #if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER)
  107. virtual void scheduleAnimation() { };
  108. #endif
  109. // End methods used by HostWindow.
  110. virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const;
  111. virtual void contentsSizeChanged(Frame*, const IntSize&) const;
  112. virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
  113. virtual void setToolTip(const String&, TextDirection);
  114. virtual void print(Frame*);
  115. #if ENABLE(SQL_DATABASE)
  116. virtual void exceededDatabaseQuota(Frame*, const String&, DatabaseDetails);
  117. #endif
  118. virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
  119. virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded);
  120. #if USE(ACCELERATED_COMPOSITING)
  121. virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*);
  122. virtual void setNeedsOneShotDrawingSynchronization();
  123. virtual void scheduleCompositingLayerFlush();
  124. #endif
  125. virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
  126. virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*);
  127. virtual void formStateDidChange(const Node*) { }
  128. #if ENABLE(TOUCH_EVENTS)
  129. virtual void needTouchEvents(bool);
  130. #endif
  131. virtual bool selectItemWritingDirectionIsNatural();
  132. virtual bool selectItemAlignmentFollowsMenuWritingDirection();
  133. virtual bool hasOpenedPopup() const;
  134. virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
  135. virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
  136. #if ENABLE(PAGE_POPUP)
  137. // Creates a PagePopup object, and shows it beside originBoundsInRootView.
  138. // The return value can be 0.
  139. virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) = 0;
  140. virtual void closePagePopup(PagePopup*) = 0;
  141. #endif
  142. virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
  143. virtual void numWheelEventHandlersChanged(unsigned) { }
  144. virtual void numTouchEventHandlersChanged(unsigned) { }
  145. #if ENABLE(INPUT_TYPE_COLOR)
  146. virtual PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color&);
  147. #endif
  148. void setUpload(const char* path);
  149. void setChromeClientListener(ChromeClientListener* listener) { m_listener = listener; }
  150. private:
  151. WebKit::WebViewPrivate* m_webView;
  152. RefPtr<FileChooser> m_file;
  153. ChromeClientListener* m_listener;
  154. };
  155. }
  156. #endif // ChromeClientManx_h