Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
| 3 | * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are |
| 7 | * met: |
| 8 | * |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above |
| 12 | * copyright notice, this list of conditions and the following disclaimer |
| 13 | * in the documentation and/or other materials provided with the |
| 14 | * distribution. |
| 15 | * * Neither the name of Google Inc. nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FrameLoaderClientImpl_h |
| 33 | #define FrameLoaderClientImpl_h |
| 34 | |
| 35 | #include "core/loader/FrameLoaderClient.h" |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 36 | #include "platform/weborigin/KURL.h" |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 37 | #include "wtf/PassOwnPtr.h" |
| 38 | #include "wtf/RefPtr.h" |
| 39 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 40 | namespace blink { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 41 | |
| 42 | class WebFrameImpl; |
| 43 | class WebPluginContainerImpl; |
| 44 | class WebPluginLoadObserver; |
| 45 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 46 | class FrameLoaderClientImpl FINAL : public WebCore::FrameLoaderClient { |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 47 | public: |
| 48 | FrameLoaderClientImpl(WebFrameImpl* webFrame); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 49 | virtual ~FrameLoaderClientImpl(); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 50 | |
| 51 | WebFrameImpl* webFrame() const { return m_webFrame; } |
| 52 | |
| 53 | // WebCore::FrameLoaderClient ---------------------------------------------- |
| 54 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 55 | // Notifies the WebView delegate that the JS window object has been cleared, |
| 56 | // giving it a chance to bind native objects to the window before script |
| 57 | // parsing begins. |
Ben Murdoch | f5f02c9 | 2014-04-01 10:55:29 +0100 | [diff] [blame] | 58 | virtual void dispatchDidClearWindowObjectInWorld(WebCore::DOMWrapperWorld&) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 59 | virtual void documentElementAvailable() OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 60 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 61 | virtual void didCreateScriptContext(v8::Handle<v8::Context>, int extensionGroup, int worldId) OVERRIDE; |
| 62 | virtual void willReleaseScriptContext(v8::Handle<v8::Context>, int worldId) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 63 | |
| 64 | // Returns true if we should allow the given V8 extension to be added to |
| 65 | // the script context at the currently loading page and given extension group. |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 66 | virtual bool allowScriptExtension(const String& extensionName, int extensionGroup, int worldId) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 67 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 68 | virtual bool hasWebView() const OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 69 | virtual WebCore::Frame* opener() const OVERRIDE; |
| 70 | virtual void setOpener(WebCore::Frame*) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 71 | virtual WebCore::Frame* parent() const OVERRIDE; |
| 72 | virtual WebCore::Frame* top() const OVERRIDE; |
| 73 | virtual WebCore::Frame* previousSibling() const OVERRIDE; |
| 74 | virtual WebCore::Frame* nextSibling() const OVERRIDE; |
| 75 | virtual WebCore::Frame* firstChild() const OVERRIDE; |
| 76 | virtual WebCore::Frame* lastChild() const OVERRIDE; |
| 77 | virtual void detachedFromParent() OVERRIDE; |
| 78 | virtual void dispatchWillRequestAfterPreconnect(WebCore::ResourceRequest&) OVERRIDE; |
| 79 | virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse) OVERRIDE; |
| 80 | virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&) OVERRIDE; |
Ben Murdoch | 07a852d | 2014-03-31 11:51:52 +0100 | [diff] [blame] | 81 | virtual void dispatchDidChangeResourcePriority(unsigned long identifier, WebCore::ResourceLoadPriority, int intraPriorityValue) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 82 | virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long identifier) OVERRIDE; |
| 83 | virtual void dispatchDidLoadResourceFromMemoryCache(const WebCore::ResourceRequest&, const WebCore::ResourceResponse&) OVERRIDE; |
| 84 | virtual void dispatchDidHandleOnloadEvents() OVERRIDE; |
| 85 | virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() OVERRIDE; |
| 86 | virtual void dispatchDidNavigateWithinPage(WebCore::HistoryItem*, WebCore::HistoryCommitType) OVERRIDE; |
| 87 | virtual void dispatchWillClose() OVERRIDE; |
| 88 | virtual void dispatchDidStartProvisionalLoad() OVERRIDE; |
| 89 | virtual void dispatchDidReceiveTitle(const String&) OVERRIDE; |
| 90 | virtual void dispatchDidChangeIcons(WebCore::IconType) OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 91 | virtual void dispatchDidCommitLoad(WebCore::LocalFrame*, WebCore::HistoryItem*, WebCore::HistoryCommitType) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 92 | virtual void dispatchDidFailProvisionalLoad(const WebCore::ResourceError&) OVERRIDE; |
| 93 | virtual void dispatchDidFailLoad(const WebCore::ResourceError&) OVERRIDE; |
| 94 | virtual void dispatchDidFinishDocumentLoad() OVERRIDE; |
| 95 | virtual void dispatchDidFinishLoad() OVERRIDE; |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 96 | virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 97 | virtual WebCore::NavigationPolicy decidePolicyForNavigation(const WebCore::ResourceRequest&, WebCore::DocumentLoader*, WebCore::NavigationPolicy) OVERRIDE; |
| 98 | virtual void dispatchWillRequestResource(WebCore::FetchRequest*) OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 99 | virtual void dispatchWillSendSubmitEvent(WebCore::HTMLFormElement*) OVERRIDE; |
| 100 | virtual void dispatchWillSubmitForm(WebCore::HTMLFormElement*) OVERRIDE; |
Ben Murdoch | 07a852d | 2014-03-31 11:51:52 +0100 | [diff] [blame] | 101 | virtual void didStartLoading(WebCore::LoadStartType) OVERRIDE; |
| 102 | virtual void didStopLoading() OVERRIDE; |
| 103 | virtual void progressEstimateChanged(double progressEstimate) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 104 | virtual void loadURLExternally(const WebCore::ResourceRequest&, WebCore::NavigationPolicy, const String& suggestedName = String()) OVERRIDE; |
| 105 | virtual bool navigateBackForward(int offset) const OVERRIDE; |
| 106 | virtual void didAccessInitialDocument() OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 107 | virtual void didDisplayInsecureContent() OVERRIDE; |
| 108 | virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL& insecureURL) OVERRIDE; |
| 109 | virtual void didDetectXSS(const WebCore::KURL&, bool didBlockEntirePage) OVERRIDE; |
| 110 | virtual void didDispatchPingLoader(const WebCore::KURL&) OVERRIDE; |
| 111 | virtual void selectorMatchChanged(const Vector<String>& addedSelectors, const Vector<String>& removedSelectors) OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 112 | virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(WebCore::LocalFrame*, const WebCore::ResourceRequest&, const WebCore::SubstituteData&) OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 113 | virtual WTF::String userAgent(const WebCore::KURL&) OVERRIDE; |
| 114 | virtual WTF::String doNotTrackValue() OVERRIDE; |
| 115 | virtual void transitionToCommittedForNewPage() OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 116 | virtual PassRefPtr<WebCore::LocalFrame> createFrame(const WebCore::KURL&, const WTF::AtomicString& name, const WebCore::Referrer&, WebCore::HTMLFrameOwnerElement*) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 117 | virtual PassRefPtr<WebCore::Widget> createPlugin( |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 118 | WebCore::HTMLPlugInElement*, const WebCore::KURL&, |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 119 | const Vector<WTF::String>&, const Vector<WTF::String>&, |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 120 | const WTF::String&, bool loadManually, DetachedPluginPolicy) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 121 | virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 122 | WebCore::HTMLAppletElement*, |
| 123 | const WebCore::KURL& /* base_url */, |
| 124 | const Vector<WTF::String>& paramNames, |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 125 | const Vector<WTF::String>& paramValues) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 126 | virtual WebCore::ObjectContentType objectContentType( |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 127 | const WebCore::KURL&, const WTF::String& mimeType, bool shouldPreferPlugInsForImages) OVERRIDE; |
| 128 | virtual void didChangeScrollOffset() OVERRIDE; |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 129 | virtual void didUpdateCurrentHistoryItem() OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 130 | virtual bool allowScript(bool enabledPerSettings) OVERRIDE; |
| 131 | virtual bool allowScriptFromSource(bool enabledPerSettings, const WebCore::KURL& scriptURL) OVERRIDE; |
| 132 | virtual bool allowPlugins(bool enabledPerSettings) OVERRIDE; |
| 133 | virtual bool allowImage(bool enabledPerSettings, const WebCore::KURL& imageURL) OVERRIDE; |
| 134 | virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&) OVERRIDE; |
| 135 | virtual bool allowRunningInsecureContent(bool enabledPerSettings, WebCore::SecurityOrigin*, const WebCore::KURL&) OVERRIDE; |
| 136 | virtual void didNotAllowScript() OVERRIDE; |
| 137 | virtual void didNotAllowPlugins() OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 138 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 139 | virtual WebCookieJar* cookieJar() const OVERRIDE; |
| 140 | virtual bool willCheckAndDispatchMessageEvent(WebCore::SecurityOrigin* target, WebCore::MessageEvent*) const OVERRIDE; |
| 141 | virtual void didChangeName(const String&) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 142 | |
| 143 | virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE; |
| 144 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 145 | virtual void dispatchWillStartUsingPeerConnectionHandler(blink::WebRTCPeerConnectionHandler*) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 146 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 147 | virtual void didRequestAutocomplete(WebCore::HTMLFormElement*) OVERRIDE; |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 148 | |
| 149 | virtual bool allowWebGL(bool enabledPerSettings) OVERRIDE; |
| 150 | virtual void didLoseWebGLContext(int arbRobustnessContextLostReason) OVERRIDE; |
| 151 | |
| 152 | virtual void dispatchWillInsertBody() OVERRIDE; |
| 153 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 154 | virtual PassOwnPtr<WebServiceWorkerProvider> createServiceWorkerProvider() OVERRIDE; |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 155 | virtual WebCore::SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() OVERRIDE; |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 156 | |
Torne (Richard Coles) | d5428f3 | 2014-03-18 10:21:16 +0000 | [diff] [blame] | 157 | virtual PassOwnPtr<WebApplicationCacheHost> createApplicationCacheHost(WebApplicationCacheHostClient*) OVERRIDE; |
| 158 | |
Torne (Richard Coles) | 06f816c | 2013-09-26 13:25:12 +0100 | [diff] [blame] | 159 | virtual void didStopAllLoaders() OVERRIDE; |
Torne (Richard Coles) | 9bbd2f5 | 2013-09-19 22:37:05 +0100 | [diff] [blame] | 160 | |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 161 | private: |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 162 | virtual bool isFrameLoaderClientImpl() const OVERRIDE { return true; } |
| 163 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 164 | PassOwnPtr<WebPluginLoadObserver> pluginLoadObserver(WebCore::DocumentLoader*); |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 165 | |
| 166 | // The WebFrame that owns this object and manages its lifetime. Therefore, |
| 167 | // the web frame object is guaranteed to exist. |
| 168 | WebFrameImpl* m_webFrame; |
| 169 | }; |
| 170 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 171 | DEFINE_TYPE_CASTS(FrameLoaderClientImpl, WebCore::FrameLoaderClient, client, client->isFrameLoaderClientImpl(), client.isFrameLoaderClientImpl()); |
Torne (Richard Coles) | 1e20218 | 2013-10-18 15:46:42 +0100 | [diff] [blame] | 172 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 173 | } // namespace blink |
Ben Murdoch | e69819b | 2013-07-17 14:56:49 +0100 | [diff] [blame] | 174 | |
| 175 | #endif |