1 /* 2 * Copyright (C) 2006 Zack Rusin <zack@kde.org> 3 * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved. 4 * 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 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 * 15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 #ifndef ChromeClientHaiku_h 29 #define ChromeClientHaiku_h 30 31 #include "ChromeClient.h" 32 #include "FloatRect.h" 33 #include "RefCounted.h" 34 35 namespace WebCore { 36 37 class FloatRect; 38 class Page; 39 struct FrameLoadRequest; 40 41 class ChromeClientHaiku : public ChromeClient { 42 public: 43 ChromeClientHaiku(); 44 virtual ~ChromeClientHaiku(); 45 void chromeDestroyed(); 46 47 void setWindowRect(const FloatRect&); 48 FloatRect windowRect(); 49 50 FloatRect pageRect(); 51 52 float scaleFactor(); 53 54 void focus(); 55 void unfocus(); 56 57 bool canTakeFocus(FocusDirection); 58 void takeFocus(FocusDirection); 59 60 Page* createWindow(Frame*, const FrameLoadRequest&, const WebCore::WindowFeatures&); 61 Page* createModalDialog(Frame*, const FrameLoadRequest&); 62 void show(); 63 64 bool canRunModal(); 65 void runModal(); 66 67 void setToolbarsVisible(bool); 68 bool toolbarsVisible(); 69 70 void setStatusbarVisible(bool); 71 bool statusbarVisible(); 72 73 void setScrollbarsVisible(bool); 74 bool scrollbarsVisible(); 75 76 void setMenubarVisible(bool); 77 bool menubarVisible(); 78 79 void setResizable(bool); 80 81 void addMessageToConsole(const String& message, unsigned int lineNumber, 82 const String& sourceID); 83 void addMessageToConsole(MessageSource, MessageLevel, const String& message, 84 unsigned int lineNumber, const String& sourceID); 85 void addMessageToConsole(MessageSource, MessageType, MessageLevel, 86 const String&, unsigned int, const String&); 87 88 bool canRunBeforeUnloadConfirmPanel(); 89 90 bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame); 91 92 void closeWindowSoon(); 93 94 void runJavaScriptAlert(Frame*, const String&); 95 bool runJavaScriptConfirm(Frame*, const String&); 96 bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result); 97 bool shouldInterruptJavaScript(); 98 99 void setStatusbarText(const WebCore::String&); 100 bool tabsToLinks() const; 101 IntRect windowResizerRect() const; 102 103 void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); 104 void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); 105 IntPoint screenToWindow(const IntPoint&) const; 106 IntRect windowToScreen(const IntRect&) const; 107 PlatformWidget platformWindow() const; 108 void contentsSizeChanged(Frame*, const IntSize&) const; 109 void scrollRectIntoView(const IntRect&, const ScrollView*) const; 110 111 void addToDirtyRegion(const IntRect&); 112 void scrollBackingStore(int, int, const IntRect&, const IntRect&); 113 void updateBackingStore(); 114 115 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); 116 117 void setToolTip(const String&); 118 119 virtual void setToolTip(const String&, TextDirection); 120 121 void print(Frame*); 122 123 void exceededDatabaseQuota(Frame*, const String& databaseName); 124 125 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 126 virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); 127 #endif 128 129 // This is an asynchronous call. The ChromeClient can display UI asking the user for permission 130 // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately. 131 void requestGeolocationPermissionForFrame(Frame*, Geolocation*); 132 133 void runOpenPanel(Frame*, PassRefPtr<FileChooser>); 134 135 bool setCursor(PlatformCursorHandle); 136 137 // Notification that the given form element has changed. This function 138 // will be called frequently, so handling should be very fast. 139 void formStateDidChange(const Node*); 140 141 PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks(); 142 }; 143 144 } // namespace WebCore 145 146 #endif 147 148