Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
| 3 | * Copyright (C) 2008, 2009, 2012 Apple Inc. All rights reserved. |
| 4 | * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 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 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 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 |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 25 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #include "config.h" |
| 29 | #include "core/loader/EmptyClients.h" |
| 30 | |
| 31 | #include "core/html/HTMLFormElement.h" |
| 32 | #include "core/loader/DocumentLoader.h" |
| 33 | #include "core/loader/FormState.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 34 | #include "core/page/Frame.h" |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 35 | #include "core/platform/ColorChooser.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 36 | #include "core/platform/DateTimeChooser.h" |
| 37 | #include "core/platform/FileChooser.h" |
| 38 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 39 | namespace WebCore { |
| 40 | |
| 41 | void fillWithEmptyClients(Page::PageClients& pageClients) |
| 42 | { |
| 43 | static ChromeClient* dummyChromeClient = adoptPtr(new EmptyChromeClient).leakPtr(); |
| 44 | pageClients.chromeClient = dummyChromeClient; |
| 45 | |
| 46 | static ContextMenuClient* dummyContextMenuClient = adoptPtr(new EmptyContextMenuClient).leakPtr(); |
| 47 | pageClients.contextMenuClient = dummyContextMenuClient; |
| 48 | |
| 49 | static DragClient* dummyDragClient = adoptPtr(new EmptyDragClient).leakPtr(); |
| 50 | pageClients.dragClient = dummyDragClient; |
| 51 | |
| 52 | static EditorClient* dummyEditorClient = adoptPtr(new EmptyEditorClient).leakPtr(); |
| 53 | pageClients.editorClient = dummyEditorClient; |
| 54 | |
| 55 | static InspectorClient* dummyInspectorClient = adoptPtr(new EmptyInspectorClient).leakPtr(); |
| 56 | pageClients.inspectorClient = dummyInspectorClient; |
| 57 | |
| 58 | static BackForwardClient* dummyBackForwardClient = adoptPtr(new EmptyBackForwardClient).leakPtr(); |
| 59 | pageClients.backForwardClient = dummyBackForwardClient; |
| 60 | } |
| 61 | |
| 62 | class EmptyPopupMenu : public PopupMenu { |
| 63 | public: |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 64 | virtual void show(const FloatQuad&, const IntSize&, int) OVERRIDE { } |
| 65 | virtual void hide() OVERRIDE { } |
| 66 | virtual void updateFromElement() OVERRIDE { } |
| 67 | virtual void disconnectClient() OVERRIDE { } |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 68 | }; |
| 69 | |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 70 | PassRefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(Frame&, PopupMenuClient*) const |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 71 | { |
| 72 | return adoptRef(new EmptyPopupMenu()); |
| 73 | } |
| 74 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 75 | PassOwnPtr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient*, const Color&) |
| 76 | { |
| 77 | return nullptr; |
| 78 | } |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 79 | |
| 80 | PassRefPtr<DateTimeChooser> EmptyChromeClient::openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&) |
| 81 | { |
| 82 | return PassRefPtr<DateTimeChooser>(); |
| 83 | } |
| 84 | |
| 85 | void EmptyChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser>) |
| 86 | { |
| 87 | } |
| 88 | |
Torne (Richard Coles) | 521d96e | 2013-06-19 11:58:24 +0100 | [diff] [blame] | 89 | String EmptyChromeClient::acceptLanguages() |
| 90 | { |
| 91 | return String(); |
| 92 | } |
| 93 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 94 | NavigationPolicy EmptyFrameLoaderClient::decidePolicyForNavigation(const ResourceRequest&, NavigationType, NavigationPolicy, bool) |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 95 | { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 96 | return NavigationPolicyIgnore; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(PassRefPtr<FormState>) |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | void EmptyFrameLoaderClient::dispatchWillSubmitForm(PassRefPtr<FormState>) |
| 104 | { |
| 105 | } |
| 106 | |
| 107 | PassRefPtr<DocumentLoader> EmptyFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) |
| 108 | { |
| 109 | return DocumentLoader::create(request, substituteData); |
| 110 | } |
| 111 | |
| 112 | PassRefPtr<Frame> EmptyFrameLoaderClient::createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) |
| 113 | { |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | PassRefPtr<Widget> EmptyFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) |
| 118 | { |
| 119 | return 0; |
| 120 | } |
| 121 | |
| 122 | PassRefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) |
| 123 | { |
| 124 | return 0; |
| 125 | } |
| 126 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 127 | void EmptyTextCheckerClient::requestCheckingOfString(PassRefPtr<TextCheckingRequest>) |
| 128 | { |
| 129 | } |
| 130 | |
| 131 | void EmptyEditorClient::registerUndoStep(PassRefPtr<UndoStep>) |
| 132 | { |
| 133 | } |
| 134 | |
| 135 | void EmptyEditorClient::registerRedoStep(PassRefPtr<UndoStep>) |
| 136 | { |
| 137 | } |
| 138 | |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 139 | void EmptyFrameLoaderClient::didRequestAutocomplete(PassRefPtr<FormState>) |
| 140 | { |
| 141 | } |
| 142 | |
| 143 | } |