2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
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
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.
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.
32 #ifndef FrameLoaderClientImpl_h
33 #define FrameLoaderClientImpl_h
35 #include "core/loader/FrameLoaderClient.h"
36 #include "platform/heap/Handle.h"
37 #include "platform/weborigin/KURL.h"
38 #include "public/platform/WebInsecureRequestPolicy.h"
39 #include "wtf/RefPtr.h"
44 class WebDevToolsAgentImpl;
45 class WebLocalFrameImpl;
47 class FrameLoaderClientImpl final : public FrameLoaderClient {
49 static FrameLoaderClientImpl* create(WebLocalFrameImpl*);
51 ~FrameLoaderClientImpl() override;
53 DECLARE_VIRTUAL_TRACE();
55 WebLocalFrameImpl* webFrame() const { return m_webFrame.get(); }
57 // FrameLoaderClient ----------------------------------------------
59 void didCreateNewDocument() override;
60 // Notifies the WebView delegate that the JS window object has been cleared,
61 // giving it a chance to bind native objects to the window before script
63 void dispatchDidClearWindowObjectInMainWorld() override;
64 void documentElementAvailable() override;
65 void runScriptsAtDocumentElementAvailable() override;
66 void runScriptsAtDocumentReady(bool documentIsEmpty) override;
68 void didCreateScriptContext(v8::Local<v8::Context>,
70 int worldId) override;
71 void willReleaseScriptContext(v8::Local<v8::Context>, int worldId) override;
73 // Returns true if we should allow the given V8 extension to be added to
74 // the script context at the currently loading page and given extension group.
75 bool allowScriptExtension(const String& extensionName,
77 int worldId) override;
79 bool hasWebView() const override;
80 bool inShadowTree() const override;
81 Frame* opener() const override;
82 void setOpener(Frame*) override;
83 Frame* parent() const override;
84 Frame* top() const override;
85 Frame* nextSibling() const override;
86 Frame* firstChild() const override;
87 void willBeDetached() override;
88 void detached(FrameDetachType) override;
89 void dispatchWillSendRequest(ResourceRequest&) override;
90 #if defined(OS_TIZEN_TV_PRODUCT)
91 bool getFileDecryptedDataBuffer(const KURL& url, WebData& data) override;
93 void dispatchDidReceiveResponse(const ResourceResponse&) override;
94 void dispatchDidLoadResourceFromMemoryCache(const ResourceRequest&,
95 const ResourceResponse&) override;
96 void dispatchDidHandleOnloadEvents() override;
97 void dispatchDidReceiveServerRedirectForProvisionalLoad() override;
98 void dispatchDidNavigateWithinPage(HistoryItem*,
100 bool contentInitiated) override;
101 void dispatchWillCommitProvisionalLoad() override;
102 void dispatchDidStartProvisionalLoad() override;
103 void dispatchDidReceiveTitle(const String&) override;
104 void dispatchDidChangeIcons(IconType) override;
105 void dispatchDidCommitLoad(HistoryItem*, HistoryCommitType) override;
106 void dispatchDidFailProvisionalLoad(const ResourceError&,
107 HistoryCommitType) override;
108 void dispatchDidFailLoad(const ResourceError&, HistoryCommitType) override;
109 void dispatchDidFinishDocumentLoad() override;
110 void dispatchDidFinishLoad() override;
112 void dispatchDidChangeThemeColor() override;
113 NavigationPolicy decidePolicyForNavigation(const ResourceRequest&,
117 bool shouldReplaceCurrentEntry,
118 bool isClientRedirect,
119 HTMLFormElement*) override;
120 void dispatchWillSendSubmitEvent(HTMLFormElement*) override;
121 void dispatchWillSubmitForm(HTMLFormElement*) override;
122 #if defined(S_TERRACE_SUPPORT)
123 void dispatchPasswordFormWasVisible(HTMLFormElement*) override;
125 void didStartLoading(LoadStartType) override;
126 void didStopLoading() override;
127 void progressEstimateChanged(double progressEstimate) override;
128 void loadURLExternally(const ResourceRequest&,
130 const String& suggestedName,
131 bool shouldReplaceCurrentEntry) override;
132 bool navigateBackForward(int offset) const override;
133 void didAccessInitialDocument() override;
134 void didDisplayInsecureContent() override;
135 void didRunInsecureContent(SecurityOrigin*, const KURL& insecureURL) override;
136 void didDetectXSS(const KURL&, bool didBlockEntirePage) override;
137 void didDispatchPingLoader(const KURL&) override;
138 void didDisplayContentWithCertificateErrors(const KURL&) override;
139 void didRunContentWithCertificateErrors(const KURL&) override;
140 void didChangePerformanceTiming() override;
141 void didObserveLoadingBehavior(WebLoadingBehaviorFlag) override;
142 void selectorMatchChanged(const Vector<String>& addedSelectors,
143 const Vector<String>& removedSelectors) override;
144 DocumentLoader* createDocumentLoader(LocalFrame*,
145 const ResourceRequest&,
146 const SubstituteData&,
147 ClientRedirectPolicy) override;
148 WTF::String userAgent() override;
149 WTF::String doNotTrackValue() override;
150 void transitionToCommittedForNewPage() override;
151 LocalFrame* createFrame(const FrameLoadRequest&,
152 const WTF::AtomicString& name,
153 HTMLFrameOwnerElement*) override;
154 virtual bool canCreatePluginWithoutRenderer(const String& mimeType) const;
155 Widget* createPlugin(HTMLPlugInElement*,
157 const Vector<WTF::String>&,
158 const Vector<WTF::String>&,
161 DetachedPluginPolicy) override;
162 #if defined(TIZEN_VIDEO_HOLE)
163 void setPresetDisableVideoHole(LocalFrame* frame, bool disable) override;
165 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer(
167 const WebMediaPlayerSource&,
168 WebMediaPlayerClient*) override;
169 WebRemotePlaybackClient* createWebRemotePlaybackClient(
170 HTMLMediaElement&) override;
171 ObjectContentType getObjectContentType(
173 const WTF::String& mimeType,
174 bool shouldPreferPlugInsForImages) override;
175 void didChangeScrollOffset() override;
176 void didUpdateCurrentHistoryItem() override;
177 bool allowScript(bool enabledPerSettings) override;
178 bool allowScriptFromSource(bool enabledPerSettings,
179 const KURL& scriptURL) override;
180 bool allowPlugins(bool enabledPerSettings) override;
181 bool allowImage(bool enabledPerSettings, const KURL& imageURL) override;
182 bool allowRunningInsecureContent(bool enabledPerSettings,
184 const KURL&) override;
185 bool allowAutoplay(bool defaultValue) override;
186 void passiveInsecureContentFound(const KURL&) override;
187 void didNotAllowScript() override;
188 void didNotAllowPlugins() override;
189 void didUseKeygen() override;
191 WebCookieJar* cookieJar() const override;
192 void frameFocused() const override;
193 void didChangeName(const String& name, const String& uniqueName) override;
194 void didEnforceInsecureRequestPolicy(WebInsecureRequestPolicy) override;
195 void didUpdateToUniqueOrigin() override;
196 void didChangeSandboxFlags(Frame* childFrame, SandboxFlags) override;
197 void didAddContentSecurityPolicy(const String& headerValue,
198 ContentSecurityPolicyHeaderType,
199 ContentSecurityPolicyHeaderSource) override;
200 void didChangeFrameOwnerProperties(HTMLFrameElementBase*) override;
202 void dispatchWillStartUsingPeerConnectionHandler(
203 WebRTCPeerConnectionHandler*) override;
205 bool allowWebGL(bool enabledPerSettings) override;
207 void dispatchWillInsertBody() override;
209 std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider()
211 bool isControlledByServiceWorker(DocumentLoader&) override;
212 int64_t serviceWorkerID(DocumentLoader&) override;
213 SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() override;
215 std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost(
216 WebApplicationCacheHostClient*) override;
218 void dispatchDidChangeManifest() override;
220 unsigned backForwardLength() override;
222 void suddenTerminationDisablerChanged(bool present,
223 SuddenTerminationDisablerType) override;
225 BlameContext* frameBlameContext() override;
227 LinkResource* createServiceWorkerLinkResource(HTMLLinkElement*) override;
229 WebEffectiveConnectionType getEffectiveConnectionType() override;
231 KURL overrideFlashEmbedWithHTML(const KURL&) override;
233 #if defined(TIZEN_VIDEO_MANUAL_ROTATION_SUPPORT)
234 void requestRotateWebMediaPlayer(LocalFrame*, WebMediaPlayerRotate) override;
238 bool getWrtParsedUrl(const KURL& url, KURL& parsed_url) override;
242 explicit FrameLoaderClientImpl(WebLocalFrameImpl*);
244 bool isFrameLoaderClientImpl() const override { return true; }
245 WebDevToolsAgentImpl* devToolsAgent();
247 // The WebFrame that owns this object and manages its lifetime. Therefore,
248 // the web frame object is guaranteed to exist.
249 Member<WebLocalFrameImpl> m_webFrame;
254 DEFINE_TYPE_CASTS(FrameLoaderClientImpl,
257 client->isFrameLoaderClientImpl(),
258 client.isFrameLoaderClientImpl());