WebFrameLoaderClient.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  14. * its contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  18. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  21. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #ifndef WebFrameLoaderClient_h
  29. #define WebFrameLoaderClient_h
  30. #include <WebCore/FrameLoaderClient.h>
  31. namespace WebCore {
  32. class PluginManualLoader;
  33. class PluginView;
  34. }
  35. template <typename T> class COMPtr;
  36. class WebFrame;
  37. class WebHistory;
  38. class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
  39. public:
  40. virtual bool hasWebView() const;
  41. virtual void forceLayout();
  42. virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&);
  43. virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
  44. virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier);
  45. virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
  46. virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&);
  47. virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&);
  48. virtual void dispatchDidReceiveContentLength(WebCore::DocumentLoader*, unsigned long identifier, int dataLength);
  49. virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier);
  50. virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceError&);
  51. virtual bool shouldCacheResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&, const unsigned char* data, unsigned long long length);
  52. virtual void dispatchDidHandleOnloadEvents();
  53. virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
  54. virtual void dispatchDidCancelClientRedirect();
  55. virtual void dispatchWillPerformClientRedirect(const WebCore::KURL&, double interval, double fireDate);
  56. virtual void dispatchDidChangeLocationWithinPage();
  57. virtual void dispatchDidPushStateWithinPage();
  58. virtual void dispatchDidReplaceStateWithinPage();
  59. virtual void dispatchDidPopStateWithinPage();
  60. virtual void dispatchWillClose();
  61. virtual void dispatchDidReceiveIcon();
  62. virtual void dispatchDidStartProvisionalLoad();
  63. virtual void dispatchDidReceiveTitle(const WebCore::StringWithDirection&);
  64. virtual void dispatchDidChangeIcons(WebCore::IconType);
  65. virtual void dispatchDidCommitLoad();
  66. virtual void dispatchDidFinishDocumentLoad();
  67. virtual void dispatchDidFinishLoad();
  68. virtual void dispatchDidLayout(WebCore::LayoutMilestones);
  69. virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
  70. virtual void dispatchShow();
  71. virtual void setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&);
  72. virtual void postProgressStartedNotification();
  73. virtual void postProgressEstimateChangedNotification();
  74. virtual void postProgressFinishedNotification();
  75. virtual void committedLoad(WebCore::DocumentLoader*, const char*, int);
  76. virtual void finishedLoading(WebCore::DocumentLoader*);
  77. virtual void updateGlobalHistory();
  78. virtual void updateGlobalHistoryRedirectLinks();
  79. virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
  80. virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const;
  81. virtual void updateGlobalHistoryItemForPage();
  82. virtual void didDisplayInsecureContent();
  83. virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&);
  84. virtual void didDetectXSS(const WebCore::KURL&, bool didBlockEntirePage);
  85. virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
  86. virtual void setTitle(const WebCore::StringWithDirection&, const WebCore::KURL&);
  87. virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
  88. virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
  89. virtual void transitionToCommittedForNewPage();
  90. virtual void didSaveToPageCache();
  91. virtual void didRestoreFromPageCache();
  92. virtual void dispatchDidBecomeFrameset(bool);
  93. virtual bool canCachePage() const;
  94. virtual PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL& url, const WTF::String& name, WebCore::HTMLFrameOwnerElement* ownerElement,
  95. const WTF::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
  96. virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually);
  97. virtual void recreatePlugin(WebCore::Widget*) { }
  98. virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget);
  99. virtual bool shouldAlwaysUsePluginDocument(const WTF::String& mimeType) const;
  100. virtual void dispatchDidFailToStartPlugin(const WebCore::PluginView*) const;
  101. protected:
  102. WebFrameLoaderClient(WebFrame*);
  103. ~WebFrameLoaderClient();
  104. private:
  105. PassRefPtr<WebCore::Frame> createFrame(const WebCore::KURL&, const WTF::String& name, WebCore::HTMLFrameOwnerElement*, const WTF::String& referrer);
  106. WebHistory* webHistory() const;
  107. WebFrame* m_webFrame;
  108. // Points to the manual loader that data should be redirected to.
  109. WebCore::PluginManualLoader* m_manualLoader;
  110. bool m_hasSentResponseToPlugin;
  111. };
  112. #endif // WebFrameLoaderClient_h