OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 14 matching lines...) Expand all Loading... |
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #ifndef FrameLoaderClientImpl_h | 32 #ifndef FrameLoaderClientImpl_h |
33 #define FrameLoaderClientImpl_h | 33 #define FrameLoaderClientImpl_h |
34 | 34 |
35 #include "core/loader/FrameLoaderClient.h" | 35 #include "LocalFrameClientImpl.h" |
36 #include "platform/heap/Handle.h" | 36 |
37 #include "platform/weborigin/KURL.h" | |
38 #include "public/platform/WebInsecureRequestPolicy.h" | |
39 #include "wtf/RefPtr.h" | |
40 #include <memory> | 37 #include <memory> |
41 | 38 |
42 namespace blink { | 39 namespace blink { |
43 | 40 |
44 class WebDevToolsAgentImpl; | 41 // TODO(slangley): Remove this file once all users are including |
45 class WebLocalFrameImpl; | 42 // LocalFrameClientImpl.h instead. |
46 | 43 using FrameLoaderClientImpl = LocalFrameClientImpl; |
47 class FrameLoaderClientImpl final : public FrameLoaderClient { | |
48 public: | |
49 static FrameLoaderClientImpl* create(WebLocalFrameImpl*); | |
50 | |
51 ~FrameLoaderClientImpl() override; | |
52 | |
53 DECLARE_VIRTUAL_TRACE(); | |
54 | |
55 WebLocalFrameImpl* webFrame() const { return m_webFrame.get(); } | |
56 | |
57 // FrameLoaderClient ---------------------------------------------- | |
58 | |
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 | |
62 // parsing begins. | |
63 void dispatchDidClearWindowObjectInMainWorld() override; | |
64 void documentElementAvailable() override; | |
65 void runScriptsAtDocumentElementAvailable() override; | |
66 void runScriptsAtDocumentReady(bool documentIsEmpty) override; | |
67 | |
68 void didCreateScriptContext(v8::Local<v8::Context>, | |
69 int worldId) override; | |
70 void willReleaseScriptContext(v8::Local<v8::Context>, int worldId) override; | |
71 | |
72 // Returns true if we should allow register V8 extensions to be added. | |
73 bool allowScriptExtensions() override; | |
74 | |
75 bool hasWebView() const override; | |
76 bool inShadowTree() const override; | |
77 Frame* opener() const override; | |
78 void setOpener(Frame*) override; | |
79 Frame* parent() const override; | |
80 Frame* top() const override; | |
81 Frame* nextSibling() const override; | |
82 Frame* firstChild() const override; | |
83 void willBeDetached() override; | |
84 void detached(FrameDetachType) override; | |
85 void dispatchWillSendRequest(ResourceRequest&) override; | |
86 void dispatchDidReceiveResponse(const ResourceResponse&) override; | |
87 void dispatchDidLoadResourceFromMemoryCache(const ResourceRequest&, | |
88 const ResourceResponse&) override; | |
89 void dispatchDidHandleOnloadEvents() override; | |
90 void dispatchDidReceiveServerRedirectForProvisionalLoad() override; | |
91 void dispatchDidNavigateWithinPage(HistoryItem*, | |
92 HistoryCommitType, | |
93 bool contentInitiated) override; | |
94 void dispatchWillCommitProvisionalLoad() override; | |
95 void dispatchDidStartProvisionalLoad(DocumentLoader*) override; | |
96 void dispatchDidReceiveTitle(const String&) override; | |
97 void dispatchDidChangeIcons(IconType) override; | |
98 void dispatchDidCommitLoad(HistoryItem*, HistoryCommitType) override; | |
99 void dispatchDidFailProvisionalLoad(const ResourceError&, | |
100 HistoryCommitType) override; | |
101 void dispatchDidFailLoad(const ResourceError&, HistoryCommitType) override; | |
102 void dispatchDidFinishDocumentLoad() override; | |
103 void dispatchDidFinishLoad() override; | |
104 | |
105 void dispatchDidChangeThemeColor() override; | |
106 NavigationPolicy decidePolicyForNavigation(const ResourceRequest&, | |
107 DocumentLoader*, | |
108 NavigationType, | |
109 NavigationPolicy, | |
110 bool shouldReplaceCurrentEntry, | |
111 bool isClientRedirect, | |
112 HTMLFormElement*) override; | |
113 void dispatchWillSendSubmitEvent(HTMLFormElement*) override; | |
114 void dispatchWillSubmitForm(HTMLFormElement*) override; | |
115 void didStartLoading(LoadStartType) override; | |
116 void didStopLoading() override; | |
117 void progressEstimateChanged(double progressEstimate) override; | |
118 void loadURLExternally(const ResourceRequest&, | |
119 NavigationPolicy, | |
120 const String& suggestedName, | |
121 bool shouldReplaceCurrentEntry) override; | |
122 void loadErrorPage(int reason) override; | |
123 bool navigateBackForward(int offset) const override; | |
124 void didAccessInitialDocument() override; | |
125 void didDisplayInsecureContent() override; | |
126 void didRunInsecureContent(SecurityOrigin*, const KURL& insecureURL) override; | |
127 void didDetectXSS(const KURL&, bool didBlockEntirePage) override; | |
128 void didDispatchPingLoader(const KURL&) override; | |
129 void didDisplayContentWithCertificateErrors(const KURL&) override; | |
130 void didRunContentWithCertificateErrors(const KURL&) override; | |
131 void didChangePerformanceTiming() override; | |
132 void didObserveLoadingBehavior(WebLoadingBehaviorFlag) override; | |
133 void selectorMatchChanged(const Vector<String>& addedSelectors, | |
134 const Vector<String>& removedSelectors) override; | |
135 DocumentLoader* createDocumentLoader(LocalFrame*, | |
136 const ResourceRequest&, | |
137 const SubstituteData&, | |
138 ClientRedirectPolicy) override; | |
139 WTF::String userAgent() override; | |
140 WTF::String doNotTrackValue() override; | |
141 void transitionToCommittedForNewPage() override; | |
142 LocalFrame* createFrame(const FrameLoadRequest&, | |
143 const WTF::AtomicString& name, | |
144 HTMLFrameOwnerElement*) override; | |
145 virtual bool canCreatePluginWithoutRenderer(const String& mimeType) const; | |
146 Widget* createPlugin(HTMLPlugInElement*, | |
147 const KURL&, | |
148 const Vector<WTF::String>&, | |
149 const Vector<WTF::String>&, | |
150 const WTF::String&, | |
151 bool loadManually, | |
152 DetachedPluginPolicy) override; | |
153 std::unique_ptr<WebMediaPlayer> createWebMediaPlayer( | |
154 HTMLMediaElement&, | |
155 const WebMediaPlayerSource&, | |
156 WebMediaPlayerClient*) override; | |
157 WebRemotePlaybackClient* createWebRemotePlaybackClient( | |
158 HTMLMediaElement&) override; | |
159 ObjectContentType getObjectContentType( | |
160 const KURL&, | |
161 const WTF::String& mimeType, | |
162 bool shouldPreferPlugInsForImages) override; | |
163 void didChangeScrollOffset() override; | |
164 void didUpdateCurrentHistoryItem() override; | |
165 bool allowScript(bool enabledPerSettings) override; | |
166 bool allowScriptFromSource(bool enabledPerSettings, | |
167 const KURL& scriptURL) override; | |
168 bool allowPlugins(bool enabledPerSettings) override; | |
169 bool allowImage(bool enabledPerSettings, const KURL& imageURL) override; | |
170 bool allowRunningInsecureContent(bool enabledPerSettings, | |
171 SecurityOrigin*, | |
172 const KURL&) override; | |
173 bool allowAutoplay(bool defaultValue) override; | |
174 void passiveInsecureContentFound(const KURL&) override; | |
175 void didNotAllowScript() override; | |
176 void didNotAllowPlugins() override; | |
177 | |
178 WebCookieJar* cookieJar() const override; | |
179 void frameFocused() const override; | |
180 void didChangeName(const String& name, const String& uniqueName) override; | |
181 void didEnforceInsecureRequestPolicy(WebInsecureRequestPolicy) override; | |
182 void didUpdateToUniqueOrigin() override; | |
183 void didChangeSandboxFlags(Frame* childFrame, SandboxFlags) override; | |
184 void didSetFeaturePolicyHeader( | |
185 const WebParsedFeaturePolicyHeader& parsedHeader) override; | |
186 void didAddContentSecurityPolicy( | |
187 const String& headerValue, | |
188 ContentSecurityPolicyHeaderType, | |
189 ContentSecurityPolicyHeaderSource, | |
190 const std::vector<WebContentSecurityPolicyPolicy>&) override; | |
191 void didChangeFrameOwnerProperties(HTMLFrameElementBase*) override; | |
192 | |
193 void dispatchWillStartUsingPeerConnectionHandler( | |
194 WebRTCPeerConnectionHandler*) override; | |
195 | |
196 bool allowWebGL(bool enabledPerSettings) override; | |
197 | |
198 void dispatchWillInsertBody() override; | |
199 | |
200 std::unique_ptr<WebServiceWorkerProvider> createServiceWorkerProvider() | |
201 override; | |
202 bool isControlledByServiceWorker(DocumentLoader&) override; | |
203 int64_t serviceWorkerID(DocumentLoader&) override; | |
204 SharedWorkerRepositoryClient* sharedWorkerRepositoryClient() override; | |
205 | |
206 std::unique_ptr<WebApplicationCacheHost> createApplicationCacheHost( | |
207 WebApplicationCacheHostClient*) override; | |
208 | |
209 void dispatchDidChangeManifest() override; | |
210 | |
211 unsigned backForwardLength() override; | |
212 | |
213 void suddenTerminationDisablerChanged(bool present, | |
214 SuddenTerminationDisablerType) override; | |
215 | |
216 BlameContext* frameBlameContext() override; | |
217 | |
218 LinkResource* createServiceWorkerLinkResource(HTMLLinkElement*) override; | |
219 | |
220 WebEffectiveConnectionType getEffectiveConnectionType() override; | |
221 | |
222 KURL overrideFlashEmbedWithHTML(const KURL&) override; | |
223 | |
224 void setHasReceivedUserGesture() override; | |
225 | |
226 private: | |
227 explicit FrameLoaderClientImpl(WebLocalFrameImpl*); | |
228 | |
229 bool isFrameLoaderClientImpl() const override { return true; } | |
230 WebDevToolsAgentImpl* devToolsAgent(); | |
231 | |
232 // The WebFrame that owns this object and manages its lifetime. Therefore, | |
233 // the web frame object is guaranteed to exist. | |
234 Member<WebLocalFrameImpl> m_webFrame; | |
235 | |
236 String m_userAgent; | |
237 }; | |
238 | |
239 DEFINE_TYPE_CASTS(FrameLoaderClientImpl, | |
240 FrameLoaderClient, | |
241 client, | |
242 client->isFrameLoaderClientImpl(), | |
243 client.isFrameLoaderClientImpl()); | |
244 | 44 |
245 } // namespace blink | 45 } // namespace blink |
246 | 46 |
247 #endif | 47 #endif |
OLD | NEW |