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