1 /* 2 * Copyright (C) 2007 Holger Hans Peter Freyther 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef ChromeClientGtk_h 22 #define ChromeClientGtk_h 23 24 #include "ChromeClient.h" 25 #include "KURL.h" 26 #include "PopupMenu.h" 27 #include "SearchPopupMenu.h" 28 29 typedef struct _WebKitWebView WebKitWebView; 30 31 namespace WebCore { 32 class PopupMenuClient; 33 } 34 35 namespace WebKit { 36 37 class ChromeClient : public WebCore::ChromeClient { 38 public: 39 ChromeClient(WebKitWebView*); webView()40 WebKitWebView* webView() const { return m_webView; } 41 42 virtual void chromeDestroyed(); 43 44 virtual void setWindowRect(const WebCore::FloatRect&); 45 virtual WebCore::FloatRect windowRect(); 46 47 virtual WebCore::FloatRect pageRect(); 48 49 virtual float scaleFactor(); 50 51 virtual void focus(); 52 virtual void unfocus(); 53 54 virtual bool canTakeFocus(WebCore::FocusDirection); 55 virtual void takeFocus(WebCore::FocusDirection); 56 57 virtual void focusedNodeChanged(WebCore::Node*); 58 virtual void focusedFrameChanged(WebCore::Frame*); 59 60 virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&); 61 virtual void show(); 62 63 virtual bool canRunModal(); 64 virtual void runModal(); 65 66 virtual void setToolbarsVisible(bool); 67 virtual bool toolbarsVisible(); 68 69 virtual void setStatusbarVisible(bool); 70 virtual bool statusbarVisible(); 71 72 virtual void setScrollbarsVisible(bool); 73 virtual bool scrollbarsVisible(); 74 75 virtual void setMenubarVisible(bool); 76 virtual bool menubarVisible(); 77 78 virtual void setResizable(bool); 79 80 virtual void addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, 81 WebCore::MessageLevel level, const WTF::String& message, 82 unsigned int lineNumber, const WTF::String& sourceID); 83 84 virtual bool canRunBeforeUnloadConfirmPanel(); 85 virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame); 86 87 virtual void closeWindowSoon(); 88 89 virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&); 90 virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&); 91 virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result); 92 virtual void setStatusbarText(const WTF::String&); 93 virtual bool shouldInterruptJavaScript(); 94 virtual WebCore::KeyboardUIMode keyboardUIMode(); 95 96 virtual WebCore::IntRect windowResizerRect() const; 97 98 virtual void invalidateWindow(const WebCore::IntRect&, bool); 99 virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool); 100 virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool); 101 virtual void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect); 102 103 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; 104 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; 105 virtual PlatformPageClient platformPageClient() const; 106 virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; 107 108 virtual void scrollbarsModeDidChange() const; 109 virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); 110 111 virtual void setToolTip(const WTF::String&, WebCore::TextDirection); 112 113 virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments& arguments) const; 114 115 virtual void print(WebCore::Frame*); 116 #if ENABLE(DATABASE) 117 virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String&); 118 #endif 119 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 120 virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); 121 virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*); 122 #endif 123 #if ENABLE(CONTEXT_MENUS) showContextMenu()124 virtual void showContextMenu() { } 125 #endif 126 virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); 127 virtual void chooseIconForFiles(const Vector<WTF::String>&, WebCore::FileChooser*); 128 formStateDidChange(const WebCore::Node *)129 virtual void formStateDidChange(const WebCore::Node*) { } 130 131 virtual void setCursor(const WebCore::Cursor&); 132 scrollRectIntoView(const WebCore::IntRect &,const WebCore::ScrollView *)133 virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {} 134 virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*); 135 virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*); 136 137 virtual bool selectItemWritingDirectionIsNatural(); 138 virtual bool selectItemAlignmentFollowsMenuWritingDirection(); 139 virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const; 140 virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const; 141 #if ENABLE(VIDEO) 142 virtual bool supportsFullscreenForNode(const WebCore::Node*); 143 virtual void enterFullscreenForNode(WebCore::Node*); 144 virtual void exitFullscreenForNode(WebCore::Node*); 145 #endif 146 147 #if ENABLE(FULLSCREEN_API) 148 virtual bool supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard); 149 virtual void enterFullScreenForElement(WebCore::Element*); 150 virtual void exitFullScreenForElement(WebCore::Element*); 151 #endif 152 153 private: 154 WebKitWebView* m_webView; 155 WebCore::KURL m_hoveredLinkURL; 156 unsigned int m_closeSoonTimer; 157 bool m_pendingScrollInvalidations; 158 }; 159 } 160 161 #endif // ChromeClient_h 162