| 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 || |
| 468 (inputEvent->type() != WebInputEvent::RawKeyDown && | 481 (inputEvent->type() != WebInputEvent::MouseUp && |
| 469 inputEvent->type() != WebInputEvent::KeyDown) && | 482 (inputEvent->type() != WebInputEvent::RawKeyDown && |
| 470 inputEvent->type() != WebInputEvent::GestureTap)) | 483 inputEvent->type() != WebInputEvent::KeyDown) && |
| 484 inputEvent->type() != WebInputEvent::GestureTap)) |
| 471 return false; | 485 return false; |
| 472 | 486 |
| 473 unsigned short buttonNumber; | 487 unsigned short buttonNumber; |
| 474 if (WebInputEvent::isMouseEventType(inputEvent->type())) { | 488 if (WebInputEvent::isMouseEventType(inputEvent->type())) { |
| 475 const WebMouseEvent* mouseEvent = | 489 const WebMouseEvent* mouseEvent = |
| 476 static_cast<const WebMouseEvent*>(inputEvent); | 490 static_cast<const WebMouseEvent*>(inputEvent); |
| 477 | 491 |
| 478 switch (mouseEvent->button) { | 492 switch (mouseEvent->button) { |
| 479 case WebMouseEvent::Button::Left: | 493 case WebMouseEvent::Button::Left: |
| 480 buttonNumber = 0; | 494 buttonNumber = 0; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 497 bool alt = inputEvent->modifiers() & WebMouseEvent::AltKey; | 511 bool alt = inputEvent->modifiers() & WebMouseEvent::AltKey; |
| 498 bool meta = inputEvent->modifiers() & WebMouseEvent::MetaKey; | 512 bool meta = inputEvent->modifiers() & WebMouseEvent::MetaKey; |
| 499 | 513 |
| 500 NavigationPolicy userPolicy; | 514 NavigationPolicy userPolicy; |
| 501 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, | 515 if (!navigationPolicyFromMouseEvent(buttonNumber, ctrl, shift, alt, meta, |
| 502 &userPolicy)) | 516 &userPolicy)) |
| 503 return false; | 517 return false; |
| 504 return userPolicy == NavigationPolicyNewBackgroundTab; | 518 return userPolicy == NavigationPolicyNewBackgroundTab; |
| 505 } | 519 } |
| 506 | 520 |
| 507 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation( | 521 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation( |
| 508 const ResourceRequest& request, | 522 const ResourceRequest& request, |
| 509 DocumentLoader* loader, | 523 DocumentLoader* loader, |
| 510 NavigationType type, | 524 NavigationType type, |
| 511 NavigationPolicy policy, | 525 NavigationPolicy policy, |
| 512 bool replacesCurrentHistoryItem, | 526 bool replacesCurrentHistoryItem, |
| 513 bool isClientRedirect, | 527 bool isClientRedirect, |
| 514 HTMLFormElement* form) { | 528 HTMLFormElement* form) { |
| 515 if (!m_webFrame->client()) | 529 if (!m_webFrame->client()) |
| 516 return NavigationPolicyIgnore; | 530 return NavigationPolicyIgnore; |
| 517 | 531 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 navigationInfo.isCacheDisabled = | 569 navigationInfo.isCacheDisabled = |
| 556 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; | 570 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; |
| 557 if (form) | 571 if (form) |
| 558 navigationInfo.form = WebFormElement(form); | 572 navigationInfo.form = WebFormElement(form); |
| 559 | 573 |
| 560 WebNavigationPolicy webPolicy = | 574 WebNavigationPolicy webPolicy = |
| 561 m_webFrame->client()->decidePolicyForNavigation(navigationInfo); | 575 m_webFrame->client()->decidePolicyForNavigation(navigationInfo); |
| 562 return static_cast<NavigationPolicy>(webPolicy); | 576 return static_cast<NavigationPolicy>(webPolicy); |
| 563 } | 577 } |
| 564 | 578 |
| 565 void FrameLoaderClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) { | 579 void LocalFrameClientImpl::dispatchWillSendSubmitEvent(HTMLFormElement* form) { |
| 566 if (m_webFrame->client()) | 580 if (m_webFrame->client()) |
| 567 m_webFrame->client()->willSendSubmitEvent(WebFormElement(form)); | 581 m_webFrame->client()->willSendSubmitEvent(WebFormElement(form)); |
| 568 } | 582 } |
| 569 | 583 |
| 570 void FrameLoaderClientImpl::dispatchWillSubmitForm(HTMLFormElement* form) { | 584 void LocalFrameClientImpl::dispatchWillSubmitForm(HTMLFormElement* form) { |
| 571 if (m_webFrame->client()) | 585 if (m_webFrame->client()) |
| 572 m_webFrame->client()->willSubmitForm(WebFormElement(form)); | 586 m_webFrame->client()->willSubmitForm(WebFormElement(form)); |
| 573 } | 587 } |
| 574 | 588 |
| 575 void FrameLoaderClientImpl::didStartLoading(LoadStartType loadStartType) { | 589 void LocalFrameClientImpl::didStartLoading(LoadStartType loadStartType) { |
| 576 if (m_webFrame->client()) | 590 if (m_webFrame->client()) { |
| 577 m_webFrame->client()->didStartLoading(loadStartType == | 591 m_webFrame->client()->didStartLoading(loadStartType == |
| 578 NavigationToDifferentDocument); | 592 NavigationToDifferentDocument); |
| 593 } |
| 579 } | 594 } |
| 580 | 595 |
| 581 void FrameLoaderClientImpl::progressEstimateChanged(double progressEstimate) { | 596 void LocalFrameClientImpl::progressEstimateChanged(double progressEstimate) { |
| 582 if (m_webFrame->client()) | 597 if (m_webFrame->client()) |
| 583 m_webFrame->client()->didChangeLoadProgress(progressEstimate); | 598 m_webFrame->client()->didChangeLoadProgress(progressEstimate); |
| 584 } | 599 } |
| 585 | 600 |
| 586 void FrameLoaderClientImpl::didStopLoading() { | 601 void LocalFrameClientImpl::didStopLoading() { |
| 587 if (m_webFrame->client()) | 602 if (m_webFrame->client()) |
| 588 m_webFrame->client()->didStopLoading(); | 603 m_webFrame->client()->didStopLoading(); |
| 589 } | 604 } |
| 590 | 605 |
| 591 void FrameLoaderClientImpl::loadURLExternally(const ResourceRequest& request, | 606 void LocalFrameClientImpl::loadURLExternally(const ResourceRequest& request, |
| 592 NavigationPolicy policy, | 607 NavigationPolicy policy, |
| 593 const String& suggestedName, | 608 const String& suggestedName, |
| 594 bool shouldReplaceCurrentEntry) { | 609 bool shouldReplaceCurrentEntry) { |
| 595 if (!m_webFrame->client()) | 610 if (!m_webFrame->client()) |
| 596 return; | 611 return; |
| 597 DCHECK(m_webFrame->frame()->document()); | 612 DCHECK(m_webFrame->frame()->document()); |
| 598 Fullscreen::fullyExitFullscreen(*m_webFrame->frame()->document()); | 613 Fullscreen::fullyExitFullscreen(*m_webFrame->frame()->document()); |
| 599 m_webFrame->client()->loadURLExternally( | 614 m_webFrame->client()->loadURLExternally( |
| 600 WrappedResourceRequest(request), static_cast<WebNavigationPolicy>(policy), | 615 WrappedResourceRequest(request), static_cast<WebNavigationPolicy>(policy), |
| 601 suggestedName, shouldReplaceCurrentEntry); | 616 suggestedName, shouldReplaceCurrentEntry); |
| 602 } | 617 } |
| 603 | 618 |
| 604 void FrameLoaderClientImpl::loadErrorPage(int reason) { | 619 void LocalFrameClientImpl::loadErrorPage(int reason) { |
| 605 if (m_webFrame->client()) | 620 if (m_webFrame->client()) |
| 606 m_webFrame->client()->loadErrorPage(reason); | 621 m_webFrame->client()->loadErrorPage(reason); |
| 607 } | 622 } |
| 608 | 623 |
| 609 bool FrameLoaderClientImpl::navigateBackForward(int offset) const { | 624 bool LocalFrameClientImpl::navigateBackForward(int offset) const { |
| 610 WebViewImpl* webview = m_webFrame->viewImpl(); | 625 WebViewImpl* webview = m_webFrame->viewImpl(); |
| 611 if (!webview->client()) | 626 if (!webview->client()) |
| 612 return false; | 627 return false; |
| 613 | 628 |
| 614 DCHECK(offset); | 629 DCHECK(offset); |
| 615 if (offset > webview->client()->historyForwardListCount()) | 630 if (offset > webview->client()->historyForwardListCount()) |
| 616 return false; | 631 return false; |
| 617 if (offset < -webview->client()->historyBackListCount()) | 632 if (offset < -webview->client()->historyBackListCount()) |
| 618 return false; | 633 return false; |
| 619 webview->client()->navigateBackForwardSoon(offset); | 634 webview->client()->navigateBackForwardSoon(offset); |
| 620 return true; | 635 return true; |
| 621 } | 636 } |
| 622 | 637 |
| 623 void FrameLoaderClientImpl::didAccessInitialDocument() { | 638 void LocalFrameClientImpl::didAccessInitialDocument() { |
| 624 if (m_webFrame->client()) | 639 if (m_webFrame->client()) |
| 625 m_webFrame->client()->didAccessInitialDocument(); | 640 m_webFrame->client()->didAccessInitialDocument(); |
| 626 } | 641 } |
| 627 | 642 |
| 628 void FrameLoaderClientImpl::didDisplayInsecureContent() { | 643 void LocalFrameClientImpl::didDisplayInsecureContent() { |
| 629 if (m_webFrame->client()) | 644 if (m_webFrame->client()) |
| 630 m_webFrame->client()->didDisplayInsecureContent(); | 645 m_webFrame->client()->didDisplayInsecureContent(); |
| 631 } | 646 } |
| 632 | 647 |
| 633 void FrameLoaderClientImpl::didRunInsecureContent(SecurityOrigin* origin, | 648 void LocalFrameClientImpl::didRunInsecureContent(SecurityOrigin* origin, |
| 634 const KURL& insecureURL) { | 649 const KURL& insecureURL) { |
| 635 if (m_webFrame->client()) | 650 if (m_webFrame->client()) { |
| 636 m_webFrame->client()->didRunInsecureContent(WebSecurityOrigin(origin), | 651 m_webFrame->client()->didRunInsecureContent(WebSecurityOrigin(origin), |
| 637 insecureURL); | 652 insecureURL); |
| 653 } |
| 638 } | 654 } |
| 639 | 655 |
| 640 void FrameLoaderClientImpl::didDetectXSS(const KURL& insecureURL, | 656 void LocalFrameClientImpl::didDetectXSS(const KURL& insecureURL, |
| 641 bool didBlockEntirePage) { | 657 bool didBlockEntirePage) { |
| 642 if (m_webFrame->client()) | 658 if (m_webFrame->client()) |
| 643 m_webFrame->client()->didDetectXSS(insecureURL, didBlockEntirePage); | 659 m_webFrame->client()->didDetectXSS(insecureURL, didBlockEntirePage); |
| 644 } | 660 } |
| 645 | 661 |
| 646 void FrameLoaderClientImpl::didDispatchPingLoader(const KURL& url) { | 662 void LocalFrameClientImpl::didDispatchPingLoader(const KURL& url) { |
| 647 if (m_webFrame->client()) | 663 if (m_webFrame->client()) |
| 648 m_webFrame->client()->didDispatchPingLoader(url); | 664 m_webFrame->client()->didDispatchPingLoader(url); |
| 649 } | 665 } |
| 650 | 666 |
| 651 void FrameLoaderClientImpl::didDisplayContentWithCertificateErrors( | 667 void LocalFrameClientImpl::didDisplayContentWithCertificateErrors( |
| 652 const KURL& url) { | 668 const KURL& url) { |
| 653 if (m_webFrame->client()) | 669 if (m_webFrame->client()) |
| 654 m_webFrame->client()->didDisplayContentWithCertificateErrors(url); | 670 m_webFrame->client()->didDisplayContentWithCertificateErrors(url); |
| 655 } | 671 } |
| 656 | 672 |
| 657 void FrameLoaderClientImpl::didRunContentWithCertificateErrors( | 673 void LocalFrameClientImpl::didRunContentWithCertificateErrors(const KURL& url) { |
| 658 const KURL& url) { | |
| 659 if (m_webFrame->client()) | 674 if (m_webFrame->client()) |
| 660 m_webFrame->client()->didRunContentWithCertificateErrors(url); | 675 m_webFrame->client()->didRunContentWithCertificateErrors(url); |
| 661 } | 676 } |
| 662 | 677 |
| 663 void FrameLoaderClientImpl::didChangePerformanceTiming() { | 678 void LocalFrameClientImpl::didChangePerformanceTiming() { |
| 664 if (m_webFrame->client()) | 679 if (m_webFrame->client()) |
| 665 m_webFrame->client()->didChangePerformanceTiming(); | 680 m_webFrame->client()->didChangePerformanceTiming(); |
| 666 } | 681 } |
| 667 | 682 |
| 668 void FrameLoaderClientImpl::didObserveLoadingBehavior( | 683 void LocalFrameClientImpl::didObserveLoadingBehavior( |
| 669 WebLoadingBehaviorFlag behavior) { | 684 WebLoadingBehaviorFlag behavior) { |
| 670 if (m_webFrame->client()) | 685 if (m_webFrame->client()) |
| 671 m_webFrame->client()->didObserveLoadingBehavior(behavior); | 686 m_webFrame->client()->didObserveLoadingBehavior(behavior); |
| 672 } | 687 } |
| 673 | 688 |
| 674 void FrameLoaderClientImpl::selectorMatchChanged( | 689 void LocalFrameClientImpl::selectorMatchChanged( |
| 675 const Vector<String>& addedSelectors, | 690 const Vector<String>& addedSelectors, |
| 676 const Vector<String>& removedSelectors) { | 691 const Vector<String>& removedSelectors) { |
| 677 if (WebFrameClient* client = m_webFrame->client()) | 692 if (WebFrameClient* client = m_webFrame->client()) { |
| 678 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), | 693 client->didMatchCSS(m_webFrame, WebVector<WebString>(addedSelectors), |
| 679 WebVector<WebString>(removedSelectors)); | 694 WebVector<WebString>(removedSelectors)); |
| 695 } |
| 680 } | 696 } |
| 681 | 697 |
| 682 DocumentLoader* FrameLoaderClientImpl::createDocumentLoader( | 698 DocumentLoader* LocalFrameClientImpl::createDocumentLoader( |
| 683 LocalFrame* frame, | 699 LocalFrame* frame, |
| 684 const ResourceRequest& request, | 700 const ResourceRequest& request, |
| 685 const SubstituteData& data, | 701 const SubstituteData& data, |
| 686 ClientRedirectPolicy clientRedirectPolicy) { | 702 ClientRedirectPolicy clientRedirectPolicy) { |
| 687 DCHECK(frame); | 703 DCHECK(frame); |
| 688 | 704 |
| 689 WebDataSourceImpl* ds = | 705 WebDataSourceImpl* ds = |
| 690 WebDataSourceImpl::create(frame, request, data, clientRedirectPolicy); | 706 WebDataSourceImpl::create(frame, request, data, clientRedirectPolicy); |
| 691 if (m_webFrame->client()) | 707 if (m_webFrame->client()) |
| 692 m_webFrame->client()->didCreateDataSource(m_webFrame, ds); | 708 m_webFrame->client()->didCreateDataSource(m_webFrame, ds); |
| 693 return ds; | 709 return ds; |
| 694 } | 710 } |
| 695 | 711 |
| 696 String FrameLoaderClientImpl::userAgent() { | 712 String LocalFrameClientImpl::userAgent() { |
| 697 WebString override = | 713 WebString override = |
| 698 m_webFrame->client() ? m_webFrame->client()->userAgentOverride() : ""; | 714 m_webFrame->client() ? m_webFrame->client()->userAgentOverride() : ""; |
| 699 if (!override.isEmpty()) | 715 if (!override.isEmpty()) |
| 700 return override; | 716 return override; |
| 701 | 717 |
| 702 if (m_userAgent.isEmpty()) | 718 if (m_userAgent.isEmpty()) |
| 703 m_userAgent = Platform::current()->userAgent(); | 719 m_userAgent = Platform::current()->userAgent(); |
| 704 return m_userAgent; | 720 return m_userAgent; |
| 705 } | 721 } |
| 706 | 722 |
| 707 String FrameLoaderClientImpl::doNotTrackValue() { | 723 String LocalFrameClientImpl::doNotTrackValue() { |
| 708 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(); | 724 WebString doNotTrack = m_webFrame->client()->doNotTrackValue(); |
| 709 if (!doNotTrack.isEmpty()) | 725 if (!doNotTrack.isEmpty()) |
| 710 return doNotTrack; | 726 return doNotTrack; |
| 711 return String(); | 727 return String(); |
| 712 } | 728 } |
| 713 | 729 |
| 714 // Called when the FrameLoader goes into a state in which a new page load | 730 // Called when the FrameLoader goes into a state in which a new page load |
| 715 // will occur. | 731 // will occur. |
| 716 void FrameLoaderClientImpl::transitionToCommittedForNewPage() { | 732 void LocalFrameClientImpl::transitionToCommittedForNewPage() { |
| 717 m_webFrame->createFrameView(); | 733 m_webFrame->createFrameView(); |
| 718 } | 734 } |
| 719 | 735 |
| 720 LocalFrame* FrameLoaderClientImpl::createFrame( | 736 LocalFrame* LocalFrameClientImpl::createFrame( |
| 721 const FrameLoadRequest& request, | 737 const FrameLoadRequest& request, |
| 722 const AtomicString& name, | 738 const AtomicString& name, |
| 723 HTMLFrameOwnerElement* ownerElement) { | 739 HTMLFrameOwnerElement* ownerElement) { |
| 724 return m_webFrame->createChildFrame(request, name, ownerElement); | 740 return m_webFrame->createChildFrame(request, name, ownerElement); |
| 725 } | 741 } |
| 726 | 742 |
| 727 bool FrameLoaderClientImpl::canCreatePluginWithoutRenderer( | 743 bool LocalFrameClientImpl::canCreatePluginWithoutRenderer( |
| 728 const String& mimeType) const { | 744 const String& mimeType) const { |
| 729 if (!m_webFrame->client()) | 745 if (!m_webFrame->client()) |
| 730 return false; | 746 return false; |
| 731 | 747 |
| 732 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); | 748 return m_webFrame->client()->canCreatePluginWithoutRenderer(mimeType); |
| 733 } | 749 } |
| 734 | 750 |
| 735 Widget* FrameLoaderClientImpl::createPlugin(HTMLPlugInElement* element, | 751 Widget* LocalFrameClientImpl::createPlugin(HTMLPlugInElement* element, |
| 736 const KURL& url, | 752 const KURL& url, |
| 737 const Vector<String>& paramNames, | 753 const Vector<String>& paramNames, |
| 738 const Vector<String>& paramValues, | 754 const Vector<String>& paramValues, |
| 739 const String& mimeType, | 755 const String& mimeType, |
| 740 bool loadManually, | 756 bool loadManually, |
| 741 DetachedPluginPolicy policy) { | 757 DetachedPluginPolicy policy) { |
| 742 if (!m_webFrame->client()) | 758 if (!m_webFrame->client()) |
| 743 return nullptr; | 759 return nullptr; |
| 744 | 760 |
| 745 WebPluginParams params; | 761 WebPluginParams params; |
| 746 params.url = url; | 762 params.url = url; |
| 747 params.mimeType = mimeType; | 763 params.mimeType = mimeType; |
| 748 params.attributeNames = paramNames; | 764 params.attributeNames = paramNames; |
| 749 params.attributeValues = paramValues; | 765 params.attributeValues = paramValues; |
| 750 params.loadManually = loadManually; | 766 params.loadManually = loadManually; |
| 751 | 767 |
| 752 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params); | 768 WebPlugin* webPlugin = m_webFrame->client()->createPlugin(m_webFrame, params); |
| 753 if (!webPlugin) | 769 if (!webPlugin) |
| 754 return nullptr; | 770 return nullptr; |
| 755 | 771 |
| 756 // The container takes ownership of the WebPlugin. | 772 // The container takes ownership of the WebPlugin. |
| 757 WebPluginContainerImpl* container = | 773 WebPluginContainerImpl* container = |
| 758 WebPluginContainerImpl::create(element, webPlugin); | 774 WebPluginContainerImpl::create(element, webPlugin); |
| 759 | 775 |
| 760 if (!webPlugin->initialize(container)) | 776 if (!webPlugin->initialize(container)) |
| 761 return nullptr; | 777 return nullptr; |
| 762 | 778 |
| 763 if (policy != AllowDetachedPlugin && !element->layoutObject()) | 779 if (policy != AllowDetachedPlugin && !element->layoutObject()) |
| 764 return nullptr; | 780 return nullptr; |
| 765 | 781 |
| 766 return container; | 782 return container; |
| 767 } | 783 } |
| 768 | 784 |
| 769 std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( | 785 std::unique_ptr<WebMediaPlayer> LocalFrameClientImpl::createWebMediaPlayer( |
| 770 HTMLMediaElement& htmlMediaElement, | 786 HTMLMediaElement& htmlMediaElement, |
| 771 const WebMediaPlayerSource& source, | 787 const WebMediaPlayerSource& source, |
| 772 WebMediaPlayerClient* client) { | 788 WebMediaPlayerClient* client) { |
| 773 WebLocalFrameImpl* webFrame = | 789 WebLocalFrameImpl* webFrame = |
| 774 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame()); | 790 WebLocalFrameImpl::fromFrame(htmlMediaElement.document().frame()); |
| 775 | 791 |
| 776 if (!webFrame || !webFrame->client()) | 792 if (!webFrame || !webFrame->client()) |
| 777 return nullptr; | 793 return nullptr; |
| 778 | 794 |
| 779 HTMLMediaElementEncryptedMedia& encryptedMedia = | 795 HTMLMediaElementEncryptedMedia& encryptedMedia = |
| 780 HTMLMediaElementEncryptedMedia::from(htmlMediaElement); | 796 HTMLMediaElementEncryptedMedia::from(htmlMediaElement); |
| 781 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); | 797 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)); |
| 782 return WTF::wrapUnique(webFrame->client()->createMediaPlayer( | 798 return WTF::wrapUnique(webFrame->client()->createMediaPlayer( |
| 783 source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), | 799 source, client, &encryptedMedia, encryptedMedia.contentDecryptionModule(), |
| 784 sinkId)); | 800 sinkId)); |
| 785 } | 801 } |
| 786 | 802 |
| 787 WebRemotePlaybackClient* FrameLoaderClientImpl::createWebRemotePlaybackClient( | 803 WebRemotePlaybackClient* LocalFrameClientImpl::createWebRemotePlaybackClient( |
| 788 HTMLMediaElement& htmlMediaElement) { | 804 HTMLMediaElement& htmlMediaElement) { |
| 789 return HTMLMediaElementRemotePlayback::remote(htmlMediaElement); | 805 return HTMLMediaElementRemotePlayback::remote(htmlMediaElement); |
| 790 } | 806 } |
| 791 | 807 |
| 792 ObjectContentType FrameLoaderClientImpl::getObjectContentType( | 808 ObjectContentType LocalFrameClientImpl::getObjectContentType( |
| 793 const KURL& url, | 809 const KURL& url, |
| 794 const String& explicitMimeType, | 810 const String& explicitMimeType, |
| 795 bool shouldPreferPlugInsForImages) { | 811 bool shouldPreferPlugInsForImages) { |
| 796 // This code is based on Apple's implementation from | 812 // This code is based on Apple's implementation from |
| 797 // WebCoreSupport/WebFrameBridge.mm. | 813 // WebCoreSupport/WebFrameBridge.mm. |
| 798 | 814 |
| 799 String mimeType = explicitMimeType; | 815 String mimeType = explicitMimeType; |
| 800 if (mimeType.isEmpty()) { | 816 if (mimeType.isEmpty()) { |
| 801 // Try to guess the MIME type based off the extension. | 817 // Try to guess the MIME type based off the extension. |
| 802 String filename = url.lastPathComponent(); | 818 String filename = url.lastPathComponent(); |
| 803 int extensionPos = filename.reverseFind('.'); | 819 int extensionPos = filename.reverseFind('.'); |
| 804 if (extensionPos >= 0) { | 820 if (extensionPos >= 0) { |
| 805 String extension = filename.substring(extensionPos + 1); | 821 String extension = filename.substring(extensionPos + 1); |
| 806 mimeType = MIMETypeRegistry::getWellKnownMIMETypeForExtension(extension); | 822 mimeType = MIMETypeRegistry::getWellKnownMIMETypeForExtension(extension); |
| 807 } | 823 } |
| 808 | 824 |
| 809 if (mimeType.isEmpty()) | 825 if (mimeType.isEmpty()) |
| 810 return ObjectContentFrame; | 826 return ObjectContentFrame; |
| 811 } | 827 } |
| 812 | 828 |
| 813 // If Chrome is started with the --disable-plugins switch, pluginData is 0. | 829 // If Chrome is started with the --disable-plugins switch, pluginData is 0. |
| 814 PluginData* pluginData = m_webFrame->frame()->pluginData(); | 830 PluginData* pluginData = m_webFrame->frame()->pluginData(); |
| 815 bool plugInSupportsMIMEType = | 831 bool plugInSupportsMIMEType = |
| 816 pluginData && pluginData->supportsMimeType(mimeType); | 832 pluginData && pluginData->supportsMimeType(mimeType); |
| 817 | 833 |
| 818 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) | 834 if (MIMETypeRegistry::isSupportedImageMIMEType(mimeType)) { |
| 819 return shouldPreferPlugInsForImages && plugInSupportsMIMEType | 835 return shouldPreferPlugInsForImages && plugInSupportsMIMEType |
| 820 ? ObjectContentNetscapePlugin | 836 ? ObjectContentNetscapePlugin |
| 821 : ObjectContentImage; | 837 : ObjectContentImage; |
| 838 } |
| 822 | 839 |
| 823 if (plugInSupportsMIMEType) | 840 if (plugInSupportsMIMEType) |
| 824 return ObjectContentNetscapePlugin; | 841 return ObjectContentNetscapePlugin; |
| 825 | 842 |
| 826 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) | 843 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) |
| 827 return ObjectContentFrame; | 844 return ObjectContentFrame; |
| 828 | 845 |
| 829 return ObjectContentNone; | 846 return ObjectContentNone; |
| 830 } | 847 } |
| 831 | 848 |
| 832 WebCookieJar* FrameLoaderClientImpl::cookieJar() const { | 849 WebCookieJar* LocalFrameClientImpl::cookieJar() const { |
| 833 if (!m_webFrame->client()) | 850 if (!m_webFrame->client()) |
| 834 return 0; | 851 return 0; |
| 835 return m_webFrame->client()->cookieJar(); | 852 return m_webFrame->client()->cookieJar(); |
| 836 } | 853 } |
| 837 | 854 |
| 838 void FrameLoaderClientImpl::frameFocused() const { | 855 void LocalFrameClientImpl::frameFocused() const { |
| 839 if (m_webFrame->client()) | 856 if (m_webFrame->client()) |
| 840 m_webFrame->client()->frameFocused(); | 857 m_webFrame->client()->frameFocused(); |
| 841 } | 858 } |
| 842 | 859 |
| 843 void FrameLoaderClientImpl::didChangeName(const String& name, | 860 void LocalFrameClientImpl::didChangeName(const String& name, |
| 844 const String& uniqueName) { | 861 const String& uniqueName) { |
| 845 if (!m_webFrame->client()) | 862 if (!m_webFrame->client()) |
| 846 return; | 863 return; |
| 847 m_webFrame->client()->didChangeName(name, uniqueName); | 864 m_webFrame->client()->didChangeName(name, uniqueName); |
| 848 } | 865 } |
| 849 | 866 |
| 850 void FrameLoaderClientImpl::didEnforceInsecureRequestPolicy( | 867 void LocalFrameClientImpl::didEnforceInsecureRequestPolicy( |
| 851 WebInsecureRequestPolicy policy) { | 868 WebInsecureRequestPolicy policy) { |
| 852 if (!m_webFrame->client()) | 869 if (!m_webFrame->client()) |
| 853 return; | 870 return; |
| 854 m_webFrame->client()->didEnforceInsecureRequestPolicy(policy); | 871 m_webFrame->client()->didEnforceInsecureRequestPolicy(policy); |
| 855 } | 872 } |
| 856 | 873 |
| 857 void FrameLoaderClientImpl::didUpdateToUniqueOrigin() { | 874 void LocalFrameClientImpl::didUpdateToUniqueOrigin() { |
| 858 if (!m_webFrame->client()) | 875 if (!m_webFrame->client()) |
| 859 return; | 876 return; |
| 860 DCHECK(m_webFrame->getSecurityOrigin().isUnique()); | 877 DCHECK(m_webFrame->getSecurityOrigin().isUnique()); |
| 861 m_webFrame->client()->didUpdateToUniqueOrigin( | 878 m_webFrame->client()->didUpdateToUniqueOrigin( |
| 862 m_webFrame->getSecurityOrigin().isPotentiallyTrustworthy()); | 879 m_webFrame->getSecurityOrigin().isPotentiallyTrustworthy()); |
| 863 } | 880 } |
| 864 | 881 |
| 865 void FrameLoaderClientImpl::didChangeSandboxFlags(Frame* childFrame, | 882 void LocalFrameClientImpl::didChangeSandboxFlags(Frame* childFrame, |
| 866 SandboxFlags flags) { | 883 SandboxFlags flags) { |
| 867 if (!m_webFrame->client()) | 884 if (!m_webFrame->client()) |
| 868 return; | 885 return; |
| 869 m_webFrame->client()->didChangeSandboxFlags( | 886 m_webFrame->client()->didChangeSandboxFlags( |
| 870 WebFrame::fromFrame(childFrame), static_cast<WebSandboxFlags>(flags)); | 887 WebFrame::fromFrame(childFrame), static_cast<WebSandboxFlags>(flags)); |
| 871 } | 888 } |
| 872 | 889 |
| 873 void FrameLoaderClientImpl::didSetFeaturePolicyHeader( | 890 void LocalFrameClientImpl::didSetFeaturePolicyHeader( |
| 874 const WebParsedFeaturePolicyHeader& parsedHeader) { | 891 const WebParsedFeaturePolicyHeader& parsedHeader) { |
| 875 if (m_webFrame->client()) | 892 if (m_webFrame->client()) |
| 876 m_webFrame->client()->didSetFeaturePolicyHeader(parsedHeader); | 893 m_webFrame->client()->didSetFeaturePolicyHeader(parsedHeader); |
| 877 } | 894 } |
| 878 | 895 |
| 879 void FrameLoaderClientImpl::didAddContentSecurityPolicy( | 896 void LocalFrameClientImpl::didAddContentSecurityPolicy( |
| 880 const String& headerValue, | 897 const String& headerValue, |
| 881 ContentSecurityPolicyHeaderType type, | 898 ContentSecurityPolicyHeaderType type, |
| 882 ContentSecurityPolicyHeaderSource source, | 899 ContentSecurityPolicyHeaderSource source, |
| 883 const std::vector<WebContentSecurityPolicyPolicy>& policies) { | 900 const std::vector<WebContentSecurityPolicyPolicy>& policies) { |
| 884 if (m_webFrame->client()) { | 901 if (m_webFrame->client()) { |
| 885 m_webFrame->client()->didAddContentSecurityPolicy( | 902 m_webFrame->client()->didAddContentSecurityPolicy( |
| 886 headerValue, static_cast<WebContentSecurityPolicyType>(type), | 903 headerValue, static_cast<WebContentSecurityPolicyType>(type), |
| 887 static_cast<WebContentSecurityPolicySource>(source), policies); | 904 static_cast<WebContentSecurityPolicySource>(source), policies); |
| 888 } | 905 } |
| 889 } | 906 } |
| 890 | 907 |
| 891 void FrameLoaderClientImpl::didChangeFrameOwnerProperties( | 908 void LocalFrameClientImpl::didChangeFrameOwnerProperties( |
| 892 HTMLFrameElementBase* frameElement) { | 909 HTMLFrameElementBase* frameElement) { |
| 893 if (!m_webFrame->client()) | 910 if (!m_webFrame->client()) |
| 894 return; | 911 return; |
| 895 | 912 |
| 896 m_webFrame->client()->didChangeFrameOwnerProperties( | 913 m_webFrame->client()->didChangeFrameOwnerProperties( |
| 897 WebFrame::fromFrame(frameElement->contentFrame()), | 914 WebFrame::fromFrame(frameElement->contentFrame()), |
| 898 WebFrameOwnerProperties( | 915 WebFrameOwnerProperties( |
| 899 frameElement->browsingContextContainerName(), | 916 frameElement->browsingContextContainerName(), |
| 900 frameElement->scrollingMode(), frameElement->marginWidth(), | 917 frameElement->scrollingMode(), frameElement->marginWidth(), |
| 901 frameElement->marginHeight(), frameElement->allowFullscreen(), | 918 frameElement->marginHeight(), frameElement->allowFullscreen(), |
| 902 frameElement->allowPaymentRequest(), frameElement->csp(), | 919 frameElement->allowPaymentRequest(), frameElement->csp(), |
| 903 frameElement->delegatedPermissions(), | 920 frameElement->delegatedPermissions(), |
| 904 frameElement->allowedFeatures())); | 921 frameElement->allowedFeatures())); |
| 905 } | 922 } |
| 906 | 923 |
| 907 void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler( | 924 void LocalFrameClientImpl::dispatchWillStartUsingPeerConnectionHandler( |
| 908 WebRTCPeerConnectionHandler* handler) { | 925 WebRTCPeerConnectionHandler* handler) { |
| 909 m_webFrame->client()->willStartUsingPeerConnectionHandler(handler); | 926 m_webFrame->client()->willStartUsingPeerConnectionHandler(handler); |
| 910 } | 927 } |
| 911 | 928 |
| 912 bool FrameLoaderClientImpl::allowWebGL(bool enabledPerSettings) { | 929 bool LocalFrameClientImpl::allowWebGL(bool enabledPerSettings) { |
| 913 if (m_webFrame->client()) | 930 if (m_webFrame->client()) |
| 914 return m_webFrame->client()->allowWebGL(enabledPerSettings); | 931 return m_webFrame->client()->allowWebGL(enabledPerSettings); |
| 915 | 932 |
| 916 return enabledPerSettings; | 933 return enabledPerSettings; |
| 917 } | 934 } |
| 918 | 935 |
| 919 void FrameLoaderClientImpl::dispatchWillInsertBody() { | 936 void LocalFrameClientImpl::dispatchWillInsertBody() { |
| 920 if (m_webFrame->client()) | 937 if (m_webFrame->client()) |
| 921 m_webFrame->client()->willInsertBody(m_webFrame); | 938 m_webFrame->client()->willInsertBody(m_webFrame); |
| 922 } | 939 } |
| 923 | 940 |
| 924 std::unique_ptr<WebServiceWorkerProvider> | 941 std::unique_ptr<WebServiceWorkerProvider> |
| 925 FrameLoaderClientImpl::createServiceWorkerProvider() { | 942 LocalFrameClientImpl::createServiceWorkerProvider() { |
| 926 if (!m_webFrame->client()) | 943 if (!m_webFrame->client()) |
| 927 return nullptr; | 944 return nullptr; |
| 928 return WTF::wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); | 945 return WTF::wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); |
| 929 } | 946 } |
| 930 | 947 |
| 931 bool FrameLoaderClientImpl::isControlledByServiceWorker( | 948 bool LocalFrameClientImpl::isControlledByServiceWorker(DocumentLoader& loader) { |
| 932 DocumentLoader& loader) { | |
| 933 return m_webFrame->client() && | 949 return m_webFrame->client() && |
| 934 m_webFrame->client()->isControlledByServiceWorker( | 950 m_webFrame->client()->isControlledByServiceWorker( |
| 935 *WebDataSourceImpl::fromDocumentLoader(&loader)); | 951 *WebDataSourceImpl::fromDocumentLoader(&loader)); |
| 936 } | 952 } |
| 937 | 953 |
| 938 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader) { | 954 int64_t LocalFrameClientImpl::serviceWorkerID(DocumentLoader& loader) { |
| 939 if (!m_webFrame->client()) | 955 if (!m_webFrame->client()) |
| 940 return -1; | 956 return -1; |
| 941 return m_webFrame->client()->serviceWorkerID( | 957 return m_webFrame->client()->serviceWorkerID( |
| 942 *WebDataSourceImpl::fromDocumentLoader(&loader)); | 958 *WebDataSourceImpl::fromDocumentLoader(&loader)); |
| 943 } | 959 } |
| 944 | 960 |
| 945 SharedWorkerRepositoryClient* | 961 SharedWorkerRepositoryClient* |
| 946 FrameLoaderClientImpl::sharedWorkerRepositoryClient() { | 962 LocalFrameClientImpl::sharedWorkerRepositoryClient() { |
| 947 return m_webFrame->sharedWorkerRepositoryClient(); | 963 return m_webFrame->sharedWorkerRepositoryClient(); |
| 948 } | 964 } |
| 949 | 965 |
| 950 std::unique_ptr<WebApplicationCacheHost> | 966 std::unique_ptr<WebApplicationCacheHost> |
| 951 FrameLoaderClientImpl::createApplicationCacheHost( | 967 LocalFrameClientImpl::createApplicationCacheHost( |
| 952 WebApplicationCacheHostClient* client) { | 968 WebApplicationCacheHostClient* client) { |
| 953 if (!m_webFrame->client()) | 969 if (!m_webFrame->client()) |
| 954 return nullptr; | 970 return nullptr; |
| 955 return WTF::wrapUnique( | 971 return WTF::wrapUnique( |
| 956 m_webFrame->client()->createApplicationCacheHost(client)); | 972 m_webFrame->client()->createApplicationCacheHost(client)); |
| 957 } | 973 } |
| 958 | 974 |
| 959 void FrameLoaderClientImpl::dispatchDidChangeManifest() { | 975 void LocalFrameClientImpl::dispatchDidChangeManifest() { |
| 960 if (m_webFrame->client()) | 976 if (m_webFrame->client()) |
| 961 m_webFrame->client()->didChangeManifest(); | 977 m_webFrame->client()->didChangeManifest(); |
| 962 } | 978 } |
| 963 | 979 |
| 964 unsigned FrameLoaderClientImpl::backForwardLength() { | 980 unsigned LocalFrameClientImpl::backForwardLength() { |
| 965 WebViewImpl* webview = m_webFrame->viewImpl(); | 981 WebViewImpl* webview = m_webFrame->viewImpl(); |
| 966 if (!webview || !webview->client()) | 982 if (!webview || !webview->client()) |
| 967 return 0; | 983 return 0; |
| 968 return webview->client()->historyBackListCount() + 1 + | 984 return webview->client()->historyBackListCount() + 1 + |
| 969 webview->client()->historyForwardListCount(); | 985 webview->client()->historyForwardListCount(); |
| 970 } | 986 } |
| 971 | 987 |
| 972 void FrameLoaderClientImpl::suddenTerminationDisablerChanged( | 988 void LocalFrameClientImpl::suddenTerminationDisablerChanged( |
| 973 bool present, | 989 bool present, |
| 974 SuddenTerminationDisablerType type) { | 990 SuddenTerminationDisablerType type) { |
| 975 if (m_webFrame->client()) { | 991 if (m_webFrame->client()) { |
| 976 m_webFrame->client()->suddenTerminationDisablerChanged( | 992 m_webFrame->client()->suddenTerminationDisablerChanged( |
| 977 present, | 993 present, |
| 978 static_cast<WebFrameClient::SuddenTerminationDisablerType>(type)); | 994 static_cast<WebFrameClient::SuddenTerminationDisablerType>(type)); |
| 979 } | 995 } |
| 980 } | 996 } |
| 981 | 997 |
| 982 BlameContext* FrameLoaderClientImpl::frameBlameContext() { | 998 BlameContext* LocalFrameClientImpl::frameBlameContext() { |
| 983 if (!m_webFrame->client()) | 999 if (!m_webFrame->client()) |
| 984 return nullptr; | 1000 return nullptr; |
| 985 return m_webFrame->client()->frameBlameContext(); | 1001 return m_webFrame->client()->frameBlameContext(); |
| 986 } | 1002 } |
| 987 | 1003 |
| 988 LinkResource* FrameLoaderClientImpl::createServiceWorkerLinkResource( | 1004 LinkResource* LocalFrameClientImpl::createServiceWorkerLinkResource( |
| 989 HTMLLinkElement* owner) { | 1005 HTMLLinkElement* owner) { |
| 990 return ServiceWorkerLinkResource::create(owner); | 1006 return ServiceWorkerLinkResource::create(owner); |
| 991 } | 1007 } |
| 992 | 1008 |
| 993 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType() { | 1009 WebEffectiveConnectionType LocalFrameClientImpl::getEffectiveConnectionType() { |
| 994 if (m_webFrame->client()) | 1010 if (m_webFrame->client()) |
| 995 return m_webFrame->client()->getEffectiveConnectionType(); | 1011 return m_webFrame->client()->getEffectiveConnectionType(); |
| 996 return WebEffectiveConnectionType::TypeUnknown; | 1012 return WebEffectiveConnectionType::TypeUnknown; |
| 997 } | 1013 } |
| 998 | 1014 |
| 999 WebDevToolsAgentImpl* FrameLoaderClientImpl::devToolsAgent() { | 1015 WebDevToolsAgentImpl* LocalFrameClientImpl::devToolsAgent() { |
| 1000 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) | 1016 return WebLocalFrameImpl::fromFrame(m_webFrame->frame()->localFrameRoot()) |
| 1001 ->devToolsAgentImpl(); | 1017 ->devToolsAgentImpl(); |
| 1002 } | 1018 } |
| 1003 | 1019 |
| 1004 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { | 1020 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { |
| 1005 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); | 1021 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); |
| 1006 } | 1022 } |
| 1007 | 1023 |
| 1008 void FrameLoaderClientImpl::setHasReceivedUserGesture() { | 1024 void LocalFrameClientImpl::setHasReceivedUserGesture() { |
| 1009 if (m_webFrame->client()) | 1025 if (m_webFrame->client()) |
| 1010 m_webFrame->client()->setHasReceivedUserGesture(); | 1026 m_webFrame->client()->setHasReceivedUserGesture(); |
| 1011 } | 1027 } |
| 1012 | 1028 |
| 1013 } // namespace blink | 1029 } // namespace blink |
| OLD | NEW |