Home | History | Annotate | Download | only in loader
      1 /*
      2  * Copyright (C) 2006 Eric Seidel <eric (at) 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
     25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     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"
     34 #include "core/frame/Frame.h"
     35 #include "platform/ColorChooser.h"
     36 #include "platform/DateTimeChooser.h"
     37 #include "platform/FileChooser.h"
     38 #include "public/platform/WebServiceWorkerProvider.h"
     39 #include "public/platform/WebServiceWorkerProviderClient.h"
     40 
     41 namespace WebCore {
     42 
     43 void fillWithEmptyClients(Page::PageClients& pageClients)
     44 {
     45     static ChromeClient* dummyChromeClient = adoptPtr(new EmptyChromeClient).leakPtr();
     46     pageClients.chromeClient = dummyChromeClient;
     47 
     48     static ContextMenuClient* dummyContextMenuClient = adoptPtr(new EmptyContextMenuClient).leakPtr();
     49     pageClients.contextMenuClient = dummyContextMenuClient;
     50 
     51     static DragClient* dummyDragClient = adoptPtr(new EmptyDragClient).leakPtr();
     52     pageClients.dragClient = dummyDragClient;
     53 
     54     static EditorClient* dummyEditorClient = adoptPtr(new EmptyEditorClient).leakPtr();
     55     pageClients.editorClient = dummyEditorClient;
     56 
     57     static InspectorClient* dummyInspectorClient = adoptPtr(new EmptyInspectorClient).leakPtr();
     58     pageClients.inspectorClient = dummyInspectorClient;
     59 
     60     static BackForwardClient* dummyBackForwardClient = adoptPtr(new EmptyBackForwardClient).leakPtr();
     61     pageClients.backForwardClient = dummyBackForwardClient;
     62 
     63     static SpellCheckerClient* dummySpellCheckerClient = adoptPtr(new EmptySpellCheckerClient).leakPtr();
     64     pageClients.spellCheckerClient = dummySpellCheckerClient;
     65 }
     66 
     67 class EmptyPopupMenu : public PopupMenu {
     68 public:
     69     virtual void show(const FloatQuad&, const IntSize&, int) OVERRIDE { }
     70     virtual void hide() OVERRIDE { }
     71     virtual void updateFromElement() OVERRIDE { }
     72     virtual void disconnectClient() OVERRIDE { }
     73 };
     74 
     75 PassRefPtr<PopupMenu> EmptyChromeClient::createPopupMenu(Frame&, PopupMenuClient*) const
     76 {
     77     return adoptRef(new EmptyPopupMenu());
     78 }
     79 
     80 PassOwnPtr<ColorChooser> EmptyChromeClient::createColorChooser(ColorChooserClient*, const Color&)
     81 {
     82     return nullptr;
     83 }
     84 
     85 PassRefPtr<DateTimeChooser> EmptyChromeClient::openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&)
     86 {
     87     return PassRefPtr<DateTimeChooser>();
     88 }
     89 
     90 void EmptyChromeClient::openTextDataListChooser(HTMLInputElement&)
     91 {
     92 }
     93 
     94 void EmptyChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
     95 {
     96 }
     97 
     98 String EmptyChromeClient::acceptLanguages()
     99 {
    100     return String();
    101 }
    102 
    103 NavigationPolicy EmptyFrameLoaderClient::decidePolicyForNavigation(const ResourceRequest&, DocumentLoader*, NavigationPolicy)
    104 {
    105     return NavigationPolicyIgnore;
    106 }
    107 
    108 void EmptyFrameLoaderClient::dispatchWillSendSubmitEvent(PassRefPtr<FormState>)
    109 {
    110 }
    111 
    112 void EmptyFrameLoaderClient::dispatchWillSubmitForm(PassRefPtr<FormState>)
    113 {
    114 }
    115 
    116 PassRefPtr<DocumentLoader> EmptyFrameLoaderClient::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
    117 {
    118     return DocumentLoader::create(request, substituteData);
    119 }
    120 
    121 PassRefPtr<Frame> EmptyFrameLoaderClient::createFrame(const KURL&, const String&, const String&, HTMLFrameOwnerElement*)
    122 {
    123     return 0;
    124 }
    125 
    126 PassRefPtr<Widget> EmptyFrameLoaderClient::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool)
    127 {
    128     return 0;
    129 }
    130 
    131 PassRefPtr<Widget> EmptyFrameLoaderClient::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&)
    132 {
    133     return 0;
    134 }
    135 
    136 void EmptyTextCheckerClient::requestCheckingOfString(PassRefPtr<TextCheckingRequest>)
    137 {
    138 }
    139 
    140 void EmptyFrameLoaderClient::didRequestAutocomplete(PassRefPtr<FormState>)
    141 {
    142 }
    143 
    144 PassOwnPtr<blink::WebServiceWorkerProvider> EmptyFrameLoaderClient::createServiceWorkerProvider(PassOwnPtr<blink::WebServiceWorkerProviderClient>)
    145 {
    146     return nullptr;
    147 }
    148 
    149 }
    150