| 1 | /* |
| 2 | * Copyright (C) 2006-2017 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 | #pragma once |
| 23 | |
| 24 | #include "Cursor.h" |
| 25 | #include "DisabledAdaptations.h" |
| 26 | #include "FocusDirection.h" |
| 27 | #include "HostWindow.h" |
| 28 | #include <wtf/Forward.h> |
| 29 | #include <wtf/RefPtr.h> |
| 30 | |
| 31 | #if PLATFORM(COCOA) |
| 32 | OBJC_CLASS NSView; |
| 33 | #endif |
| 34 | |
| 35 | namespace WebCore { |
| 36 | |
| 37 | class ChromeClient; |
| 38 | class ColorChooser; |
| 39 | class ColorChooserClient; |
| 40 | class DataListSuggestionPicker; |
| 41 | class DataListSuggestionsClient; |
| 42 | class DateTimeChooser; |
| 43 | class DateTimeChooserClient; |
| 44 | class FileChooser; |
| 45 | class FileIconLoader; |
| 46 | class FloatRect; |
| 47 | class FrameLoadRequest; |
| 48 | class Element; |
| 49 | class Frame; |
| 50 | class Geolocation; |
| 51 | class HitTestResult; |
| 52 | class IntPoint; |
| 53 | class IntRect; |
| 54 | class NavigationAction; |
| 55 | class Page; |
| 56 | class ; |
| 57 | class ; |
| 58 | class ; |
| 59 | class ; |
| 60 | |
| 61 | struct DateTimeChooserParameters; |
| 62 | struct ShareDataWithParsedURL; |
| 63 | struct ViewportArguments; |
| 64 | struct WindowFeatures; |
| 65 | |
| 66 | class Chrome : public HostWindow { |
| 67 | public: |
| 68 | Chrome(Page&, ChromeClient&); |
| 69 | virtual ~Chrome(); |
| 70 | |
| 71 | ChromeClient& client() { return m_client; } |
| 72 | |
| 73 | // HostWindow methods. |
| 74 | void invalidateRootView(const IntRect&) override; |
| 75 | void invalidateContentsAndRootView(const IntRect&) override; |
| 76 | void invalidateContentsForSlowScroll(const IntRect&) override; |
| 77 | void scroll(const IntSize&, const IntRect&, const IntRect&) override; |
| 78 | IntPoint screenToRootView(const IntPoint&) const override; |
| 79 | IntRect rootViewToScreen(const IntRect&) const override; |
| 80 | IntPoint accessibilityScreenToRootView(const IntPoint&) const override; |
| 81 | IntRect rootViewToAccessibilityScreen(const IntRect&) const override; |
| 82 | PlatformPageClient platformPageClient() const override; |
| 83 | void setCursor(const Cursor&) override; |
| 84 | void setCursorHiddenUntilMouseMoves(bool) override; |
| 85 | |
| 86 | void scheduleAnimation() override { } |
| 87 | |
| 88 | PlatformDisplayID displayID() const override; |
| 89 | void windowScreenDidChange(PlatformDisplayID) override; |
| 90 | |
| 91 | FloatSize screenSize() const override; |
| 92 | FloatSize availableScreenSize() const override; |
| 93 | FloatSize overrideScreenSize() const override; |
| 94 | |
| 95 | void scrollRectIntoView(const IntRect&) const; |
| 96 | |
| 97 | void contentsSizeChanged(Frame&, const IntSize&) const; |
| 98 | |
| 99 | WEBCORE_EXPORT void setWindowRect(const FloatRect&) const; |
| 100 | WEBCORE_EXPORT FloatRect windowRect() const; |
| 101 | |
| 102 | FloatRect () const; |
| 103 | |
| 104 | void focus() const; |
| 105 | void unfocus() const; |
| 106 | |
| 107 | bool canTakeFocus(FocusDirection) const; |
| 108 | void takeFocus(FocusDirection) const; |
| 109 | |
| 110 | void focusedElementChanged(Element*) const; |
| 111 | void focusedFrameChanged(Frame*) const; |
| 112 | |
| 113 | WEBCORE_EXPORT Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) const; |
| 114 | WEBCORE_EXPORT void show() const; |
| 115 | |
| 116 | bool canRunModal() const; |
| 117 | void runModal() const; |
| 118 | |
| 119 | void setToolbarsVisible(bool) const; |
| 120 | bool toolbarsVisible() const; |
| 121 | |
| 122 | void setStatusbarVisible(bool) const; |
| 123 | bool statusbarVisible() const; |
| 124 | |
| 125 | void setScrollbarsVisible(bool) const; |
| 126 | bool scrollbarsVisible() const; |
| 127 | |
| 128 | void (bool) const; |
| 129 | bool () const; |
| 130 | |
| 131 | void setResizable(bool) const; |
| 132 | |
| 133 | bool canRunBeforeUnloadConfirmPanel(); |
| 134 | bool runBeforeUnloadConfirmPanel(const String& message, Frame&); |
| 135 | |
| 136 | void closeWindowSoon(); |
| 137 | |
| 138 | void runJavaScriptAlert(Frame&, const String&); |
| 139 | bool runJavaScriptConfirm(Frame&, const String&); |
| 140 | bool runJavaScriptPrompt(Frame&, const String& message, const String& defaultValue, String& result); |
| 141 | WEBCORE_EXPORT void setStatusbarText(Frame&, const String&); |
| 142 | |
| 143 | void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); |
| 144 | |
| 145 | void setToolTip(const HitTestResult&); |
| 146 | |
| 147 | WEBCORE_EXPORT bool print(Frame&); |
| 148 | |
| 149 | WEBCORE_EXPORT void enableSuddenTermination(); |
| 150 | WEBCORE_EXPORT void disableSuddenTermination(); |
| 151 | |
| 152 | #if ENABLE(INPUT_TYPE_COLOR) |
| 153 | std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color& initialColor); |
| 154 | #endif |
| 155 | |
| 156 | #if ENABLE(DATALIST_ELEMENT) |
| 157 | std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&); |
| 158 | #endif |
| 159 | |
| 160 | void runOpenPanel(Frame&, FileChooser&); |
| 161 | void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&); |
| 162 | void loadIconForFiles(const Vector<String>&, FileIconLoader&); |
| 163 | |
| 164 | void dispatchDisabledAdaptationsDidChange(const OptionSet<DisabledAdaptations>&) const; |
| 165 | void dispatchViewportPropertiesDidChange(const ViewportArguments&) const; |
| 166 | |
| 167 | bool requiresFullscreenForVideoPlayback(); |
| 168 | |
| 169 | #if PLATFORM(COCOA) |
| 170 | WEBCORE_EXPORT void focusNSView(NSView*); |
| 171 | #endif |
| 172 | |
| 173 | bool selectItemWritingDirectionIsNatural(); |
| 174 | bool (); |
| 175 | RefPtr<PopupMenu> (PopupMenuClient&) const; |
| 176 | RefPtr<SearchPopupMenu> (PopupMenuClient&) const; |
| 177 | |
| 178 | #if PLATFORM(IOS_FAMILY) |
| 179 | // FIXME: Can we come up with a better name for this setter? |
| 180 | void setDispatchViewportDataDidChangeSuppressed(bool dispatchViewportDataDidChangeSuppressed) { m_isDispatchViewportDataDidChangeSuppressed = dispatchViewportDataDidChangeSuppressed; } |
| 181 | #endif |
| 182 | |
| 183 | void didReceiveDocType(Frame&); |
| 184 | |
| 185 | void (PopupOpeningObserver&); |
| 186 | void (PopupOpeningObserver&); |
| 187 | |
| 188 | private: |
| 189 | void () const; |
| 190 | |
| 191 | Page& m_page; |
| 192 | ChromeClient& m_client; |
| 193 | PlatformDisplayID m_displayID { 0 }; |
| 194 | Vector<PopupOpeningObserver*> ; |
| 195 | #if PLATFORM(IOS_FAMILY) |
| 196 | bool m_isDispatchViewportDataDidChangeSuppressed { false }; |
| 197 | #endif |
| 198 | }; |
| 199 | |
| 200 | } // namespace WebCore |
| 201 | |