WebChromeClient.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
  3. * Copyright (C) 2010 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. * 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. #include <WebCore/ChromeClient.h>
  27. #include <WebCore/COMPtr.h>
  28. #include <WebCore/GraphicsContext.h>
  29. #include <WebCore/FocusDirection.h>
  30. #include <WebCore/ScrollTypes.h>
  31. #include <wtf/Forward.h>
  32. #include <wtf/PassRefPtr.h>
  33. class WebView;
  34. class WebDesktopNotificationsDelegate;
  35. interface IWebUIDelegate;
  36. class WebChromeClient : public WebCore::ChromeClient {
  37. public:
  38. WebChromeClient(WebView*);
  39. virtual void chromeDestroyed();
  40. virtual void setWindowRect(const WebCore::FloatRect&);
  41. virtual WebCore::FloatRect windowRect();
  42. virtual WebCore::FloatRect pageRect();
  43. virtual void focus();
  44. virtual void unfocus();
  45. virtual bool canTakeFocus(WebCore::FocusDirection);
  46. virtual void takeFocus(WebCore::FocusDirection);
  47. virtual void focusedNodeChanged(WebCore::Node*);
  48. virtual void focusedFrameChanged(WebCore::Frame*);
  49. virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&);
  50. virtual void show();
  51. virtual bool canRunModal();
  52. virtual void runModal();
  53. virtual void setToolbarsVisible(bool);
  54. virtual bool toolbarsVisible();
  55. virtual void setStatusbarVisible(bool);
  56. virtual bool statusbarVisible();
  57. virtual void setScrollbarsVisible(bool);
  58. virtual bool scrollbarsVisible();
  59. virtual void setMenubarVisible(bool);
  60. virtual bool menubarVisible();
  61. virtual void setResizable(bool);
  62. virtual void addMessageToConsole(WebCore::MessageSource, WebCore::MessageLevel, const WTF::String& message, unsigned lineNumber, unsigned columnNumber, const WTF::String& url);
  63. virtual bool canRunBeforeUnloadConfirmPanel();
  64. virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame);
  65. virtual void closeWindowSoon();
  66. virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&);
  67. virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&);
  68. virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
  69. virtual void setStatusbarText(const WTF::String&);
  70. virtual bool shouldInterruptJavaScript();
  71. virtual WebCore::KeyboardUIMode keyboardUIMode();
  72. virtual WebCore::IntRect windowResizerRect() const;
  73. virtual void invalidateRootView(const WebCore::IntRect&, bool);
  74. virtual void invalidateContentsAndRootView(const WebCore::IntRect&, bool);
  75. virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
  76. virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect);
  77. virtual WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const;
  78. virtual WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const;
  79. virtual PlatformPageClient platformPageClient() const;
  80. virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
  81. virtual void scrollbarsModeDidChange() const { }
  82. virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
  83. virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const;
  84. virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const;
  85. virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
  86. virtual void print(WebCore::Frame*);
  87. #if ENABLE(SQL_DATABASE)
  88. virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String&, WebCore::DatabaseDetails);
  89. #endif
  90. virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
  91. virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
  92. virtual void populateVisitedLinks();
  93. virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
  94. virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
  95. virtual void setCursor(const WebCore::Cursor&);
  96. virtual void setCursorHiddenUntilMouseMoves(bool);
  97. virtual void setLastSetCursorToCurrentCursor();
  98. virtual void formStateDidChange(const WebCore::Node*) { }
  99. #if USE(ACCELERATED_COMPOSITING)
  100. // Pass 0 as the GraphicsLayer to detatch the root layer.
  101. virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
  102. // Sets a flag to specify that the next time content is drawn to the window,
  103. // the changes appear on the screen in synchrony with updates to GraphicsLayers.
  104. virtual void setNeedsOneShotDrawingSynchronization() { }
  105. // Sets a flag to specify that the view needs to be updated, so we need
  106. // to do an eager layout before the drawing.
  107. virtual void scheduleCompositingLayerFlush();
  108. #endif
  109. #if PLATFORM(WIN) && USE(AVFOUNDATION)
  110. virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE;
  111. #endif
  112. virtual void scrollRectIntoView(const WebCore::IntRect&) const { }
  113. #if ENABLE(VIDEO)
  114. virtual bool supportsFullscreenForNode(const WebCore::Node*);
  115. virtual void enterFullscreenForNode(WebCore::Node*);
  116. virtual void exitFullscreenForNode(WebCore::Node*);
  117. #endif
  118. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  119. virtual WebCore::NotificationClient* notificationPresenter() const { return reinterpret_cast<WebCore::NotificationClient*>(m_notificationsDelegate.get()); }
  120. #endif
  121. virtual bool selectItemWritingDirectionIsNatural();
  122. virtual bool selectItemAlignmentFollowsMenuWritingDirection();
  123. virtual bool hasOpenedPopup() const;
  124. virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
  125. virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
  126. #if ENABLE(FULLSCREEN_API)
  127. virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard);
  128. virtual void enterFullScreenForElement(WebCore::Element*);
  129. virtual void exitFullScreenForElement(WebCore::Element*);
  130. #endif
  131. virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
  132. virtual void numWheelEventHandlersChanged(unsigned) { }
  133. WebView* webView() { return m_webView; }
  134. virtual void AXStartFrameLoad();
  135. virtual void AXFinishFrameLoad();
  136. private:
  137. COMPtr<IWebUIDelegate> uiDelegate();
  138. WebView* m_webView;
  139. #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
  140. OwnPtr<WebDesktopNotificationsDelegate> m_notificationsDelegate;
  141. #endif
  142. };