1 /* 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef Chrome_h 21 #define Chrome_h 22 23 #include "Cursor.h" 24 #include "FileChooser.h" 25 #include "FocusDirection.h" 26 #include "HostWindow.h" 27 #include <wtf/Forward.h> 28 #include <wtf/RefPtr.h> 29 30 #if PLATFORM(MAC) 31 #ifndef __OBJC__ 32 class NSView; 33 #endif 34 #endif 35 36 namespace WebCore { 37 38 class ChromeClient; 39 class ContextMenu; 40 class FloatRect; 41 class Frame; 42 class Geolocation; 43 class HitTestResult; 44 class IntRect; 45 class Page; 46 class String; 47 48 struct FrameLoadRequest; 49 struct WindowFeatures; 50 51 class Chrome : public HostWindow { 52 public: 53 Chrome(Page*, ChromeClient*); 54 ~Chrome(); 55 client()56 ChromeClient* client() { return m_client; } 57 58 // HostWindow methods. 59 virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); 60 virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); 61 virtual IntPoint screenToWindow(const IntPoint&) const; 62 virtual IntRect windowToScreen(const IntRect&) const; 63 virtual PlatformWidget platformWindow() const; 64 virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const; 65 66 void contentsSizeChanged(Frame*, const IntSize&) const; 67 68 void setWindowRect(const FloatRect&) const; 69 FloatRect windowRect() const; 70 71 FloatRect pageRect() const; 72 73 float scaleFactor(); 74 75 void focus() const; 76 void unfocus() const; 77 78 bool canTakeFocus(FocusDirection) const; 79 void takeFocus(FocusDirection) const; 80 81 Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) const; 82 void show() const; 83 84 bool canRunModal() const; 85 bool canRunModalNow() const; 86 void runModal() const; 87 88 void setToolbarsVisible(bool) const; 89 bool toolbarsVisible() const; 90 91 void setStatusbarVisible(bool) const; 92 bool statusbarVisible() const; 93 94 void setScrollbarsVisible(bool) const; 95 bool scrollbarsVisible() const; 96 97 void setMenubarVisible(bool) const; 98 bool menubarVisible() const; 99 100 void setResizable(bool) const; 101 102 bool canRunBeforeUnloadConfirmPanel(); 103 bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame); 104 105 void closeWindowSoon(); 106 107 void runJavaScriptAlert(Frame*, const String&); 108 bool runJavaScriptConfirm(Frame*, const String&); 109 bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result); 110 void setStatusbarText(Frame*, const String&); 111 bool shouldInterruptJavaScript(); 112 113 IntRect windowResizerRect() const; 114 115 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); 116 117 void setToolTip(const HitTestResult&); 118 119 void print(Frame*); 120 121 void requestGeolocationPermissionForFrame(Frame*, Geolocation*); 122 123 void runOpenPanel(Frame*, PassRefPtr<FileChooser>); 124 125 bool setCursor(PlatformCursorHandle); 126 127 #if PLATFORM(MAC) 128 void focusNSView(NSView*); 129 #endif 130 131 private: 132 Page* m_page; 133 ChromeClient* m_client; 134 }; 135 } 136 137 #endif // Chrome_h 138