Home | History | Annotate | Download | only in loader
      1 /*
      2  * Copyright (C) 2006 Eric Seidel (eric (at) webkit.org)
      3  * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
      4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
      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 COMPUTER, 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 COMPUTER, 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 #ifndef EmptyClients_h
     29 #define EmptyClients_h
     30 
     31 #include "ChromeClient.h"
     32 #include "Console.h"
     33 #include "ContextMenuClient.h"
     34 #include "DeviceMotionClient.h"
     35 #include "DeviceOrientationClient.h"
     36 #include "DocumentLoader.h"
     37 #include "DragClient.h"
     38 #include "EditCommand.h"
     39 #include "EditorClient.h"
     40 #include "TextCheckerClient.h"
     41 #include "FloatRect.h"
     42 #include "FocusDirection.h"
     43 #include "FrameLoaderClient.h"
     44 #include "FrameNetworkingContext.h"
     45 #include "InspectorClient.h"
     46 #include "PluginHalterClient.h"
     47 #include "PopupMenu.h"
     48 #include "ResourceError.h"
     49 #include "SearchPopupMenu.h"
     50 
     51 /*
     52  This file holds empty Client stubs for use by WebCore.
     53  Viewless element needs to create a dummy Page->Frame->FrameView tree for use in parsing or executing JavaScript.
     54  This tree depends heavily on Clients (usually provided by WebKit classes).
     55 
     56  This file was first created for SVGImage as it had no way to access the current Page (nor should it,
     57  since Images are not tied to a page).
     58  See http://bugs.webkit.org/show_bug.cgi?id=5971 for the original discussion about this file.
     59 
     60  Ideally, whenever you change a Client class, you should add a stub here.
     61  Brittle, yes.  Unfortunate, yes.  Hopefully temporary.
     62 */
     63 
     64 namespace WebCore {
     65 
     66 class SharedGraphicsContext3D;
     67 
     68 class EmptyPopupMenu : public PopupMenu {
     69 public:
     70     virtual void show(const IntRect&, FrameView*, int) {}
     71     virtual void hide() {}
     72     virtual void updateFromElement() {}
     73     virtual void disconnectClient() {}
     74 };
     75 
     76 class EmptySearchPopupMenu : public SearchPopupMenu {
     77 public:
     78     virtual PopupMenu* popupMenu() { return m_popup.get(); }
     79     virtual void saveRecentSearches(const AtomicString&, const Vector<String>&) {}
     80     virtual void loadRecentSearches(const AtomicString&, Vector<String>&) {}
     81     virtual bool enabled() { return false; }
     82 
     83 private:
     84     RefPtr<EmptyPopupMenu> m_popup;
     85 };
     86 
     87 class EmptyChromeClient : public ChromeClient {
     88 public:
     89     virtual ~EmptyChromeClient() { }
     90     virtual void chromeDestroyed() { }
     91 
     92     virtual void* webView() const { return 0; }
     93     virtual void setWindowRect(const FloatRect&) { }
     94     virtual FloatRect windowRect() { return FloatRect(); }
     95 
     96     virtual FloatRect pageRect() { return FloatRect(); }
     97 
     98     virtual float scaleFactor() { return 1.f; }
     99 
    100     virtual void focus() { }
    101     virtual void unfocus() { }
    102 
    103     virtual bool canTakeFocus(FocusDirection) { return false; }
    104     virtual void takeFocus(FocusDirection) { }
    105 
    106     virtual void focusedNodeChanged(Node*) { }
    107     virtual void focusedFrameChanged(Frame*) { }
    108 
    109     virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) { return 0; }
    110     virtual void show() { }
    111 
    112     virtual bool canRunModal() { return false; }
    113     virtual void runModal() { }
    114 
    115     virtual void setToolbarsVisible(bool) { }
    116     virtual bool toolbarsVisible() { return false; }
    117 
    118     virtual void setStatusbarVisible(bool) { }
    119     virtual bool statusbarVisible() { return false; }
    120 
    121     virtual void setScrollbarsVisible(bool) { }
    122     virtual bool scrollbarsVisible() { return false; }
    123 
    124     virtual void setMenubarVisible(bool) { }
    125     virtual bool menubarVisible() { return false; }
    126 
    127     virtual void setResizable(bool) { }
    128 
    129     virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) { }
    130 
    131     virtual bool canRunBeforeUnloadConfirmPanel() { return false; }
    132     virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*) { return true; }
    133 
    134     virtual void closeWindowSoon() { }
    135 
    136     virtual void runJavaScriptAlert(Frame*, const String&) { }
    137     virtual bool runJavaScriptConfirm(Frame*, const String&) { return false; }
    138     virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) { return false; }
    139     virtual bool shouldInterruptJavaScript() { return false; }
    140 
    141     virtual bool selectItemWritingDirectionIsNatural() { return false; }
    142     virtual bool selectItemAlignmentFollowsMenuWritingDirection() { return false; }
    143     virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptyPopupMenu()); }
    144     virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); }
    145 
    146 #if ENABLE(CONTEXT_MENUS)
    147     virtual void showContextMenu() { }
    148 #endif
    149 
    150 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
    151     virtual void registerProtocolHandler(const String&, const String&, const String&, const String&) { }
    152 #endif
    153 
    154     virtual void setStatusbarText(const String&) { }
    155 
    156     virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
    157 
    158     virtual IntRect windowResizerRect() const { return IntRect(); }
    159 
    160     virtual void invalidateWindow(const IntRect&, bool) { }
    161     virtual void invalidateContentsAndWindow(const IntRect&, bool) { }
    162     virtual void invalidateContentsForSlowScroll(const IntRect&, bool) {};
    163     virtual void scroll(const IntSize&, const IntRect&, const IntRect&) { }
    164 #if ENABLE(TILED_BACKING_STORE)
    165     virtual void delegatedScrollRequested(const IntPoint&) { }
    166 #endif
    167 #if ENABLE(REQUEST_ANIMATION_FRAME)
    168     virtual void scheduleAnimation() { }
    169 #endif
    170 
    171     virtual IntPoint screenToWindow(const IntPoint& p) const { return p; }
    172     virtual IntRect windowToScreen(const IntRect& r) const { return r; }
    173     virtual PlatformPageClient platformPageClient() const { return 0; }
    174     virtual void contentsSizeChanged(Frame*, const IntSize&) const { }
    175 
    176     virtual void scrollbarsModeDidChange() const { }
    177     virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned) { }
    178 
    179     virtual void setToolTip(const String&, TextDirection) { }
    180 
    181     virtual void print(Frame*) { }
    182 
    183 #if ENABLE(DATABASE)
    184     virtual void exceededDatabaseQuota(Frame*, const String&) { }
    185 #endif
    186 
    187 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
    188     virtual void reachedMaxAppCacheSize(int64_t) { }
    189     virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*) { }
    190 #endif
    191 
    192 #if ENABLE(NOTIFICATIONS)
    193     virtual NotificationPresenter* notificationPresenter() const { return 0; }
    194 #endif
    195 
    196 #if ENABLE(DIRECTORY_UPLOAD)
    197     virtual void enumerateChosenDirectory(const String&, FileChooser*) { }
    198 #endif
    199 
    200     virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { }
    201     virtual void chooseIconForFiles(const Vector<String>&, FileChooser*) { }
    202 
    203     virtual void formStateDidChange(const Node*) { }
    204 
    205     virtual void formDidFocus(const Node*) { }
    206     virtual void formDidBlur(const Node*) { }
    207 
    208     virtual void setCursor(const Cursor&) { }
    209 
    210     virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
    211 
    212     virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*) {}
    213     virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) {}
    214 
    215 #if USE(ACCELERATED_COMPOSITING)
    216     virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*) {}
    217     virtual void setNeedsOneShotDrawingSynchronization() {}
    218     virtual void scheduleCompositingLayerSync() {}
    219 #endif
    220 
    221 #if PLATFORM(WIN)
    222     virtual void setLastSetCursorToCurrentCursor() { }
    223 #endif
    224 #if ENABLE(TOUCH_EVENTS)
    225     virtual void needTouchEvents(bool) { }
    226 #endif
    227 };
    228 
    229 class EmptyFrameLoaderClient : public FrameLoaderClient {
    230     WTF_MAKE_NONCOPYABLE(EmptyFrameLoaderClient); WTF_MAKE_FAST_ALLOCATED;
    231 public:
    232     EmptyFrameLoaderClient() { }
    233     virtual ~EmptyFrameLoaderClient() {  }
    234     virtual void frameLoaderDestroyed() { }
    235 
    236     virtual bool hasWebView() const { return true; } // mainly for assertions
    237 
    238     virtual void makeRepresentation(DocumentLoader*) { }
    239     virtual void forceLayout() { }
    240     virtual void forceLayoutForNonHTML() { }
    241 
    242     virtual void setCopiesOnScroll() { }
    243 
    244     virtual void detachedFromParent2() { }
    245     virtual void detachedFromParent3() { }
    246 
    247     virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { }
    248 
    249     virtual void assignIdentifierToInitialRequest(unsigned long, DocumentLoader*, const ResourceRequest&) { }
    250     virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long) { return false; }
    251     virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&) { }
    252     virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
    253     virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) { }
    254 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    255     virtual bool canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace&) { return false; }
    256 #endif
    257     virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&) { }
    258     virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int) { }
    259     virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long) { }
    260     virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) { }
    261     virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) { return false; }
    262 
    263     virtual void dispatchDidHandleOnloadEvents() { }
    264     virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() { }
    265     virtual void dispatchDidCancelClientRedirect() { }
    266     virtual void dispatchWillPerformClientRedirect(const KURL&, double, double) { }
    267     virtual void dispatchDidChangeLocationWithinPage() { }
    268     virtual void dispatchDidPushStateWithinPage() { }
    269     virtual void dispatchDidReplaceStateWithinPage() { }
    270     virtual void dispatchDidPopStateWithinPage() { }
    271     virtual void dispatchWillClose() { }
    272     virtual void dispatchDidReceiveIcon() { }
    273     virtual void dispatchDidStartProvisionalLoad() { }
    274     virtual void dispatchDidReceiveTitle(const StringWithDirection&) { }
    275     virtual void dispatchDidChangeIcons() { }
    276     virtual void dispatchDidCommitLoad() { }
    277     virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { }
    278     virtual void dispatchDidFailLoad(const ResourceError&) { }
    279     virtual void dispatchDidFinishDocumentLoad() { }
    280     virtual void dispatchDidFinishLoad() { }
    281     virtual void dispatchDidFirstLayout() { }
    282     virtual void dispatchDidFirstVisuallyNonEmptyLayout() { }
    283 
    284     virtual Frame* dispatchCreatePage(const NavigationAction&) { return 0; }
    285     virtual void dispatchShow() { }
    286 
    287     virtual void dispatchDecidePolicyForResponse(FramePolicyFunction, const ResourceResponse&, const ResourceRequest&) { }
    288     virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&) { }
    289     virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>) { }
    290     virtual void cancelPolicyCheck() { }
    291 
    292     virtual void dispatchUnableToImplementPolicy(const ResourceError&) { }
    293 
    294     virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { }
    295     virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) { }
    296 
    297     virtual void dispatchDidLoadMainResource(DocumentLoader*) { }
    298     virtual void revertToProvisionalState(DocumentLoader*) { }
    299     virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { }
    300 
    301     virtual void willChangeEstimatedProgress() { }
    302     virtual void didChangeEstimatedProgress() { }
    303     virtual void postProgressStartedNotification() { }
    304     virtual void postProgressEstimateChangedNotification() { }
    305     virtual void postProgressFinishedNotification() { }
    306 
    307     virtual void setMainFrameDocumentReady(bool) { }
    308 
    309     virtual void startDownload(const ResourceRequest&) { }
    310 
    311     virtual void willChangeTitle(DocumentLoader*) { }
    312     virtual void didChangeTitle(DocumentLoader*) { }
    313 
    314     virtual void committedLoad(DocumentLoader*, const char*, int) { }
    315     virtual void finishedLoading(DocumentLoader*) { }
    316 
    317     virtual ResourceError cancelledError(const ResourceRequest&) { ResourceError error("", 0, "", ""); error.setIsCancellation(true); return error; }
    318     virtual ResourceError blockedError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
    319     virtual ResourceError cannotShowURLError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
    320     virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) { return ResourceError("", 0, "", ""); }
    321 
    322     virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
    323     virtual ResourceError fileDoesNotExistError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
    324     virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&) { return ResourceError("", 0, "", ""); }
    325 
    326     virtual bool shouldFallBack(const ResourceError&) { return false; }
    327 
    328     virtual bool canHandleRequest(const ResourceRequest&) const { return false; }
    329     virtual bool canShowMIMEType(const String&) const { return false; }
    330     virtual bool canShowMIMETypeAsHTML(const String&) const { return false; }
    331     virtual bool representationExistsForURLScheme(const String&) const { return false; }
    332     virtual String generatedMIMETypeForURLScheme(const String&) const { return ""; }
    333 
    334     virtual void frameLoadCompleted() { }
    335     virtual void restoreViewState() { }
    336     virtual void provisionalLoadStarted() { }
    337     virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const { return false; }
    338     virtual void didFinishLoad() { }
    339     virtual void prepareForDataSourceReplacement() { }
    340 
    341     virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return DocumentLoader::create(request, substituteData); }
    342     virtual void setTitle(const StringWithDirection&, const KURL&) { }
    343 
    344     virtual String userAgent(const KURL&) { return ""; }
    345 
    346     virtual void savePlatformDataToCachedFrame(CachedFrame*) { }
    347     virtual void transitionToCommittedFromCachedFrame(CachedFrame*) { }
    348     virtual void transitionToCommittedForNewPage() { }
    349 
    350     virtual void didSaveToPageCache() { }
    351     virtual void didRestoreFromPageCache() { }
    352 
    353     virtual void dispatchDidBecomeFrameset(bool) { }
    354 
    355     virtual void updateGlobalHistory() { }
    356     virtual void updateGlobalHistoryRedirectLinks() { }
    357     virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
    358     virtual bool shouldStopLoadingForHistoryItem(HistoryItem*) const { return false; }
    359     virtual void dispatchDidAddBackForwardItem(HistoryItem*) const { }
    360     virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const { }
    361     virtual void dispatchDidChangeBackForwardIndex() const { }
    362     virtual void updateGlobalHistoryItemForPage() { }
    363     virtual void saveViewStateToItem(HistoryItem*) { }
    364     virtual bool canCachePage() const { return false; }
    365     virtual void didDisplayInsecureContent() { }
    366     virtual void didRunInsecureContent(SecurityOrigin*, const KURL&) { }
    367     virtual PassRefPtr<Frame> createFrame(const KURL&, const String&, HTMLFrameOwnerElement*, const String&, bool, int, int) { return 0; }
    368     virtual void didTransferChildFrameToNewDocument(Page*) { }
    369     virtual void transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*) { }
    370     virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
    371     virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
    372 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
    373     virtual PassRefPtr<Widget> createMediaPlayerProxyPlugin(const IntSize&, HTMLMediaElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&) { return 0; }
    374     virtual void hideMediaPlayerProxyPlugin(Widget*) { }
    375     virtual void showMediaPlayerProxyPlugin(Widget*) { }
    376 #endif
    377 
    378     virtual ObjectContentType objectContentType(const KURL&, const String&, bool) { return ObjectContentType(); }
    379     virtual String overrideMediaType() const { return String(); }
    380 
    381     virtual void redirectDataToPlugin(Widget*) { }
    382     virtual void dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*) { }
    383     virtual void documentElementAvailable() { }
    384     virtual void didPerformFirstNavigation() const { }
    385 
    386 #if USE(V8)
    387     virtual void didCreateScriptContextForFrame() { }
    388     virtual void didDestroyScriptContextForFrame() { }
    389     virtual void didCreateIsolatedScriptContext() { }
    390     virtual bool allowScriptExtension(const String& extensionName, int extensionGroup) { return false; }
    391 #endif
    392 
    393     virtual void registerForIconNotification(bool) { }
    394 
    395 #ifdef ANDROID_APPLE_TOUCH_ICON
    396     virtual void dispatchDidReceiveTouchIconURL(const String& url, bool precomposed) { }
    397 #endif
    398 
    399 #if PLATFORM(MAC)
    400     virtual RemoteAXObjectRef accessibilityRemoteObject() { return 0; }
    401     virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse* response) const { return response; }
    402 #endif
    403 #if USE(CFNETWORK)
    404     virtual bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) { return true; }
    405 #endif
    406 
    407     virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() { return PassRefPtr<FrameNetworkingContext>(); }
    408 };
    409 
    410 class EmptyTextCheckerClient : public TextCheckerClient {
    411 public:
    412     virtual void ignoreWordInSpellDocument(const String&) { }
    413     virtual void learnWord(const String&) { }
    414     virtual void checkSpellingOfString(const UChar*, int, int*, int*) { }
    415     virtual String getAutoCorrectSuggestionForMisspelledWord(const String&) { return String(); }
    416     virtual void checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) { }
    417 
    418 #if USE(UNIFIED_TEXT_CHECKING)
    419     virtual void checkTextOfParagraph(const UChar*, int, TextCheckingTypeMask, Vector<TextCheckingResult>&) { };
    420 #endif
    421 
    422     virtual void getGuessesForWord(const String&, const String&, Vector<String>&) { }
    423     virtual void requestCheckingOfString(SpellChecker*, int, TextCheckingTypeMask, const String&) { }
    424 };
    425 
    426 class EmptyEditorClient : public EditorClient {
    427     WTF_MAKE_NONCOPYABLE(EmptyEditorClient); WTF_MAKE_FAST_ALLOCATED;
    428 public:
    429     EmptyEditorClient() { }
    430     virtual ~EmptyEditorClient() { }
    431     virtual void pageDestroyed() { }
    432 
    433     virtual bool shouldDeleteRange(Range*) { return false; }
    434     virtual bool shouldShowDeleteInterface(HTMLElement*) { return false; }
    435     virtual bool smartInsertDeleteEnabled() { return false; }
    436     virtual bool isSelectTrailingWhitespaceEnabled() { return false; }
    437     virtual bool isContinuousSpellCheckingEnabled() { return false; }
    438     virtual void toggleContinuousSpellChecking() { }
    439     virtual bool isGrammarCheckingEnabled() { return false; }
    440     virtual void toggleGrammarChecking() { }
    441     virtual int spellCheckerDocumentTag() { return -1; }
    442 
    443     virtual bool selectWordBeforeMenuEvent() { return false; }
    444     virtual bool isEditable() { return false; }
    445 
    446     virtual bool shouldBeginEditing(Range*) { return false; }
    447     virtual bool shouldEndEditing(Range*) { return false; }
    448     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) { return false; }
    449     //  virtual bool shouldInsertNode(Node*, Range* replacingRange, WebViewInsertAction) { return false; }
    450     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) { return false; }
    451     virtual bool shouldChangeSelectedRange(Range*, Range*, EAffinity, bool) { return false; }
    452 
    453     virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) { return false; }
    454     virtual bool shouldMoveRangeAfterDelete(Range*, Range*) { return false; }
    455     //  virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) { return false; }
    456     //  virtual bool doCommandBySelector(SEL selector) { return false; }
    457     //
    458     virtual void didBeginEditing() { }
    459     virtual void respondToChangedContents() { }
    460     virtual void respondToChangedSelection() { }
    461     virtual void didEndEditing() { }
    462     virtual void didWriteSelectionToPasteboard() { }
    463     virtual void didSetSelectionTypesForPasteboard() { }
    464     //  virtual void webViewDidChangeTypingStyle:(NSNotification *)notification { }
    465     //  virtual void webViewDidChangeSelection:(NSNotification *)notification { }
    466     //  virtual NSUndoManager* undoManagerForWebView:(WebView *)webView { return 0; }
    467 
    468     virtual void registerCommandForUndo(PassRefPtr<EditCommand>) { }
    469     virtual void registerCommandForRedo(PassRefPtr<EditCommand>) { }
    470     virtual void clearUndoRedoOperations() { }
    471 
    472     virtual bool canCopyCut(bool defaultValue) const { return defaultValue; }
    473     virtual bool canPaste(bool defaultValue) const { return defaultValue; }
    474     virtual bool canUndo() const { return false; }
    475     virtual bool canRedo() const { return false; }
    476 
    477     virtual void undo() { }
    478     virtual void redo() { }
    479 
    480     virtual void handleKeyboardEvent(KeyboardEvent*) { }
    481     virtual void handleInputMethodKeydown(KeyboardEvent*) { }
    482 
    483     virtual void textFieldDidBeginEditing(Element*) { }
    484     virtual void textFieldDidEndEditing(Element*) { }
    485     virtual void textDidChangeInTextField(Element*) { }
    486     virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) { return false; }
    487     virtual void textWillBeDeletedInTextField(Element*) { }
    488     virtual void textDidChangeInTextArea(Element*) { }
    489 
    490 #if PLATFORM(MAC)
    491     virtual void markedTextAbandoned(Frame*) { }
    492 
    493     virtual NSString* userVisibleString(NSURL*) { return 0; }
    494     virtual DocumentFragment* documentFragmentFromAttributedString(NSAttributedString*, Vector<RefPtr<ArchiveResource> >&) { return 0; };
    495     virtual void setInsertionPasteboard(NSPasteboard*) { };
    496     virtual NSURL* canonicalizeURL(NSURL*) { return 0; }
    497     virtual NSURL* canonicalizeURLString(NSString*) { return 0; }
    498 #ifdef BUILDING_ON_TIGER
    499     virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
    500 #endif
    501 #endif
    502 #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
    503     virtual void uppercaseWord() { }
    504     virtual void lowercaseWord() { }
    505     virtual void capitalizeWord() { }
    506     virtual void showSubstitutionsPanel(bool) { }
    507     virtual bool substitutionsPanelIsShowing() { return false; }
    508     virtual void toggleSmartInsertDelete() { }
    509     virtual bool isAutomaticQuoteSubstitutionEnabled() { return false; }
    510     virtual void toggleAutomaticQuoteSubstitution() { }
    511     virtual bool isAutomaticLinkDetectionEnabled() { return false; }
    512     virtual void toggleAutomaticLinkDetection() { }
    513     virtual bool isAutomaticDashSubstitutionEnabled() { return false; }
    514     virtual void toggleAutomaticDashSubstitution() { }
    515     virtual bool isAutomaticTextReplacementEnabled() { return false; }
    516     virtual void toggleAutomaticTextReplacement() { }
    517     virtual bool isAutomaticSpellingCorrectionEnabled() { return false; }
    518     virtual void toggleAutomaticSpellingCorrection() { }
    519 #endif
    520     TextCheckerClient* textChecker() { return &m_textCheckerClient; }
    521 
    522 #if SUPPORT_AUTOCORRECTION_PANEL
    523     virtual void showCorrectionPanel(CorrectionPanelInfo::PanelType, const FloatRect&, const String&, const String&, const Vector<String>&) { }
    524     virtual void dismissCorrectionPanel(ReasonForDismissingCorrectionPanel) { }
    525     virtual String dismissCorrectionPanelSoon(ReasonForDismissingCorrectionPanel) { return String(); }
    526     virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String&, const String&) { }
    527 #endif
    528     virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
    529     virtual void updateSpellingUIWithMisspelledWord(const String&) { }
    530     virtual void showSpellingUI(bool) { }
    531     virtual bool spellingUIIsShowing() { return false; }
    532 
    533     virtual void willSetInputMethodState() { }
    534     virtual void setInputMethodState(bool) { }
    535 
    536 private:
    537     EmptyTextCheckerClient m_textCheckerClient;
    538 };
    539 
    540 #if ENABLE(CONTEXT_MENUS)
    541 class EmptyContextMenuClient : public ContextMenuClient {
    542     WTF_MAKE_NONCOPYABLE(EmptyContextMenuClient); WTF_MAKE_FAST_ALLOCATED;
    543 public:
    544     EmptyContextMenuClient() { }
    545     virtual ~EmptyContextMenuClient() {  }
    546     virtual void contextMenuDestroyed() { }
    547 
    548 #if USE(CROSS_PLATFORM_CONTEXT_MENUS)
    549     virtual PassOwnPtr<ContextMenu> customizeMenu(PassOwnPtr<ContextMenu>) { return 0; }
    550 #else
    551     virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*) { return 0; }
    552 #endif
    553     virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) { }
    554 
    555     virtual void downloadURL(const KURL&) { }
    556     virtual void copyImageToClipboard(const HitTestResult&) { }
    557     virtual void searchWithGoogle(const Frame*) { }
    558     virtual void lookUpInDictionary(Frame*) { }
    559     virtual bool isSpeaking() { return false; }
    560     virtual void speak(const String&) { }
    561     virtual void stopSpeaking() { }
    562 
    563 #if PLATFORM(MAC)
    564     virtual void searchWithSpotlight() { }
    565 #endif
    566 };
    567 #endif // ENABLE(CONTEXT_MENUS)
    568 
    569 #if ENABLE(DRAG_SUPPORT)
    570 class EmptyDragClient : public DragClient {
    571     WTF_MAKE_NONCOPYABLE(EmptyDragClient); WTF_MAKE_FAST_ALLOCATED;
    572 public:
    573     EmptyDragClient() { }
    574     virtual ~EmptyDragClient() {}
    575     virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { }
    576     virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) { }
    577     virtual DragDestinationAction actionMaskForDrag(DragData*) { return DragDestinationActionNone; }
    578     virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) { return DragSourceActionNone; }
    579     virtual void startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) { }
    580     virtual void dragControllerDestroyed() { }
    581 };
    582 #endif // ENABLE(DRAG_SUPPORT)
    583 
    584 class EmptyInspectorClient : public InspectorClient {
    585     WTF_MAKE_NONCOPYABLE(EmptyInspectorClient); WTF_MAKE_FAST_ALLOCATED;
    586 public:
    587     EmptyInspectorClient() { }
    588     virtual ~EmptyInspectorClient() { }
    589 
    590     virtual void inspectorDestroyed() { }
    591 
    592     virtual void openInspectorFrontend(InspectorController*) { }
    593 
    594     virtual void highlight(Node*) { }
    595     virtual void hideHighlight() { }
    596 
    597     virtual bool sendMessageToFrontend(const String&) { return false; }
    598 };
    599 
    600 class EmptyDeviceMotionClient : public DeviceMotionClient {
    601 public:
    602     virtual void setController(DeviceMotionController*) { }
    603     virtual void startUpdating() { }
    604     virtual void stopUpdating() { }
    605     virtual DeviceMotionData* currentDeviceMotion() const { return 0; }
    606     virtual void deviceMotionControllerDestroyed() { }
    607 };
    608 
    609 class EmptyDeviceOrientationClient : public DeviceOrientationClient {
    610 public:
    611     virtual void setController(DeviceOrientationController*) { }
    612     virtual void startUpdating() { }
    613     virtual void stopUpdating() { }
    614     virtual DeviceOrientation* lastOrientation() const { return 0; }
    615     virtual void deviceOrientationControllerDestroyed() { }
    616 };
    617 
    618 }
    619 
    620 #endif // EmptyClients_h
    621