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 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public License 17 * along with this library; see the file COPYING.LIB. If not, write to 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef Chrome_h 23 #define Chrome_h 24 25 #include "core/loader/NavigationPolicy.h" 26 #include "core/page/FocusDirection.h" 27 #include "platform/Cursor.h" 28 #include "platform/HostWindow.h" 29 #include "wtf/Forward.h" 30 31 namespace WebCore { 32 33 class ChromeClient; 34 class ColorChooser; 35 class ColorChooserClient; 36 class DateTimeChooser; 37 class DateTimeChooserClient; 38 class FileChooser; 39 class FloatRect; 40 class Frame; 41 class Geolocation; 42 class HTMLInputElement; 43 class HitTestResult; 44 class IntRect; 45 class Node; 46 class Page; 47 class PopupMenu; 48 class PopupMenuClient; 49 class PopupOpeningObserver; 50 class SearchPopupMenu; 51 52 struct DateTimeChooserParameters; 53 struct ViewportDescription; 54 struct WindowFeatures; 55 56 class Chrome : public HostWindow { 57 public: 58 ~Chrome(); 59 60 static PassOwnPtr<Chrome> create(Page*, ChromeClient*); 61 client()62 ChromeClient& client() { return *m_client; } 63 64 // HostWindow methods. 65 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE; 66 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE; 67 virtual void scroll(const IntSize&, const IntRect&, const IntRect&) OVERRIDE; 68 virtual IntPoint screenToRootView(const IntPoint&) const OVERRIDE; 69 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE; 70 virtual blink::WebScreenInfo screenInfo() const OVERRIDE; 71 72 virtual void scheduleAnimation() OVERRIDE; 73 74 void contentsSizeChanged(Frame*, const IntSize&) const; 75 void layoutUpdated(Frame*) const; 76 77 void setCursor(const Cursor&); 78 79 void setWindowRect(const FloatRect&) const; 80 FloatRect windowRect() const; 81 82 FloatRect pageRect() const; 83 84 void focus() const; 85 void unfocus() const; 86 87 bool canTakeFocus(FocusDirection) const; 88 void takeFocus(FocusDirection) const; 89 90 void focusedNodeChanged(Node*) const; 91 92 void show(NavigationPolicy = NavigationPolicyIgnore) const; 93 94 bool canRunModal() const; 95 bool canRunModalNow() const; 96 void runModal() const; 97 98 void setWindowFeatures(const WindowFeatures&) const; 99 100 bool toolbarsVisible() const; 101 bool statusbarVisible() const; 102 bool scrollbarsVisible() const; 103 bool menubarVisible() const; 104 105 bool canRunBeforeUnloadConfirmPanel(); 106 bool runBeforeUnloadConfirmPanel(const String& message, Frame*); 107 108 void closeWindowSoon(); 109 110 void runJavaScriptAlert(Frame*, const String&); 111 bool runJavaScriptConfirm(Frame*, const String&); 112 bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result); 113 void setStatusbarText(Frame*, const String&); 114 115 IntRect windowResizerRect() const; 116 117 void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); 118 119 void setToolTip(const HitTestResult&); 120 121 void print(Frame*); 122 123 PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color& initialColor); 124 PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&); 125 void openTextDataListChooser(HTMLInputElement&); 126 127 void runOpenPanel(Frame*, PassRefPtr<FileChooser>); 128 void enumerateChosenDirectory(FileChooser*); 129 130 void dispatchViewportPropertiesDidChange(const ViewportDescription&) const; 131 132 bool hasOpenedPopup() const; 133 PassRefPtr<PopupMenu> createPopupMenu(Frame&, PopupMenuClient*) const; 134 135 void registerPopupOpeningObserver(PopupOpeningObserver*); 136 void unregisterPopupOpeningObserver(PopupOpeningObserver*); 137 138 private: 139 Chrome(Page*, ChromeClient*); 140 void notifyPopupOpeningObservers() const; 141 142 Page* m_page; 143 ChromeClient* m_client; 144 Vector<PopupOpeningObserver*> m_popupOpeningObservers; 145 }; 146 147 } 148 149 #endif // Chrome_h 150