| 1 | /* |
| 2 | * Copyright (C) 2006 Eric Seidel (eric@webkit.org) |
| 3 | * Copyright (C) 2008-2017 Apple Inc. All rights reserved. |
| 4 | * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 5 | * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 20 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 24 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #pragma once |
| 30 | |
| 31 | #include "ChromeClient.h" |
| 32 | #include <wtf/UniqueRef.h> |
| 33 | |
| 34 | // Empty client classes for use by WebCore. |
| 35 | // |
| 36 | // First created for SVGImage as it had no way to access the current Page (nor should it, since Images are not tied to a page). |
| 37 | // See http://bugs.webkit.org/show_bug.cgi?id=5971 for the original discussion about this file. |
| 38 | |
| 39 | namespace WebCore { |
| 40 | |
| 41 | class DiagnosticLoggingClient; |
| 42 | class EditorClient; |
| 43 | class PageConfiguration; |
| 44 | |
| 45 | class EmptyChromeClient : public ChromeClient { |
| 46 | WTF_MAKE_FAST_ALLOCATED; |
| 47 | |
| 48 | void chromeDestroyed() override { } |
| 49 | |
| 50 | void setWindowRect(const FloatRect&) final { } |
| 51 | FloatRect windowRect() final { return FloatRect(); } |
| 52 | |
| 53 | FloatRect () final { return FloatRect(); } |
| 54 | |
| 55 | void focus() final { } |
| 56 | void unfocus() final { } |
| 57 | |
| 58 | bool canTakeFocus(FocusDirection) final { return false; } |
| 59 | void takeFocus(FocusDirection) final { } |
| 60 | |
| 61 | void focusedElementChanged(Element*) final { } |
| 62 | void focusedFrameChanged(Frame*) final { } |
| 63 | |
| 64 | Page* createWindow(Frame&, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) final { return nullptr; } |
| 65 | void show() final { } |
| 66 | |
| 67 | bool canRunModal() final { return false; } |
| 68 | void runModal() final { } |
| 69 | |
| 70 | void setToolbarsVisible(bool) final { } |
| 71 | bool toolbarsVisible() final { return false; } |
| 72 | |
| 73 | void setStatusbarVisible(bool) final { } |
| 74 | bool statusbarVisible() final { return false; } |
| 75 | |
| 76 | void setScrollbarsVisible(bool) final { } |
| 77 | bool scrollbarsVisible() final { return false; } |
| 78 | |
| 79 | void (bool) final { } |
| 80 | bool () final { return false; } |
| 81 | |
| 82 | void setResizable(bool) final { } |
| 83 | |
| 84 | void addMessageToConsole(MessageSource, MessageLevel, const String&, unsigned, unsigned, const String&) final { } |
| 85 | |
| 86 | bool canRunBeforeUnloadConfirmPanel() final { return false; } |
| 87 | bool runBeforeUnloadConfirmPanel(const String&, Frame&) final { return true; } |
| 88 | |
| 89 | void closeWindowSoon() final { } |
| 90 | |
| 91 | void runJavaScriptAlert(Frame&, const String&) final { } |
| 92 | bool runJavaScriptConfirm(Frame&, const String&) final { return false; } |
| 93 | bool runJavaScriptPrompt(Frame&, const String&, const String&, String&) final { return false; } |
| 94 | |
| 95 | bool selectItemWritingDirectionIsNatural() final { return false; } |
| 96 | bool () final { return false; } |
| 97 | RefPtr<PopupMenu> (PopupMenuClient&) const final; |
| 98 | RefPtr<SearchPopupMenu> (PopupMenuClient&) const final; |
| 99 | |
| 100 | void setStatusbarText(const String&) final { } |
| 101 | |
| 102 | KeyboardUIMode keyboardUIMode() final { return KeyboardAccessDefault; } |
| 103 | |
| 104 | void invalidateRootView(const IntRect&) final { } |
| 105 | void invalidateContentsAndRootView(const IntRect&) override { } |
| 106 | void invalidateContentsForSlowScroll(const IntRect&) final { } |
| 107 | void scroll(const IntSize&, const IntRect&, const IntRect&) final { } |
| 108 | |
| 109 | IntPoint screenToRootView(const IntPoint& p) const final { return p; } |
| 110 | IntRect rootViewToScreen(const IntRect& r) const final { return r; } |
| 111 | IntPoint accessibilityScreenToRootView(const IntPoint& p) const final { return p; }; |
| 112 | IntRect rootViewToAccessibilityScreen(const IntRect& r) const final { return r; }; |
| 113 | |
| 114 | PlatformPageClient platformPageClient() const final { return 0; } |
| 115 | void contentsSizeChanged(Frame&, const IntSize&) const final { } |
| 116 | void intrinsicContentsSizeChanged(const IntSize&) const final { } |
| 117 | |
| 118 | void mouseDidMoveOverElement(const HitTestResult&, unsigned) final { } |
| 119 | |
| 120 | void setToolTip(const String&, TextDirection) final { } |
| 121 | |
| 122 | void print(Frame&) final { } |
| 123 | |
| 124 | void exceededDatabaseQuota(Frame&, const String&, DatabaseDetails) final { } |
| 125 | |
| 126 | void reachedMaxAppCacheSize(int64_t) final { } |
| 127 | void reachedApplicationCacheOriginQuota(SecurityOrigin&, int64_t) final { } |
| 128 | |
| 129 | #if ENABLE(INPUT_TYPE_COLOR) |
| 130 | std::unique_ptr<ColorChooser> createColorChooser(ColorChooserClient&, const Color&) final; |
| 131 | #endif |
| 132 | |
| 133 | #if ENABLE(DATALIST_ELEMENT) |
| 134 | std::unique_ptr<DataListSuggestionPicker> createDataListSuggestionPicker(DataListSuggestionsClient&) final; |
| 135 | #endif |
| 136 | |
| 137 | void runOpenPanel(Frame&, FileChooser&) final; |
| 138 | void showShareSheet(ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) final; |
| 139 | void loadIconForFiles(const Vector<String>&, FileIconLoader&) final { } |
| 140 | |
| 141 | void elementDidFocus(Element&) final { } |
| 142 | void elementDidBlur(Element&) final { } |
| 143 | |
| 144 | #if !PLATFORM(IOS_FAMILY) |
| 145 | void setCursor(const Cursor&) final { } |
| 146 | void setCursorHiddenUntilMouseMoves(bool) final { } |
| 147 | #endif |
| 148 | |
| 149 | void scrollRectIntoView(const IntRect&) const final { } |
| 150 | |
| 151 | void attachRootGraphicsLayer(Frame&, GraphicsLayer*) final { } |
| 152 | void attachViewOverlayGraphicsLayer(GraphicsLayer*) final { } |
| 153 | void setNeedsOneShotDrawingSynchronization() final { } |
| 154 | void scheduleCompositingLayerFlush() final { } |
| 155 | |
| 156 | #if PLATFORM(WIN) |
| 157 | void setLastSetCursorToCurrentCursor() final { } |
| 158 | void AXStartFrameLoad() final { } |
| 159 | void AXFinishFrameLoad() final { } |
| 160 | #endif |
| 161 | |
| 162 | #if ENABLE(IOS_TOUCH_EVENTS) |
| 163 | void didPreventDefaultForEvent() final { } |
| 164 | #endif |
| 165 | |
| 166 | #if PLATFORM(IOS_FAMILY) |
| 167 | void didReceiveMobileDocType(bool) final { } |
| 168 | void setNeedsScrollNotifications(Frame&, bool) final { } |
| 169 | void observedContentChange(Frame&) final { } |
| 170 | void notifyRevealedSelectionByScrollingFrame(Frame&) final { } |
| 171 | void didLayout(LayoutType) final { } |
| 172 | void didStartOverflowScroll() final { } |
| 173 | void didEndOverflowScroll() final { } |
| 174 | |
| 175 | void suppressFormNotifications() final { } |
| 176 | void restoreFormNotifications() final { } |
| 177 | |
| 178 | void addOrUpdateScrollingLayer(Node*, PlatformLayer*, PlatformLayer*, const IntSize&, bool, bool) final { } |
| 179 | void removeScrollingLayer(Node*, PlatformLayer*, PlatformLayer*) final { } |
| 180 | |
| 181 | void webAppOrientationsUpdated() final { }; |
| 182 | void showPlaybackTargetPicker(bool, RouteSharingPolicy, const String&) final { }; |
| 183 | #endif // PLATFORM(IOS_FAMILY) |
| 184 | |
| 185 | #if ENABLE(ORIENTATION_EVENTS) |
| 186 | int deviceOrientation() const final { return 0; } |
| 187 | #endif |
| 188 | |
| 189 | #if PLATFORM(IOS_FAMILY) |
| 190 | bool isStopping() final { return false; } |
| 191 | #endif |
| 192 | |
| 193 | void wheelEventHandlersChanged(bool) final { } |
| 194 | |
| 195 | bool isEmptyChromeClient() const final { return true; } |
| 196 | |
| 197 | void didAssociateFormControls(const Vector<RefPtr<Element>>&, Frame&) final { } |
| 198 | bool shouldNotifyOnFormChanges() final { return false; } |
| 199 | |
| 200 | RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) final { return nullptr; } |
| 201 | }; |
| 202 | |
| 203 | DiagnosticLoggingClient& emptyDiagnosticLoggingClient(); |
| 204 | WEBCORE_EXPORT PageConfiguration pageConfigurationWithEmptyClients(); |
| 205 | |
| 206 | } |
| 207 | |