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 11 matching lines...) Expand all Loading... |
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
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 #include "web/FrameLoaderClientImpl.h" | 32 #include "web/LocalFrameClientImpl.h" |
33 | 33 |
34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
35 #include "core/HTMLNames.h" | 35 #include "core/HTMLNames.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
38 #include "core/events/MessageEvent.h" | 38 #include "core/events/MessageEvent.h" |
39 #include "core/events/MouseEvent.h" | 39 #include "core/events/MouseEvent.h" |
40 #include "core/events/UIEventWithKeyState.h" | 40 #include "core/events/UIEventWithKeyState.h" |
41 #include "core/frame/FrameView.h" | 41 #include "core/frame/FrameView.h" |
42 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 #include "public/web/WebAutofillClient.h" | 86 #include "public/web/WebAutofillClient.h" |
87 #include "public/web/WebContentSettingsClient.h" | 87 #include "public/web/WebContentSettingsClient.h" |
88 #include "public/web/WebDOMEvent.h" | 88 #include "public/web/WebDOMEvent.h" |
89 #include "public/web/WebDocument.h" | 89 #include "public/web/WebDocument.h" |
90 #include "public/web/WebFormElement.h" | 90 #include "public/web/WebFormElement.h" |
91 #include "public/web/WebFrameClient.h" | 91 #include "public/web/WebFrameClient.h" |
92 #include "public/web/WebNode.h" | 92 #include "public/web/WebNode.h" |
93 #include "public/web/WebPlugin.h" | 93 #include "public/web/WebPlugin.h" |
94 #include "public/web/WebPluginParams.h" | 94 #include "public/web/WebPluginParams.h" |
95 #include "public/web/WebViewClient.h" | 95 #include "public/web/WebViewClient.h" |
| 96 #include "v8/include/v8.h" |
96 #include "web/DevToolsEmulator.h" | 97 #include "web/DevToolsEmulator.h" |
97 #include "web/SharedWorkerRepositoryClientImpl.h" | 98 #include "web/SharedWorkerRepositoryClientImpl.h" |
98 #include "web/WebDataSourceImpl.h" | 99 #include "web/WebDataSourceImpl.h" |
99 #include "web/WebDevToolsAgentImpl.h" | 100 #include "web/WebDevToolsAgentImpl.h" |
100 #include "web/WebDevToolsFrontendImpl.h" | 101 #include "web/WebDevToolsFrontendImpl.h" |
101 #include "web/WebLocalFrameImpl.h" | 102 #include "web/WebLocalFrameImpl.h" |
102 #include "web/WebPluginContainerImpl.h" | 103 #include "web/WebPluginContainerImpl.h" |
103 #include "web/WebViewImpl.h" | 104 #include "web/WebViewImpl.h" |
104 #include "wtf/PtrUtil.h" | 105 #include "wtf/PtrUtil.h" |
105 #include "wtf/StringExtras.h" | 106 #include "wtf/StringExtras.h" |
106 #include "wtf/text/CString.h" | 107 #include "wtf/text/CString.h" |
107 #include "wtf/text/WTFString.h" | 108 #include "wtf/text/WTFString.h" |
| 109 |
108 #include <memory> | 110 #include <memory> |
109 #include <v8.h> | |
110 | 111 |
111 namespace blink { | 112 namespace blink { |
112 | 113 |
113 namespace { | 114 namespace { |
114 | 115 |
115 // Convenience helper for frame tree helpers in FrameClient to reduce the amount | 116 // Convenience helper for frame tree helpers in FrameClient to reduce the amount |
116 // of null-checking boilerplate code. Since the frame tree is maintained in the | 117 // of null-checking boilerplate code. Since the frame tree is maintained in the |
117 // web/ layer, the frame tree helpers often have to deal with null WebFrames: | 118 // web/ layer, the frame tree helpers often have to deal with null WebFrames: |
118 // for example, a frame with no parent will return null for WebFrame::parent(). | 119 // for example, a frame with no parent will return null for WebFrame::parent(). |
119 // TODO(dcheng): Remove duplication between FrameLoaderClientImpl and | 120 // TODO(dcheng): Remove duplication between LocalFrameClientImpl and |
120 // RemoteFrameClientImpl somehow... | 121 // RemoteFrameClientImpl somehow... |
121 Frame* toCoreFrame(WebFrame* frame) { | 122 Frame* toCoreFrame(WebFrame* frame) { |
122 return frame ? frame->toImplBase()->frame() : nullptr; | 123 return frame ? frame->toImplBase()->frame() : nullptr; |
123 } | 124 } |
124 | 125 |
125 } // namespace | 126 } // namespace |
126 | 127 |
127 FrameLoaderClientImpl::FrameLoaderClientImpl(WebLocalFrameImpl* frame) | 128 LocalFrameClientImpl::LocalFrameClientImpl(WebLocalFrameImpl* frame) |
128 : m_webFrame(frame) {} | 129 : m_webFrame(frame) {} |
129 | 130 |
130 FrameLoaderClientImpl* FrameLoaderClientImpl::create(WebLocalFrameImpl* frame) { | 131 LocalFrameClientImpl* LocalFrameClientImpl::create(WebLocalFrameImpl* frame) { |
131 return new FrameLoaderClientImpl(frame); | 132 return new LocalFrameClientImpl(frame); |
132 } | 133 } |
133 | 134 |
134 FrameLoaderClientImpl::~FrameLoaderClientImpl() {} | 135 LocalFrameClientImpl::~LocalFrameClientImpl() {} |
135 | 136 |
136 DEFINE_TRACE(FrameLoaderClientImpl) { | 137 DEFINE_TRACE(LocalFrameClientImpl) { |
137 visitor->trace(m_webFrame); | 138 visitor->trace(m_webFrame); |
138 FrameLoaderClient::trace(visitor); | 139 LocalFrameClient::trace(visitor); |
139 } | 140 } |
140 | 141 |
141 void FrameLoaderClientImpl::didCreateNewDocument() { | 142 void LocalFrameClientImpl::didCreateNewDocument() { |
142 if (m_webFrame->client()) | 143 if (m_webFrame->client()) |
143 m_webFrame->client()->didCreateNewDocument(m_webFrame); | 144 m_webFrame->client()->didCreateNewDocument(m_webFrame); |
144 } | 145 } |
145 | 146 |
146 void FrameLoaderClientImpl::dispatchDidClearWindowObjectInMainWorld() { | 147 void LocalFrameClientImpl::dispatchDidClearWindowObjectInMainWorld() { |
147 if (m_webFrame->client()) { | 148 if (m_webFrame->client()) { |
148 m_webFrame->client()->didClearWindowObject(m_webFrame); | 149 m_webFrame->client()->didClearWindowObject(m_webFrame); |
149 Document* document = m_webFrame->frame()->document(); | 150 Document* document = m_webFrame->frame()->document(); |
150 if (document) { | 151 if (document) { |
151 DeviceMotionController::from(*document); | 152 DeviceMotionController::from(*document); |
152 DeviceOrientationController::from(*document); | 153 DeviceOrientationController::from(*document); |
153 DeviceOrientationAbsoluteController::from(*document); | 154 DeviceOrientationAbsoluteController::from(*document); |
154 if (RuntimeEnabledFeatures::deviceLightEnabled()) | 155 if (RuntimeEnabledFeatures::deviceLightEnabled()) |
155 DeviceLightController::from(*document); | 156 DeviceLightController::from(*document); |
156 NavigatorGamepad::from(*document); | 157 NavigatorGamepad::from(*document); |
157 NavigatorServiceWorker::from(*document); | 158 NavigatorServiceWorker::from(*document); |
158 DOMWindowStorageController::from(*document); | 159 DOMWindowStorageController::from(*document); |
159 if (RuntimeEnabledFeatures::webVREnabled() || | 160 if (RuntimeEnabledFeatures::webVREnabled() || |
160 OriginTrials::webVREnabled(document->getExecutionContext())) | 161 OriginTrials::webVREnabled(document->getExecutionContext())) |
161 NavigatorVR::from(*document); | 162 NavigatorVR::from(*document); |
162 } | 163 } |
163 } | 164 } |
164 // FIXME: when extensions go out of process, this whole concept stops working. | 165 // FIXME: when extensions go out of process, this whole concept stops working. |
165 WebDevToolsFrontendImpl* devToolsFrontend = | 166 WebDevToolsFrontendImpl* devToolsFrontend = |
166 m_webFrame->top()->isWebLocalFrame() | 167 m_webFrame->top()->isWebLocalFrame() |
167 ? toWebLocalFrameImpl(m_webFrame->top())->devToolsFrontend() | 168 ? toWebLocalFrameImpl(m_webFrame->top())->devToolsFrontend() |
168 : nullptr; | 169 : nullptr; |
169 if (devToolsFrontend) | 170 if (devToolsFrontend) |
170 devToolsFrontend->didClearWindowObject(m_webFrame); | 171 devToolsFrontend->didClearWindowObject(m_webFrame); |
171 } | 172 } |
172 | 173 |
173 void FrameLoaderClientImpl::documentElementAvailable() { | 174 void LocalFrameClientImpl::documentElementAvailable() { |
174 if (m_webFrame->client()) | 175 if (m_webFrame->client()) |
175 m_webFrame->client()->didCreateDocumentElement(m_webFrame); | 176 m_webFrame->client()->didCreateDocumentElement(m_webFrame); |
176 } | 177 } |
177 | 178 |
178 void FrameLoaderClientImpl::runScriptsAtDocumentElementAvailable() { | 179 void LocalFrameClientImpl::runScriptsAtDocumentElementAvailable() { |
179 if (m_webFrame->client()) | 180 if (m_webFrame->client()) |
180 m_webFrame->client()->runScriptsAtDocumentElementAvailable(m_webFrame); | 181 m_webFrame->client()->runScriptsAtDocumentElementAvailable(m_webFrame); |
181 // The callback might have deleted the frame, do not use |this|! | 182 // The callback might have deleted the frame, do not use |this|! |
182 } | 183 } |
183 | 184 |
184 void FrameLoaderClientImpl::runScriptsAtDocumentReady(bool documentIsEmpty) { | 185 void LocalFrameClientImpl::runScriptsAtDocumentReady(bool documentIsEmpty) { |
185 if (m_webFrame->client()) | 186 if (m_webFrame->client()) { |
186 m_webFrame->client()->runScriptsAtDocumentReady(m_webFrame, | 187 m_webFrame->client()->runScriptsAtDocumentReady(m_webFrame, |
187 documentIsEmpty); | 188 documentIsEmpty); |
| 189 } |
188 // The callback might have deleted the frame, do not use |this|! | 190 // The callback might have deleted the frame, do not use |this|! |
189 } | 191 } |
190 | 192 |
191 void FrameLoaderClientImpl::didCreateScriptContext( | 193 void LocalFrameClientImpl::didCreateScriptContext( |
192 v8::Local<v8::Context> context, | 194 v8::Local<v8::Context> context, |
193 int worldId) { | 195 int worldId) { |
194 if (m_webFrame->client()) | 196 if (m_webFrame->client()) |
195 m_webFrame->client()->didCreateScriptContext(m_webFrame, context, worldId); | 197 m_webFrame->client()->didCreateScriptContext(m_webFrame, context, worldId); |
196 } | 198 } |
197 | 199 |
198 void FrameLoaderClientImpl::willReleaseScriptContext( | 200 void LocalFrameClientImpl::willReleaseScriptContext( |
199 v8::Local<v8::Context> context, | 201 v8::Local<v8::Context> context, |
200 int worldId) { | 202 int worldId) { |
201 if (m_webFrame->client()) | 203 if (m_webFrame->client()) { |
202 m_webFrame->client()->willReleaseScriptContext(m_webFrame, context, | 204 m_webFrame->client()->willReleaseScriptContext(m_webFrame, context, |
203 worldId); | 205 worldId); |
| 206 } |
204 } | 207 } |
205 | 208 |
206 bool FrameLoaderClientImpl::allowScriptExtensions() { | 209 bool LocalFrameClientImpl::allowScriptExtensions() { |
207 return true; | 210 return true; |
208 } | 211 } |
209 | 212 |
210 void FrameLoaderClientImpl::didChangeScrollOffset() { | 213 void LocalFrameClientImpl::didChangeScrollOffset() { |
211 if (m_webFrame->client()) | 214 if (m_webFrame->client()) |
212 m_webFrame->client()->didChangeScrollOffset(m_webFrame); | 215 m_webFrame->client()->didChangeScrollOffset(m_webFrame); |
213 } | 216 } |
214 | 217 |
215 void FrameLoaderClientImpl::didUpdateCurrentHistoryItem() { | 218 void LocalFrameClientImpl::didUpdateCurrentHistoryItem() { |
216 if (m_webFrame->client()) | 219 if (m_webFrame->client()) |
217 m_webFrame->client()->didUpdateCurrentHistoryItem(); | 220 m_webFrame->client()->didUpdateCurrentHistoryItem(); |
218 } | 221 } |
219 | 222 |
220 bool FrameLoaderClientImpl::allowScript(bool enabledPerSettings) { | 223 bool LocalFrameClientImpl::allowScript(bool enabledPerSettings) { |
221 if (m_webFrame->contentSettingsClient()) | 224 if (m_webFrame->contentSettingsClient()) |
222 return m_webFrame->contentSettingsClient()->allowScript(enabledPerSettings); | 225 return m_webFrame->contentSettingsClient()->allowScript(enabledPerSettings); |
223 | 226 |
224 return enabledPerSettings; | 227 return enabledPerSettings; |
225 } | 228 } |
226 | 229 |
227 bool FrameLoaderClientImpl::allowScriptFromSource(bool enabledPerSettings, | 230 bool LocalFrameClientImpl::allowScriptFromSource(bool enabledPerSettings, |
228 const KURL& scriptURL) { | 231 const KURL& scriptURL) { |
229 if (m_webFrame->contentSettingsClient()) | 232 if (m_webFrame->contentSettingsClient()) { |
230 return m_webFrame->contentSettingsClient()->allowScriptFromSource( | 233 return m_webFrame->contentSettingsClient()->allowScriptFromSource( |
231 enabledPerSettings, scriptURL); | 234 enabledPerSettings, scriptURL); |
| 235 } |
232 | 236 |
233 return enabledPerSettings; | 237 return enabledPerSettings; |
234 } | 238 } |
235 | 239 |
236 bool FrameLoaderClientImpl::allowPlugins(bool enabledPerSettings) { | 240 bool LocalFrameClientImpl::allowPlugins(bool enabledPerSettings) { |
237 if (m_webFrame->contentSettingsClient()) | 241 if (m_webFrame->contentSettingsClient()) { |
238 return m_webFrame->contentSettingsClient()->allowPlugins( | 242 return m_webFrame->contentSettingsClient()->allowPlugins( |
239 enabledPerSettings); | 243 enabledPerSettings); |
| 244 } |
240 | 245 |
241 return enabledPerSettings; | 246 return enabledPerSettings; |
242 } | 247 } |
243 | 248 |
244 bool FrameLoaderClientImpl::allowImage(bool enabledPerSettings, | 249 bool LocalFrameClientImpl::allowImage(bool enabledPerSettings, |
245 const KURL& imageURL) { | 250 const KURL& imageURL) { |
246 if (m_webFrame->contentSettingsClient()) | 251 if (m_webFrame->contentSettingsClient()) { |
247 return m_webFrame->contentSettingsClient()->allowImage(enabledPerSettings, | 252 return m_webFrame->contentSettingsClient()->allowImage(enabledPerSettings, |
248 imageURL); | 253 imageURL); |
| 254 } |
249 | 255 |
250 return enabledPerSettings; | 256 return enabledPerSettings; |
251 } | 257 } |
252 | 258 |
253 bool FrameLoaderClientImpl::allowRunningInsecureContent(bool enabledPerSettings, | 259 bool LocalFrameClientImpl::allowRunningInsecureContent(bool enabledPerSettings, |
254 SecurityOrigin* context, | 260 SecurityOrigin* context, |
255 const KURL& url) { | 261 const KURL& url) { |
256 if (m_webFrame->contentSettingsClient()) | 262 if (m_webFrame->contentSettingsClient()) { |
257 return m_webFrame->contentSettingsClient()->allowRunningInsecureContent( | 263 return m_webFrame->contentSettingsClient()->allowRunningInsecureContent( |
258 enabledPerSettings, WebSecurityOrigin(context), WebURL(url)); | 264 enabledPerSettings, WebSecurityOrigin(context), WebURL(url)); |
| 265 } |
259 | 266 |
260 return enabledPerSettings; | 267 return enabledPerSettings; |
261 } | 268 } |
262 | 269 |
263 bool FrameLoaderClientImpl::allowAutoplay(bool defaultValue) { | 270 bool LocalFrameClientImpl::allowAutoplay(bool defaultValue) { |
264 if (m_webFrame->contentSettingsClient()) | 271 if (m_webFrame->contentSettingsClient()) |
265 return m_webFrame->contentSettingsClient()->allowAutoplay(defaultValue); | 272 return m_webFrame->contentSettingsClient()->allowAutoplay(defaultValue); |
266 | 273 |
267 return defaultValue; | 274 return defaultValue; |
268 } | 275 } |
269 | 276 |
270 void FrameLoaderClientImpl::passiveInsecureContentFound(const KURL& url) { | 277 void LocalFrameClientImpl::passiveInsecureContentFound(const KURL& url) { |
271 if (m_webFrame->contentSettingsClient()) | 278 if (m_webFrame->contentSettingsClient()) { |
272 return m_webFrame->contentSettingsClient()->passiveInsecureContentFound( | 279 return m_webFrame->contentSettingsClient()->passiveInsecureContentFound( |
273 WebURL(url)); | 280 WebURL(url)); |
| 281 } |
274 } | 282 } |
275 | 283 |
276 void FrameLoaderClientImpl::didNotAllowScript() { | 284 void LocalFrameClientImpl::didNotAllowScript() { |
277 if (m_webFrame->contentSettingsClient()) | 285 if (m_webFrame->contentSettingsClient()) |
278 m_webFrame->contentSettingsClient()->didNotAllowScript(); | 286 m_webFrame->contentSettingsClient()->didNotAllowScript(); |
279 } | 287 } |
280 | 288 |
281 void FrameLoaderClientImpl::didNotAllowPlugins() { | 289 void LocalFrameClientImpl::didNotAllowPlugins() { |
282 if (m_webFrame->contentSettingsClient()) | 290 if (m_webFrame->contentSettingsClient()) |
283 m_webFrame->contentSettingsClient()->didNotAllowPlugins(); | 291 m_webFrame->contentSettingsClient()->didNotAllowPlugins(); |
284 } | 292 } |
285 | 293 |
286 bool FrameLoaderClientImpl::hasWebView() const { | 294 bool LocalFrameClientImpl::hasWebView() const { |
287 return m_webFrame->viewImpl(); | 295 return m_webFrame->viewImpl(); |
288 } | 296 } |
289 | 297 |
290 bool FrameLoaderClientImpl::inShadowTree() const { | 298 bool LocalFrameClientImpl::inShadowTree() const { |
291 return m_webFrame->inShadowTree(); | 299 return m_webFrame->inShadowTree(); |
292 } | 300 } |
293 | 301 |
294 Frame* FrameLoaderClientImpl::opener() const { | 302 Frame* LocalFrameClientImpl::opener() const { |
295 return toCoreFrame(m_webFrame->opener()); | 303 return toCoreFrame(m_webFrame->opener()); |
296 } | 304 } |
297 | 305 |
298 void FrameLoaderClientImpl::setOpener(Frame* opener) { | 306 void LocalFrameClientImpl::setOpener(Frame* opener) { |
299 WebFrame* openerFrame = WebFrame::fromFrame(opener); | 307 WebFrame* openerFrame = WebFrame::fromFrame(opener); |
300 if (m_webFrame->client() && m_webFrame->opener() != openerFrame) | 308 if (m_webFrame->client() && m_webFrame->opener() != openerFrame) |
301 m_webFrame->client()->didChangeOpener(openerFrame); | 309 m_webFrame->client()->didChangeOpener(openerFrame); |
302 m_webFrame->setOpener(openerFrame); | 310 m_webFrame->setOpener(openerFrame); |
303 } | 311 } |
304 | 312 |
305 Frame* FrameLoaderClientImpl::parent() const { | 313 Frame* LocalFrameClientImpl::parent() const { |
306 return toCoreFrame(m_webFrame->parent()); | 314 return toCoreFrame(m_webFrame->parent()); |
307 } | 315 } |
308 | 316 |
309 Frame* FrameLoaderClientImpl::top() const { | 317 Frame* LocalFrameClientImpl::top() const { |
310 return toCoreFrame(m_webFrame->top()); | 318 return toCoreFrame(m_webFrame->top()); |
311 } | 319 } |
312 | 320 |
313 Frame* FrameLoaderClientImpl::nextSibling() const { | 321 Frame* LocalFrameClientImpl::nextSibling() const { |
314 return toCoreFrame(m_webFrame->nextSibling()); | 322 return toCoreFrame(m_webFrame->nextSibling()); |
315 } | 323 } |
316 | 324 |
317 Frame* FrameLoaderClientImpl::firstChild() const { | 325 Frame* LocalFrameClientImpl::firstChild() const { |
318 return toCoreFrame(m_webFrame->firstChild()); | 326 return toCoreFrame(m_webFrame->firstChild()); |
319 } | 327 } |
320 | 328 |
321 void FrameLoaderClientImpl::willBeDetached() { | 329 void LocalFrameClientImpl::willBeDetached() { |
322 m_webFrame->willBeDetached(); | 330 m_webFrame->willBeDetached(); |
323 } | 331 } |
324 | 332 |
325 void FrameLoaderClientImpl::detached(FrameDetachType type) { | 333 void LocalFrameClientImpl::detached(FrameDetachType type) { |
326 // Alert the client that the frame is being detached. This is the last | 334 // Alert the client that the frame is being detached. This is the last |
327 // chance we have to communicate with the client. | 335 // chance we have to communicate with the client. |
328 WebFrameClient* client = m_webFrame->client(); | 336 WebFrameClient* client = m_webFrame->client(); |
329 if (!client) | 337 if (!client) |
330 return; | 338 return; |
331 | 339 |
332 m_webFrame->willDetachParent(); | 340 m_webFrame->willDetachParent(); |
333 | 341 |
334 // Signal that no further communication with WebFrameClient should take | 342 // Signal that no further communication with WebFrameClient should take |
335 // place at this point since we are no longer associated with the Page. | 343 // place at this point since we are no longer associated with the Page. |
336 m_webFrame->setClient(0); | 344 m_webFrame->setClient(0); |
337 | 345 |
338 client->frameDetached(m_webFrame, | 346 client->frameDetached(m_webFrame, |
339 static_cast<WebFrameClient::DetachType>(type)); | 347 static_cast<WebFrameClient::DetachType>(type)); |
340 // Clear our reference to LocalFrame at the very end, in case the client | 348 // Clear our reference to LocalFrame at the very end, in case the client |
341 // refers to it. | 349 // refers to it. |
342 m_webFrame->setCoreFrame(nullptr); | 350 m_webFrame->setCoreFrame(nullptr); |
343 } | 351 } |
344 | 352 |
345 void FrameLoaderClientImpl::dispatchWillSendRequest(ResourceRequest& request) { | 353 void LocalFrameClientImpl::dispatchWillSendRequest(ResourceRequest& request) { |
346 // Give the WebFrameClient a crack at the request. | 354 // Give the WebFrameClient a crack at the request. |
347 if (m_webFrame->client()) { | 355 if (m_webFrame->client()) { |
348 WrappedResourceRequest webreq(request); | 356 WrappedResourceRequest webreq(request); |
349 m_webFrame->client()->willSendRequest(m_webFrame, webreq); | 357 m_webFrame->client()->willSendRequest(m_webFrame, webreq); |
350 } | 358 } |
351 } | 359 } |
352 | 360 |
353 void FrameLoaderClientImpl::dispatchDidReceiveResponse( | 361 void LocalFrameClientImpl::dispatchDidReceiveResponse( |
354 const ResourceResponse& response) { | 362 const ResourceResponse& response) { |
355 if (m_webFrame->client()) { | 363 if (m_webFrame->client()) { |
356 WrappedResourceResponse webresp(response); | 364 WrappedResourceResponse webresp(response); |
357 m_webFrame->client()->didReceiveResponse(webresp); | 365 m_webFrame->client()->didReceiveResponse(webresp); |
358 } | 366 } |
359 } | 367 } |
360 | 368 |
361 void FrameLoaderClientImpl::dispatchDidFinishDocumentLoad() { | 369 void LocalFrameClientImpl::dispatchDidFinishDocumentLoad() { |
362 // TODO(dglazkov): Sadly, workers are WebFrameClients, and they can totally | 370 // TODO(dglazkov): Sadly, workers are WebFrameClients, and they can totally |
363 // destroy themselves when didFinishDocumentLoad is invoked, and in turn | 371 // destroy themselves when didFinishDocumentLoad is invoked, and in turn |
364 // destroy the fake WebLocalFrame that they create, which means that you | 372 // destroy the fake WebLocalFrame that they create, which means that you |
365 // should not put any code touching `this` after the two lines below. | 373 // should not put any code touching `this` after the two lines below. |
366 if (m_webFrame->client()) | 374 if (m_webFrame->client()) |
367 m_webFrame->client()->didFinishDocumentLoad(m_webFrame); | 375 m_webFrame->client()->didFinishDocumentLoad(m_webFrame); |
368 } | 376 } |
369 | 377 |
370 void FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache( | 378 void LocalFrameClientImpl::dispatchDidLoadResourceFromMemoryCache( |
371 const ResourceRequest& request, | 379 const ResourceRequest& request, |
372 const ResourceResponse& response) { | 380 const ResourceResponse& response) { |
373 if (m_webFrame->client()) | 381 if (m_webFrame->client()) { |
374 m_webFrame->client()->didLoadResourceFromMemoryCache( | 382 m_webFrame->client()->didLoadResourceFromMemoryCache( |
375 WrappedResourceRequest(request), WrappedResourceResponse(response)); | 383 WrappedResourceRequest(request), WrappedResourceResponse(response)); |
| 384 } |
376 } | 385 } |
377 | 386 |
378 void FrameLoaderClientImpl::dispatchDidHandleOnloadEvents() { | 387 void LocalFrameClientImpl::dispatchDidHandleOnloadEvents() { |
379 if (m_webFrame->client()) | 388 if (m_webFrame->client()) |
380 m_webFrame->client()->didHandleOnloadEvents(m_webFrame); | 389 m_webFrame->client()->didHandleOnloadEvents(m_webFrame); |
381 } | 390 } |
382 | 391 |
383 void FrameLoaderClientImpl:: | 392 void LocalFrameClientImpl:: |
384 dispatchDidReceiveServerRedirectForProvisionalLoad() { | 393 dispatchDidReceiveServerRedirectForProvisionalLoad() { |
385 if (m_webFrame->client()) | 394 if (m_webFrame->client()) { |
386 m_webFrame->client()->didReceiveServerRedirectForProvisionalLoad( | 395 m_webFrame->client()->didReceiveServerRedirectForProvisionalLoad( |
387 m_webFrame); | 396 m_webFrame); |
| 397 } |
388 } | 398 } |
389 | 399 |
390 void FrameLoaderClientImpl::dispatchDidNavigateWithinPage( | 400 void LocalFrameClientImpl::dispatchDidNavigateWithinPage( |
391 HistoryItem* item, | 401 HistoryItem* item, |
392 HistoryCommitType commitType, | 402 HistoryCommitType commitType, |
393 bool contentInitiated) { | 403 bool contentInitiated) { |
394 bool shouldCreateHistoryEntry = commitType == StandardCommit; | 404 bool shouldCreateHistoryEntry = commitType == StandardCommit; |
395 // TODO(dglazkov): Does this need to be called for subframes? | 405 // TODO(dglazkov): Does this need to be called for subframes? |
396 m_webFrame->viewImpl()->didCommitLoad(shouldCreateHistoryEntry, true); | 406 m_webFrame->viewImpl()->didCommitLoad(shouldCreateHistoryEntry, true); |
397 if (m_webFrame->client()) | 407 if (m_webFrame->client()) { |
398 m_webFrame->client()->didNavigateWithinPage( | 408 m_webFrame->client()->didNavigateWithinPage( |
399 m_webFrame, WebHistoryItem(item), | 409 m_webFrame, WebHistoryItem(item), |
400 static_cast<WebHistoryCommitType>(commitType), contentInitiated); | 410 static_cast<WebHistoryCommitType>(commitType), contentInitiated); |
| 411 } |
401 } | 412 } |
402 | 413 |
403 void FrameLoaderClientImpl::dispatchWillCommitProvisionalLoad() { | 414 void LocalFrameClientImpl::dispatchWillCommitProvisionalLoad() { |
404 if (m_webFrame->client()) | 415 if (m_webFrame->client()) |
405 m_webFrame->client()->willCommitProvisionalLoad(m_webFrame); | 416 m_webFrame->client()->willCommitProvisionalLoad(m_webFrame); |
406 } | 417 } |
407 | 418 |
408 void FrameLoaderClientImpl::dispatchDidStartProvisionalLoad( | 419 void LocalFrameClientImpl::dispatchDidStartProvisionalLoad( |
409 DocumentLoader* loader) { | 420 DocumentLoader* loader) { |
410 if (m_webFrame->client()) { | 421 if (m_webFrame->client()) { |
411 m_webFrame->client()->didStartProvisionalLoad( | 422 m_webFrame->client()->didStartProvisionalLoad( |
412 WebDataSourceImpl::fromDocumentLoader(loader)); | 423 WebDataSourceImpl::fromDocumentLoader(loader)); |
413 } | 424 } |
414 if (WebDevToolsAgentImpl* devTools = devToolsAgent()) | 425 if (WebDevToolsAgentImpl* devTools = devToolsAgent()) |
415 devTools->didStartProvisionalLoad(m_webFrame->frame()); | 426 devTools->didStartProvisionalLoad(m_webFrame->frame()); |
416 } | 427 } |
417 | 428 |
418 void FrameLoaderClientImpl::dispatchDidReceiveTitle(const String& title) { | 429 void LocalFrameClientImpl::dispatchDidReceiveTitle(const String& title) { |
419 if (m_webFrame->client()) | 430 if (m_webFrame->client()) { |
420 m_webFrame->client()->didReceiveTitle(m_webFrame, title, | 431 m_webFrame->client()->didReceiveTitle(m_webFrame, title, |
421 WebTextDirectionLeftToRight); | 432 WebTextDirectionLeftToRight); |
| 433 } |
422 } | 434 } |
423 | 435 |
424 void FrameLoaderClientImpl::dispatchDidChangeIcons(IconType type) { | 436 void LocalFrameClientImpl::dispatchDidChangeIcons(IconType type) { |
425 if (m_webFrame->client()) | 437 if (m_webFrame->client()) { |
426 m_webFrame->client()->didChangeIcon(m_webFrame, | 438 m_webFrame->client()->didChangeIcon(m_webFrame, |
427 static_cast<WebIconURL::Type>(type)); | 439 static_cast<WebIconURL::Type>(type)); |
| 440 } |
428 } | 441 } |
429 | 442 |
430 void FrameLoaderClientImpl::dispatchDidCommitLoad( | 443 void LocalFrameClientImpl::dispatchDidCommitLoad(HistoryItem* item, |
431 HistoryItem* item, | 444 HistoryCommitType commitType) { |
432 HistoryCommitType commitType) { | |
433 if (!m_webFrame->parent()) { | 445 if (!m_webFrame->parent()) { |
434 m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); | 446 m_webFrame->viewImpl()->didCommitLoad(commitType == StandardCommit, false); |
435 } | 447 } |
436 | 448 |
437 if (m_webFrame->client()) | 449 if (m_webFrame->client()) { |
438 m_webFrame->client()->didCommitProvisionalLoad( | 450 m_webFrame->client()->didCommitProvisionalLoad( |
439 m_webFrame, WebHistoryItem(item), | 451 m_webFrame, WebHistoryItem(item), |
440 static_cast<WebHistoryCommitType>(commitType)); | 452 static_cast<WebHistoryCommitType>(commitType)); |
| 453 } |
441 if (WebDevToolsAgentImpl* devTools = devToolsAgent()) | 454 if (WebDevToolsAgentImpl* devTools = devToolsAgent()) |
442 devTools->didCommitLoadForLocalFrame(m_webFrame->frame()); | 455 devTools->didCommitLoadForLocalFrame(m_webFrame->frame()); |
443 } | 456 } |
444 | 457 |
445 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( | 458 void LocalFrameClientImpl::dispatchDidFailProvisionalLoad( |
446 const ResourceError& error, | 459 const ResourceError& error, |
447 HistoryCommitType commitType) { | 460 HistoryCommitType commitType) { |
448 m_webFrame->didFail(error, true, commitType); | 461 m_webFrame->didFail(error, true, commitType); |
449 } | 462 } |
450 | 463 |
451 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error, | 464 void LocalFrameClientImpl::dispatchDidFailLoad(const ResourceError& error, |
452 HistoryCommitType commitType) { | 465 HistoryCommitType commitType) { |
453 m_webFrame->didFail(error, false, commitType); | 466 m_webFrame->didFail(error, false, commitType); |
454 } | 467 } |
455 | 468 |
456 void FrameLoaderClientImpl::dispatchDidFinishLoad() { | 469 void LocalFrameClientImpl::dispatchDidFinishLoad() { |
457 m_webFrame->didFinish(); | 470 m_webFrame->didFinish(); |
458 } | 471 } |
459 | 472 |
460 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() { | 473 void LocalFrameClientImpl::dispatchDidChangeThemeColor() { |
461 if (m_webFrame->client()) | 474 if (m_webFrame->client()) |
462 m_webFrame->client()->didChangeThemeColor(); | 475 m_webFrame->client()->didChangeThemeColor(); |
463 } | 476 } |
464 | 477 |
465 static bool allowCreatingBackgroundTabs() { | 478 static bool allowCreatingBackgroundTabs() { |
466 const WebInputEvent* inputEvent = WebViewImpl::currentInputEvent(); | 479 const WebInputEvent* inputEvent = WebViewImpl::currentInputEvent(); |
467 if (!inputEvent || (inputEvent->type() != WebInputEvent::MouseUp && | 480 if (!inputEvent || (inputEvent->type() != WebInputEvent::MouseUp && |
468 (inputEvent->type() != WebInputEvent::RawKeyDown && | 481 (inputEvent->type() != WebInputEvent::RawKeyDown && |
469 inputEvent->type() != WebInputEvent::KeyDown) && | 482 inputEvent->type() != WebInputEvent::KeyDown) && |
470 inputEvent->type() != WebInputEvent::GestureTap)) | 483 inputEvent->type() != WebInputEvent::GestureTap)) |
(...skipping 26 matching lines...) Expand all Loading... |
497 bool alt = inputEvent->modifiers() & WebMouseEvent::AltKey; | 510 bool alt = inputEvent->modifiers() & WebMouseEvent::AltKey; |
498 bool meta = inputEvent->modifiers() & WebMouseEvent::MetaKey; | 511 bool meta = inputEvent->modifiers() & WebMouseEvent::MetaKey; |
499 | 512 |
500 NavigationPolicy userPolicy; | 513 NavigationPolicy userPolicy; |
501 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, | 514 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, |
502 &userPolicy)) | 515 &userPolicy)) |
503 return false; | 516 return false; |
504 return userPolicy == NavigationPolicyNewBackgroundTab; | 517 return userPolicy == NavigationPolicyNewBackgroundTab; |
505 } | 518 } |
506 | 519 |
507 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation( | 520 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation( |
508 const ResourceRequest& request, | 521 const ResourceRequest& request, |
509 DocumentLoader* loader, | 522 DocumentLoader* loader, |
510 NavigationType type, | 523 NavigationType type, |
511 NavigationPolicy policy, | 524 NavigationPolicy policy, |
512 bool replacesCurrentHistoryItem, | 525 bool replacesCurrentHistoryItem, |
513 bool isClientRedirect, | 526 bool isClientRedirect, |
514 HTMLFormElement* form) { | 527 HTMLFormElement* form) { |
515 if (!m_webFrame->client()) | 528 if (!m_webFrame->client()) |
516 return NavigationPolicyIgnore; | 529 return NavigationPolicyIgnore; |
517 | 530 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 navigationInfo.isCacheDisabled = | 568 navigationInfo.isCacheDisabled = |
556 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; | 569 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; |
557 if (form) | 570 if (form) |
558 navigationInfo.form = WebFormElement(form); | 571 navigationInfo.form = WebFormElement(form); |
559 | 572 |
560 WebNavigationPolicy webPolicy = | 573 WebNavigationPolicy webPolicy = |
561 m_webFrame->client()->decidePolicyForNavigation(navigationInfo); | 574 m_webFrame->client()->decidePolicyForNavigation(navigationInfo); |
562 return static_cast<NavigationPolicy>(webPolicy); | 575 return static_cast<NavigationPolicy>(webPolicy); |
563 } | 576 } |
564 | 577 |
565 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) { | 578 void LocalFrameClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) { |
566 if (m_webFrame->client()) | 579 if (m_webFrame->client()) |
567 m_webFrame->client()->willSendSubmitEvent(WebFormElement(form)); | 580 m_webFrame->client()->willSendSubmitEvent(WebFormElement(form)); |
568 } | 581 } |
569 | 582 |
570 void FrameLoaderClientImpl::dispatchWillSubmitForm(HTMLFormElement* form) { | 583 void LocalFrameClientImpl::dispatchWillSubmitForm(HTMLFormElement* form) { |
571 if (m_webFrame->client()) | 584 if (m_webFrame->client()) |
572 m_webFrame->client()->willSubmitForm(WebFormElement(form)); | 585 m_webFrame->client()->willSubmitForm(WebFormElement(form)); |
573 } | 586 } |
574 | 587 |
575 void FrameLoaderClientImpl::didStartLoading(LoadStartType loadStartType) { | 588 void LocalFrameClientImpl::didStartLoading(LoadStartType loadStartType) { |
576 if (m_webFrame->client()) | 589 if (m_webFrame->client()) { |
577 m_webFrame->client()->didStartLoading(loadStartType == | 590 m_webFrame->client()->didStartLoading(loadStartType == |
578 NavigationToDifferentDocument); | 591 NavigationToDifferentDocument); |
| 592 } |
579 } | 593 } |
580 | 594 |
581 void FrameLoaderClientImpl::progressEstimateChanged(double progressEstimate) { | 595 void LocalFrameClientImpl::progressEstimateChanged(double progressEstimate) { |
582 if (m_webFrame->client()) | 596 if (m_webFrame->client()) |
583 m_webFrame->client()->didChangeLoadProgress(progressEstimate); | 597 m_webFrame->client()->didChangeLoadProgress(progressEstimate); |
584 } | 598 } |
585 | 599 |
586 void FrameLoaderClientImpl::didStopLoading() { | 600 void LocalFrameClientImpl::didStopLoading() { |
587 if (m_webFrame->client()) | 601 if (m_webFrame->client()) |
588 m_webFrame->client()->didStopLoading(); | 602 m_webFrame->client()->didStopLoading(); |
589 } | 603 } |
590 | 604 |
591 void FrameLoaderClientImpl::loadURLExternally(const ResourceRequest& request, | 605 void LocalFrameClientImpl::loadURLExternally(const ResourceRequest& request, |
592 NavigationPolicy policy, | 606 NavigationPolicy policy, |
593 const String& suggestedName, | 607 const String& suggestedName, |
594 bool shouldReplaceCurrentEntry) { | 608 bool shouldReplaceCurrentEntry) { |
595 if (!m_webFrame->client()) | 609 if (!m_webFrame->client()) |
596 return; | 610 return; |
597 DCHECK(m_webFrame->frame()->document()); | 611 DCHECK(m_webFrame->frame()->document()); |
598 Fullscreen::fullyExitFullscreen(*m_webFrame->frame()->document()); | 612 Fullscreen::fullyExitFullscreen(*m_webFrame->frame()->document()); |
599 m_webFrame->client()->loadURLExternally( | 613 m_webFrame->client()->loadURLExternally( |
600 WrappedResourceRequest(request), static_cast<WebNavigationPolicy>(policy), | 614 WrappedResourceRequest(request), static_cast<WebNavigationPolicy>(policy), |
601 suggestedName, shouldReplaceCurrentEntry); | 615 suggestedName, shouldReplaceCurrentEntry); |
602 } | 616 } |
603 | 617 |
604 void FrameLoaderClientImpl::loadErrorPage(int reason) { | 618 void LocalFrameClientImpl::loadErrorPage(int reason) { |
605 if (m_webFrame->client()) | 619 if (m_webFrame->client()) |
606 m_webFrame->client()->loadErrorPage(reason); | 620 m_webFrame->client()->loadErrorPage(reason); |
607 } | 621 } |
608 | 622 |
609 bool FrameLoaderClientImpl::navigateBackForward(int offset) const { | 623 bool LocalFrameClientImpl::navigateBackForward(int offset) const { |
610 WebViewImpl* webview = m_webFrame->viewImpl(); | 624 WebViewImpl* webview = m_webFrame->viewImpl(); |
611 if (!webview->client()) | 625 if (!webview->client()) |
612 return false; | 626 return false; |
613 | 627 |
614 DCHECK(offset); | 628 DCHECK(offset); |
615 if (offset > webview->client()->historyForwardListCount()) | 629 if (offset > webview->client()->historyForwardListCount()) |
616 return false; | 630 return false; |
617 if (offset < -webview->client()->historyBackListCount()) | 631 if (offset < -webview->client()->historyBackListCount()) |
618 return false; | 632 return false; |
619 webview->client()->navigateBackForwardSoon(offset); | 633 webview->client()->navigateBackForwardSoon(offset); |
620 return true; | 634 return true; |
621 } | 635 } |
622 | 636 |
623 void FrameLoaderClientImpl::didAccessInitialDocument() { | 637 void LocalFrameClientImpl::didAccessInitialDocument() { |
624 if (m_webFrame->client()) | 638 if (m_webFrame->client()) |
625 m_webFrame->client()->didAccessInitialDocument(); | 639 m_webFrame->client()->didAccessInitialDocument(); |
626 } | 640 } |
627 | 641 |
628 void FrameLoaderClientImpl::didDisplayInsecureContent() { | 642 void LocalFrameClientImpl::didDisplayInsecureContent() { |
629 if (m_webFrame->client()) | 643 if (m_webFrame->client()) |
630 m_webFrame->client()->didDisplayInsecureContent(); | 644 m_webFrame->client()->didDisplayInsecureContent(); |
631 } | 645 } |
632 | 646 |
633 void FrameLoaderClientImpl::didRunInsecureContent(SecurityOrigin* origin, | 647 void LocalFrameClientImpl::didRunInsecureContent(SecurityOrigin* origin, |
634 const KURL& insecureURL) { | 648 const KURL& insecureURL) { |
635 if (m_webFrame->client()) | 649 if (m_webFrame->client()) { |
636 m_webFrame->client()->didRunInsecureContent(WebSecurityOrigin(origin), | 650 m_webFrame->client()->didRunInsecureContent(WebSecurityOrigin(origin), |
637 insecureURL); | 651 insecureURL); |
| 652 } |
638 } | 653 } |
639 | 654 |
640 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, | 655 void LocalFrameClientImpl::didDetectXSS(const KURL& insecureURL, |
641 bool didBlockEntirePage) { | 656 bool didBlockEntirePage) { |
642 if (m_webFrame->client()) | 657 if (m_webFrame->client()) |
643 m_webFrame->client()->didDetectXSS(insecureURL, didBlockEntirePage); | 658 m_webFrame->client()->didDetectXSS(insecureURL, didBlockEntirePage); |
644 } | 659 } |
645 | 660 |
646 void FrameLoaderClientImpl::didDispatchPingLoader(const KURL& url) { | 661 void LocalFrameClientImpl::didDispatchPingLoader(const KURL& url) { |
647 if (m_webFrame->client()) | 662 if (m_webFrame->client()) |
648 m_webFrame->client()->didDispatchPingLoader(url); | 663 m_webFrame->client()->didDispatchPingLoader(url); |
649 } | 664 } |
650 | 665 |
651 void FrameLoaderClientImpl::didDisplayContentWithCertificateErrors( | 666 void LocalFrameClientImpl::didDisplayContentWithCertificateErrors( |
652 const KURL& url) { | 667 const KURL& url) { |
653 if (m_webFrame->client()) | 668 if (m_webFrame->client()) |
654 m_webFrame->client()->didDisplayContentWithCertificateErrors(url); | 669 m_webFrame->client()->didDisplayContentWithCertificateErrors(url); |
655 } | 670 } |
656 | 671 |
657 void FrameLoaderClientImpl::didRunContentWithCertificateErrors( | 672 void LocalFrameClientImpl::didRunContentWithCertificateErrors(const KURL& url) { |
658 const KURL& url) { | |
659 if (m_webFrame->client()) | 673 if (m_webFrame->client()) |
660 m_webFrame->client()->didRunContentWithCertificateErrors(url); | 674 m_webFrame->client()->didRunContentWithCertificateErrors(url); |
661 } | 675 } |
662 | 676 |
663 void FrameLoaderClientImpl::didChangePerformanceTiming() { | 677 void LocalFrameClientImpl::didChangePerformanceTiming() { |
664 if (m_webFrame->client()) | 678 if (m_webFrame->client()) |
665 m_webFrame->client()->didChangePerformanceTiming(); | 679 m_webFrame->client()->didChangePerformanceTiming(); |
666 } | 680 } |
667 | 681 |
668 void FrameLoaderClientImpl::didObserveLoadingBehavior( | 682 void LocalFrameClientImpl::didObserveLoadingBehavior( |
669 WebLoadingBehaviorFlag behavior) { | 683 WebLoadingBehaviorFlag behavior) { |
670 if (m_webFrame->client()) | 684 if (m_webFrame->client()) |
671 m_webFrame->client()->didObserveLoadingBehavior(behavior); | 685 m_webFrame->client()->didObserveLoadingBehavior(behavior); |
672 } | 686 } |
673 | 687 |
674 void FrameLoaderClientImpl::selectorMatchChanged( | 688 void LocalFrameClientImpl::selectorMatchChanged( |
675 const Vector<String>& addedSelectors, | 689 const Vector<String>& addedSelectors, |
676 const Vector<String>& removedSelectors) { | 690 const Vector<String>& removedSelectors) { |
677 if (WebFrameClient* client = m_webFrame->client()) | 691 if (WebFrameClient* client = m_webFrame->client()) { |
678 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), | 692 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), |
679 WebVector<WebString>(removedSelectors)); | 693 WebVector<WebString>(removedSelectors)); |
| 694 } |
680 } | 695 } |
681 | 696 |
682 DocumentLoader* FrameLoaderClientImpl::createDocumentLoader( | 697 DocumentLoader* LocalFrameClientImpl::createDocumentLoader( |
683 LocalFrame* frame, | 698 LocalFrame* frame, |
684 const ResourceRequest& request, | 699 const ResourceRequest& request, |
685 const SubstituteData& data, | 700 const SubstituteData& data, |
686 ClientRedirectPolicy clientRedirectPolicy) { | 701 ClientRedirectPolicy clientRedirectPolicy) { |
687 DCHECK(frame); | 702 DCHECK(frame); |
688 | 703 |
689 WebDataSourceImpl* ds = | 704 WebDataSourceImpl* ds = |
690 WebDataSourceImpl::create(frame, request, data, clientRedirectPolicy); | 705 WebDataSourceImpl::create(frame, request, data, clientRedirectPolicy); |
691 if (m_webFrame->client()) | 706 if (m_webFrame->client()) |
692 m_webFrame->client()->didCreateDataSource(m_webFrame, ds); | 707 m_webFrame->client()->didCreateDataSource(m_webFrame, ds); |
693 return ds; | 708 return ds; |
694 } | 709 } |
695 | 710 |
696 String FrameLoaderClientImpl::userAgent() { | 711 String LocalFrameClientImpl::userAgent() { |
697 WebString override = | 712 WebString override = |
698 m_webFrame->client() ? m_webFrame->client()->userAgentOverride() : ""; | 713 m_webFrame->client() ? m_webFrame->client()->userAgentOverride() : ""; |
699 if (!override.isEmpty()) | 714 if (!override.isEmpty()) |
700 return override; | 715 return override; |
701 | 716 |
702 if (m_userAgent.isEmpty()) | 717 if (m_userAgent.isEmpty()) |
703 m_userAgent = Platform::current()->userAgent(); | 718 m_userAgent = Platform::current()->userAgent(); |
704 return m_userAgent; | 719 return m_userAgent; |
705 } | 720 } |
706 | 721 |
707 String FrameLoaderClientImpl::doNotTrackValue() { | 722 String LocalFrameClientImpl::doNotTrackValue() { |
708 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(); | 723 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(); |
709 if (!doNotTrack.isEmpty()) | 724 if (!doNotTrack.isEmpty()) |
710 return doNotTrack; | 725 return doNotTrack; |
711 return String(); | 726 return String(); |
712 } | 727 } |
713 | 728 |
714 // Called when the FrameLoader goes into a state in which a new page load | 729 // Called when the FrameLoader goes into a state in which a new page load |
715 // will occur. | 730 // will occur. |
716 void FrameLoaderClientImpl::transitionToCommittedForNewPage() { | 731 void LocalFrameClientImpl::transitionToCommittedForNewPage() { |
717 m_webFrame->createFrameView(); | 732 m_webFrame->createFrameView(); |
718 } | 733 } |
719 | 734 |
720 LocalFrame* FrameLoaderClientImpl::createFrame( | 735 LocalFrame* LocalFrameClientImpl::createFrame( |
721 const FrameLoadRequest& request, | 736 const FrameLoadRequest& request, |
722 const AtomicString& name, | 737 const AtomicString& name, |
723 HTMLFrameOwnerElement* ownerElement) { | 738 HTMLFrameOwnerElement* ownerElement) { |
724 return m_webFrame->createChildFrame(request, name, ownerElement); | 739 return m_webFrame->createChildFrame(request, name, ownerElement); |
725 } | 740 } |
726 | 741 |
727 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer( | 742 bool LocalFrameClientImpl::canCreatePluginWithoutRenderer( |
728 const String& mimeType) const { | 743 const String& mimeType) const { |
729 if (!m_webFrame->client()) | 744 if (!m_webFrame->client()) |
730 return false; | 745 return false; |
731 | 746 |
732 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); | 747 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); |
733 } | 748 } |
734 | 749 |
735 Widget* FrameLoaderClientImpl::createPlugin(HTMLPlugInElement* element, | 750 Widget* LocalFrameClientImpl::createPlugin(HTMLPlugInElement* element, |
736 const KURL& url, | 751 const KURL& url, |
737 const Vector<String>& paramNames, | 752 const Vector<String>& paramNames, |
738 const Vector<String>& paramValues, | 753 const Vector<String>& paramValues, |
739 const String& mimeType, | 754 const String& mimeType, |
740 bool loadManually, | 755 bool loadManually, |
741 DetachedPluginPolicy policy) { | 756 DetachedPluginPolicy policy) { |
742 if (!m_webFrame->client()) | 757 if (!m_webFrame->client()) |
743 return nullptr; | 758 return nullptr; |
744 | 759 |
745 WebPluginParams params; | 760 WebPluginParams params; |
746 params.url = url; | 761 params.url = url; |
747 params.mimeType = mimeType; | 762 params.mimeType = mimeType; |
748 params.attributeNames = paramNames; | 763 params.attributeNames = paramNames; |
749 params.attributeValues = paramValues; | 764 params.attributeValues = paramValues; |
750 params.loadManually = loadManually; | 765 params.loadManually = loadManually; |
751 | 766 |
752 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params); | 767 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params); |
753 if (!webPlugin) | 768 if (!webPlugin) |
754 return nullptr; | 769 return nullptr; |
755 | 770 |
756 // The container takes ownership of the WebPlugin. | 771 // The container takes ownership of the WebPlugin. |
757 WebPluginContainerImpl* container = | 772 WebPluginContainerImpl* container = |
758 WebPluginContainerImpl::create(element, webPlugin); | 773 WebPluginContainerImpl::create(element, webPlugin); |
759 | 774 |
760 if (!webPlugin->initialize(container)) | 775 if (!webPlugin->initialize(container)) |
761 return nullptr; | 776 return nullptr; |
762 | 777 |
763 if (policy != AllowDetachedPlugin && !element->layoutObject()) | 778 if (policy != AllowDetachedPlugin && !element->layoutObject()) |
764 return nullptr; | 779 return nullptr; |
765 | 780 |
766 return container; | 781 return container; |
767 } | 782 } |
768 | 783 |
769 std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( | 784 std::unique_ptr<WebMediaPlayer> LocalFrameClientImpl::createWebMediaPlayer( |
770 HTMLMediaElement& htmlMediaElement, | 785 HTMLMediaElement& htmlMediaElement, |
771 const WebMediaPlayerSource& source, | 786 const WebMediaPlayerSource& source, |
772 WebMediaPlayerClient* client) { | 787 WebMediaPlayerClient* client) { |
773 WebLocalFrameImpl* webFrame = | 788 WebLocalFrameImpl* webFrame = |
774 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame()); | 789 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame()); |
775 | 790 |
776 if (!webFrame || !webFrame->client()) | 791 if (!webFrame || !webFrame->client()) |
777 return nullptr; | 792 return nullptr; |
778 | 793 |
779 HTMLMediaElementEncryptedMedia& encryptedMedia = | 794 HTMLMediaElementEncryptedMedia& encryptedMedia = |
780 HTMLMediaElementEncryptedMedia::from(htmlMediaElement); | 795 HTMLMediaElementEncryptedMedia::from(htmlMediaElement); |
781 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); | 796 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); |
782 return WTF::wrapUnique(webFrame->client()->createMediaPlayer( | 797 return WTF::wrapUnique(webFrame->client()->createMediaPlayer( |
783 source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), | 798 source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), |
784 sinkId)); | 799 sinkId)); |
785 } | 800 } |
786 | 801 |
787 WebRemotePlaybackClient* FrameLoaderClientImpl::createWebRemotePlaybackClient( | 802 WebRemotePlaybackClient* LocalFrameClientImpl::createWebRemotePlaybackClient( |
788 HTMLMediaElement& htmlMediaElement) { | 803 HTMLMediaElement& htmlMediaElement) { |
789 return HTMLMediaElementRemotePlayback::remote(htmlMediaElement); | 804 return HTMLMediaElementRemotePlayback::remote(htmlMediaElement); |
790 } | 805 } |
791 | 806 |
792 ObjectContentType FrameLoaderClientImpl::getObjectContentType( | 807 ObjectContentType LocalFrameClientImpl::getObjectContentType( |
793 const KURL& url, | 808 const KURL& url, |
794 const String& explicitMimeType, | 809 const String& explicitMimeType, |
795 bool shouldPreferPlugInsForImages) { | 810 bool shouldPreferPlugInsForImages) { |
796 // This code is based on Apple's implementation from | 811 // This code is based on Apple's implementation from |
797 // WebCoreSupport/WebFrameBridge.mm. | 812 // WebCoreSupport/WebFrameBridge.mm. |
798 | 813 |
799 String mimeType = explicitMimeType; | 814 String mimeType = explicitMimeType; |
800 if (mimeType.isEmpty()) { | 815 if (mimeType.isEmpty()) { |
801 // Try to guess the MIME type based off the extension. | 816 // Try to guess the MIME type based off the extension. |
802 String filename = url.lastPathComponent(); | 817 String filename = url.lastPathComponent(); |
803 int extensionPos = filename.reverseFind('.'); | 818 int extensionPos = filename.reverseFind('.'); |
804 if (extensionPos >= 0) { | 819 if (extensionPos >= 0) { |
805 String extension = filename.substring(extensionPos + 1); | 820 String extension = filename.substring(extensionPos + 1); |
806 mimeType = MIMETypeRegistry::getWellKnownMIMETypeForExtension(extension); | 821 mimeType = MIMETypeRegistry::getWellKnownMIMETypeForExtension(extension); |
807 } | 822 } |
808 | 823 |
809 if (mimeType.isEmpty()) | 824 if (mimeType.isEmpty()) |
810 return ObjectContentFrame; | 825 return ObjectContentFrame; |
811 } | 826 } |
812 | 827 |
813 // If Chrome is started with the --disable-plugins switch, pluginData is 0. | 828 // If Chrome is started with the --disable-plugins switch, pluginData is 0. |
814 PluginData* pluginData = m_webFrame->frame()->pluginData(); | 829 PluginData* pluginData = m_webFrame->frame()->pluginData(); |
815 bool plugInSupportsMIMEType = | 830 bool plugInSupportsMIMEType = |
816 pluginData && pluginData->supportsMimeType(mimeType); | 831 pluginData && pluginData->supportsMimeType(mimeType); |
817 | 832 |
818 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) | 833 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { |
819 return shouldPreferPlugInsForImages && plugInSupportsMIMEType | 834 return shouldPreferPlugInsForImages && plugInSupportsMIMEType |
820 ? ObjectContentNetscapePlugin | 835 ? ObjectContentNetscapePlugin |
821 : ObjectContentImage; | 836 : ObjectContentImage; |
| 837 } |
822 | 838 |
823 if (plugInSupportsMIMEType) | 839 if (plugInSupportsMIMEType) |
824 return ObjectContentNetscapePlugin; | 840 return ObjectContentNetscapePlugin; |
825 | 841 |
826 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) | 842 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) |
827 return ObjectContentFrame; | 843 return ObjectContentFrame; |
828 | 844 |
829 return ObjectContentNone; | 845 return ObjectContentNone; |
830 } | 846 } |
831 | 847 |
832 WebCookieJar* FrameLoaderClientImpl::cookieJar() const { | 848 WebCookieJar* LocalFrameClientImpl::cookieJar() const { |
833 if (!m_webFrame->client()) | 849 if (!m_webFrame->client()) |
834 return 0; | 850 return 0; |
835 return m_webFrame->client()->cookieJar(); | 851 return m_webFrame->client()->cookieJar(); |
836 } | 852 } |
837 | 853 |
838 void FrameLoaderClientImpl::frameFocused() const { | 854 void LocalFrameClientImpl::frameFocused() const { |
839 if (m_webFrame->client()) | 855 if (m_webFrame->client()) |
840 m_webFrame->client()->frameFocused(); | 856 m_webFrame->client()->frameFocused(); |
841 } | 857 } |
842 | 858 |
843 void FrameLoaderClientImpl::didChangeName(const String& name, | 859 void LocalFrameClientImpl::didChangeName(const String& name, |
844 const String& uniqueName) { | 860 const String& uniqueName) { |
845 if (!m_webFrame->client()) | 861 if (!m_webFrame->client()) |
846 return; | 862 return; |
847 m_webFrame->client()->didChangeName(name, uniqueName); | 863 m_webFrame->client()->didChangeName(name, uniqueName); |
848 } | 864 } |
849 | 865 |
850 void FrameLoaderClientImpl::didEnforceInsecureRequestPolicy( | 866 void LocalFrameClientImpl::didEnforceInsecureRequestPolicy( |
851 WebInsecureRequestPolicy policy) { | 867 WebInsecureRequestPolicy policy) { |
852 if (!m_webFrame->client()) | 868 if (!m_webFrame->client()) |
853 return; | 869 return; |
854 m_webFrame->client()->didEnforceInsecureRequestPolicy(policy); | 870 m_webFrame->client()->didEnforceInsecureRequestPolicy(policy); |
855 } | 871 } |
856 | 872 |
857 void FrameLoaderClientImpl::didUpdateToUniqueOrigin() { | 873 void LocalFrameClientImpl::didUpdateToUniqueOrigin() { |
858 if (!m_webFrame->client()) | 874 if (!m_webFrame->client()) |
859 return; | 875 return; |
860 DCHECK(m_webFrame->getSecurityOrigin().isUnique()); | 876 DCHECK(m_webFrame->getSecurityOrigin().isUnique()); |
861 m_webFrame->client()->didUpdateToUniqueOrigin( | 877 m_webFrame->client()->didUpdateToUniqueOrigin( |
862 m_webFrame->getSecurityOrigin().isPotentiallyTrustworthy()); | 878 m_webFrame->getSecurityOrigin().isPotentiallyTrustworthy()); |
863 } | 879 } |
864 | 880 |
865 void FrameLoaderClientImpl::didChangeSandboxFlags(Frame* childFrame, | 881 void LocalFrameClientImpl::didChangeSandboxFlags(Frame* childFrame, |
866 SandboxFlags flags) { | 882 SandboxFlags flags) { |
867 if (!m_webFrame->client()) | 883 if (!m_webFrame->client()) |
868 return; | 884 return; |
869 m_webFrame->client()->didChangeSandboxFlags( | 885 m_webFrame->client()->didChangeSandboxFlags( |
870 WebFrame::fromFrame(childFrame), static_cast<WebSandboxFlags>(flags)); | 886 WebFrame::fromFrame(childFrame), static_cast<WebSandboxFlags>(flags)); |
871 } | 887 } |
872 | 888 |
873 void FrameLoaderClientImpl::didSetFeaturePolicyHeader( | 889 void LocalFrameClientImpl::didSetFeaturePolicyHeader( |
874 const WebParsedFeaturePolicyHeader& parsedHeader) { | 890 const WebParsedFeaturePolicyHeader& parsedHeader) { |
875 if (m_webFrame->client()) | 891 if (m_webFrame->client()) |
876 m_webFrame->client()->didSetFeaturePolicyHeader(parsedHeader); | 892 m_webFrame->client()->didSetFeaturePolicyHeader(parsedHeader); |
877 } | 893 } |
878 | 894 |
879 void FrameLoaderClientImpl::didAddContentSecurityPolicy( | 895 void LocalFrameClientImpl::didAddContentSecurityPolicy( |
880 const String& headerValue, | 896 const String& headerValue, |
881 ContentSecurityPolicyHeaderType type, | 897 ContentSecurityPolicyHeaderType type, |
882 ContentSecurityPolicyHeaderSource source, | 898 ContentSecurityPolicyHeaderSource source, |
883 const std::vector<WebContentSecurityPolicyPolicy>& policies) { | 899 const std::vector<WebContentSecurityPolicyPolicy>& policies) { |
884 if (m_webFrame->client()) { | 900 if (m_webFrame->client()) { |
885 m_webFrame->client()->didAddContentSecurityPolicy( | 901 m_webFrame->client()->didAddContentSecurityPolicy( |
886 headerValue, static_cast<WebContentSecurityPolicyType>(type), | 902 headerValue, static_cast<WebContentSecurityPolicyType>(type), |
887 static_cast<WebContentSecurityPolicySource>(source), policies); | 903 static_cast<WebContentSecurityPolicySource>(source), policies); |
888 } | 904 } |
889 } | 905 } |
890 | 906 |
891 void FrameLoaderClientImpl::didChangeFrameOwnerProperties( | 907 void LocalFrameClientImpl::didChangeFrameOwnerProperties( |
892 HTMLFrameElementBase* frameElement) { | 908 HTMLFrameElementBase* frameElement) { |
893 if (!m_webFrame->client()) | 909 if (!m_webFrame->client()) |
894 return; | 910 return; |
895 | 911 |
896 m_webFrame->client()->didChangeFrameOwnerProperties( | 912 m_webFrame->client()->didChangeFrameOwnerProperties( |
897 WebFrame::fromFrame(frameElement->contentFrame()), | 913 WebFrame::fromFrame(frameElement->contentFrame()), |
898 WebFrameOwnerProperties( | 914 WebFrameOwnerProperties( |
899 frameElement->browsingContextContainerName(), | 915 frameElement->browsingContextContainerName(), |
900 frameElement->scrollingMode(), frameElement->marginWidth(), | 916 frameElement->scrollingMode(), frameElement->marginWidth(), |
901 frameElement->marginHeight(), frameElement->allowFullscreen(), | 917 frameElement->marginHeight(), frameElement->allowFullscreen(), |
902 frameElement->allowPaymentRequest(), frameElement->csp(), | 918 frameElement->allowPaymentRequest(), frameElement->csp(), |
903 frameElement->delegatedPermissions())); | 919 frameElement->delegatedPermissions())); |
904 } | 920 } |
905 | 921 |
906 void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler( | 922 void LocalFrameClientImpl::dispatchWillStartUsingPeerConnectionHandler( |
907 WebRTCPeerConnectionHandler* handler) { | 923 WebRTCPeerConnectionHandler* handler) { |
908 m_webFrame->client()->willStartUsingPeerConnectionHandler(handler); | 924 m_webFrame->client()->willStartUsingPeerConnectionHandler(handler); |
909 } | 925 } |
910 | 926 |
911 bool FrameLoaderClientImpl::allowWebGL(bool enabledPerSettings) { | 927 bool LocalFrameClientImpl::allowWebGL(bool enabledPerSettings) { |
912 if (m_webFrame->client()) | 928 if (m_webFrame->client()) |
913 return m_webFrame->client()->allowWebGL(enabledPerSettings); | 929 return m_webFrame->client()->allowWebGL(enabledPerSettings); |
914 | 930 |
915 return enabledPerSettings; | 931 return enabledPerSettings; |
916 } | 932 } |
917 | 933 |
918 void FrameLoaderClientImpl::dispatchWillInsertBody() { | 934 void LocalFrameClientImpl::dispatchWillInsertBody() { |
919 if (m_webFrame->client()) | 935 if (m_webFrame->client()) |
920 m_webFrame->client()->willInsertBody(m_webFrame); | 936 m_webFrame->client()->willInsertBody(m_webFrame); |
921 } | 937 } |
922 | 938 |
923 std::unique_ptr<WebServiceWorkerProvider> | 939 std::unique_ptr<WebServiceWorkerProvider> |
924 FrameLoaderClientImpl::createServiceWorkerProvider() { | 940 LocalFrameClientImpl::createServiceWorkerProvider() { |
925 if (!m_webFrame->client()) | 941 if (!m_webFrame->client()) |
926 return nullptr; | 942 return nullptr; |
927 return WTF::wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); | 943 return WTF::wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); |
928 } | 944 } |
929 | 945 |
930 bool FrameLoaderClientImpl::isControlledByServiceWorker( | 946 bool LocalFrameClientImpl::isControlledByServiceWorker(DocumentLoader& loader) { |
931 DocumentLoader& loader) { | |
932 return m_webFrame->client() && | 947 return m_webFrame->client() && |
933 m_webFrame->client()->isControlledByServiceWorker( | 948 m_webFrame->client()->isControlledByServiceWorker( |
934 *WebDataSourceImpl::fromDocumentLoader(&loader)); | 949 *WebDataSourceImpl::fromDocumentLoader(&loader)); |
935 } | 950 } |
936 | 951 |
937 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader) { | 952 int64_t LocalFrameClientImpl::serviceWorkerID(DocumentLoader& loader) { |
938 if (!m_webFrame->client()) | 953 if (!m_webFrame->client()) |
939 return -1; | 954 return -1; |
940 return m_webFrame->client()->serviceWorkerID( | 955 return m_webFrame->client()->serviceWorkerID( |
941 *WebDataSourceImpl::fromDocumentLoader(&loader)); | 956 *WebDataSourceImpl::fromDocumentLoader(&loader)); |
942 } | 957 } |
943 | 958 |
944 SharedWorkerRepositoryClient* | 959 SharedWorkerRepositoryClient* |
945 FrameLoaderClientImpl::sharedWorkerRepositoryClient() { | 960 LocalFrameClientImpl::sharedWorkerRepositoryClient() { |
946 return m_webFrame->sharedWorkerRepositoryClient(); | 961 return m_webFrame->sharedWorkerRepositoryClient(); |
947 } | 962 } |
948 | 963 |
949 std::unique_ptr<WebApplicationCacheHost> | 964 std::unique_ptr<WebApplicationCacheHost> |
950 FrameLoaderClientImpl::createApplicationCacheHost( | 965 LocalFrameClientImpl::createApplicationCacheHost( |
951 WebApplicationCacheHostClient* client) { | 966 WebApplicationCacheHostClient* client) { |
952 if (!m_webFrame->client()) | 967 if (!m_webFrame->client()) |
953 return nullptr; | 968 return nullptr; |
954 return WTF::wrapUnique( | 969 return WTF::wrapUnique( |
955 m_webFrame->client()->createApplicationCacheHost(client)); | 970 m_webFrame->client()->createApplicationCacheHost(client)); |
956 } | 971 } |
957 | 972 |
958 void FrameLoaderClientImpl::dispatchDidChangeManifest() { | 973 void LocalFrameClientImpl::dispatchDidChangeManifest() { |
959 if (m_webFrame->client()) | 974 if (m_webFrame->client()) |
960 m_webFrame->client()->didChangeManifest(); | 975 m_webFrame->client()->didChangeManifest(); |
961 } | 976 } |
962 | 977 |
963 unsigned FrameLoaderClientImpl::backForwardLength() { | 978 unsigned LocalFrameClientImpl::backForwardLength() { |
964 WebViewImpl* webview = m_webFrame->viewImpl(); | 979 WebViewImpl* webview = m_webFrame->viewImpl(); |
965 if (!webview || !webview->client()) | 980 if (!webview || !webview->client()) |
966 return 0; | 981 return 0; |
967 return webview->client()->historyBackListCount() + 1 + | 982 return webview->client()->historyBackListCount() + 1 + |
968 webview->client()->historyForwardListCount(); | 983 webview->client()->historyForwardListCount(); |
969 } | 984 } |
970 | 985 |
971 void FrameLoaderClientImpl::suddenTerminationDisablerChanged( | 986 void LocalFrameClientImpl::suddenTerminationDisablerChanged( |
972 bool present, | 987 bool present, |
973 SuddenTerminationDisablerType type) { | 988 SuddenTerminationDisablerType type) { |
974 if (m_webFrame->client()) { | 989 if (m_webFrame->client()) { |
975 m_webFrame->client()->suddenTerminationDisablerChanged( | 990 m_webFrame->client()->suddenTerminationDisablerChanged( |
976 present, | 991 present, |
977 static_cast<WebFrameClient::SuddenTerminationDisablerType>(type)); | 992 static_cast<WebFrameClient::SuddenTerminationDisablerType>(type)); |
978 } | 993 } |
979 } | 994 } |
980 | 995 |
981 BlameContext* FrameLoaderClientImpl::frameBlameContext() { | 996 BlameContext* LocalFrameClientImpl::frameBlameContext() { |
982 if (!m_webFrame->client()) | 997 if (!m_webFrame->client()) |
983 return nullptr; | 998 return nullptr; |
984 return m_webFrame->client()->frameBlameContext(); | 999 return m_webFrame->client()->frameBlameContext(); |
985 } | 1000 } |
986 | 1001 |
987 LinkResource* FrameLoaderClientImpl::createServiceWorkerLinkResource( | 1002 LinkResource* LocalFrameClientImpl::createServiceWorkerLinkResource( |
988 HTMLLinkElement* owner) { | 1003 HTMLLinkElement* owner) { |
989 return ServiceWorkerLinkResource::create(owner); | 1004 return ServiceWorkerLinkResource::create(owner); |
990 } | 1005 } |
991 | 1006 |
992 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType() { | 1007 WebEffectiveConnectionType LocalFrameClientImpl::getEffectiveConnectionType() { |
993 if (m_webFrame->client()) | 1008 if (m_webFrame->client()) |
994 return m_webFrame->client()->getEffectiveConnectionType(); | 1009 return m_webFrame->client()->getEffectiveConnectionType(); |
995 return WebEffectiveConnectionType::TypeUnknown; | 1010 return WebEffectiveConnectionType::TypeUnknown; |
996 } | 1011 } |
997 | 1012 |
998 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() { | 1013 WebDevToolsAgentImpl* LocalFrameClientImpl::devToolsAgent() { |
999 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) | 1014 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) |
1000 ->devToolsAgentImpl(); | 1015 ->devToolsAgentImpl(); |
1001 } | 1016 } |
1002 | 1017 |
1003 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { | 1018 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { |
1004 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); | 1019 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); |
1005 } | 1020 } |
1006 | 1021 |
1007 void FrameLoaderClientImpl::setHasReceivedUserGesture() { | 1022 void LocalFrameClientImpl::setHasReceivedUserGesture() { |
1008 if (m_webFrame->client()) | 1023 if (m_webFrame->client()) |
1009 m_webFrame->client()->setHasReceivedUserGesture(); | 1024 m_webFrame->client()->setHasReceivedUserGesture(); |
1010 } | 1025 } |
1011 | 1026 |
1012 } // namespace blink | 1027 } // namespace blink |
OLD | NEW |