Chromium Code Reviews| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 // FIXME: when extensions go out of process, this whole concept stops workin g. | 173 // FIXME: when extensions go out of process, this whole concept stops workin g. |
| 174 WebDevToolsFrontendImpl* devToolsFrontend = m_webFrame->top()->isWebLocalFra me() ? toWebLocalFrameImpl(m_webFrame->top())->devToolsFrontend() : nullptr; | 174 WebDevToolsFrontendImpl* devToolsFrontend = m_webFrame->top()->isWebLocalFra me() ? toWebLocalFrameImpl(m_webFrame->top())->devToolsFrontend() : nullptr; |
| 175 if (devToolsFrontend) | 175 if (devToolsFrontend) |
| 176 devToolsFrontend->didClearWindowObject(m_webFrame); | 176 devToolsFrontend->didClearWindowObject(m_webFrame); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void FrameLoaderClientImpl::documentElementAvailable() | 179 void FrameLoaderClientImpl::documentElementAvailable() |
| 180 { | 180 { |
| 181 if (m_webFrame->client()) | 181 if (m_webFrame->client()) |
| 182 m_webFrame->client()->didCreateDocumentElement(m_webFrame); | 182 m_webFrame->client()->didCreateDocumentElement(m_webFrame); |
| 183 | |
| 184 if (m_webFrame->parent()) | |
| 185 return; | |
| 186 | |
| 187 if (m_webFrame->viewImpl()) | |
| 188 m_webFrame->viewImpl()->mainFrameDocumentElementAvailable(); | |
| 189 } | 183 } |
| 190 | 184 |
| 191 void FrameLoaderClientImpl::runScriptsAtDocumentElementAvailable() | 185 void FrameLoaderClientImpl::runScriptsAtDocumentElementAvailable() |
| 192 { | 186 { |
| 193 if (m_webFrame->client()) | 187 if (m_webFrame->client()) |
| 194 m_webFrame->client()->runScriptsAtDocumentElementAvailable(m_webFrame); | 188 m_webFrame->client()->runScriptsAtDocumentElementAvailable(m_webFrame); |
| 195 // The callback might have deleted the frame, do not use |this|! | 189 // The callback might have deleted the frame, do not use |this|! |
| 196 } | 190 } |
| 197 | 191 |
| 198 void FrameLoaderClientImpl::runScriptsAtDocumentReady(bool documentIsEmpty) | 192 void FrameLoaderClientImpl::runScriptsAtDocumentReady(bool documentIsEmpty) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 229 if (m_webFrame->client()) | 223 if (m_webFrame->client()) |
| 230 m_webFrame->client()->didChangeScrollOffset(m_webFrame); | 224 m_webFrame->client()->didChangeScrollOffset(m_webFrame); |
| 231 } | 225 } |
| 232 | 226 |
| 233 void FrameLoaderClientImpl::didUpdateCurrentHistoryItem() | 227 void FrameLoaderClientImpl::didUpdateCurrentHistoryItem() |
| 234 { | 228 { |
| 235 if (m_webFrame->client()) | 229 if (m_webFrame->client()) |
| 236 m_webFrame->client()->didUpdateCurrentHistoryItem(); | 230 m_webFrame->client()->didUpdateCurrentHistoryItem(); |
| 237 } | 231 } |
| 238 | 232 |
| 239 // TODO(dglazkov): Can this be plumbing be streamlined out? | |
| 240 void FrameLoaderClientImpl::didRemoveAllPendingStylesheet() | |
| 241 { | |
| 242 if (m_webFrame->parent()) | |
| 243 return; | |
| 244 | |
| 245 if (WebViewImpl* webview = m_webFrame->viewImpl()) | |
| 246 webview->didRemoveAllPendingStylesheetsInMainFrameDocument(); | |
| 247 } | |
| 248 | |
| 249 bool FrameLoaderClientImpl::allowScript(bool enabledPerSettings) | 233 bool FrameLoaderClientImpl::allowScript(bool enabledPerSettings) |
| 250 { | 234 { |
| 251 if (m_webFrame->contentSettingsClient()) | 235 if (m_webFrame->contentSettingsClient()) |
| 252 return m_webFrame->contentSettingsClient()->allowScript(enabledPerSettin gs); | 236 return m_webFrame->contentSettingsClient()->allowScript(enabledPerSettin gs); |
| 253 | 237 |
| 254 return enabledPerSettings; | 238 return enabledPerSettings; |
| 255 } | 239 } |
| 256 | 240 |
| 257 bool FrameLoaderClientImpl::allowScriptFromSource(bool enabledPerSettings, const KURL& scriptURL) | 241 bool FrameLoaderClientImpl::allowScriptFromSource(bool enabledPerSettings, const KURL& scriptURL) |
| 258 { | 242 { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 // Called when a particular resource load completes | 415 // Called when a particular resource load completes |
| 432 void FrameLoaderClientImpl::dispatchDidFinishLoading(DocumentLoader* loader, | 416 void FrameLoaderClientImpl::dispatchDidFinishLoading(DocumentLoader* loader, |
| 433 unsigned long identifier) | 417 unsigned long identifier) |
| 434 { | 418 { |
| 435 if (m_webFrame->client()) | 419 if (m_webFrame->client()) |
| 436 m_webFrame->client()->didFinishResourceLoad(m_webFrame, identifier); | 420 m_webFrame->client()->didFinishResourceLoad(m_webFrame, identifier); |
| 437 } | 421 } |
| 438 | 422 |
| 439 void FrameLoaderClientImpl::dispatchDidFinishDocumentLoad() | 423 void FrameLoaderClientImpl::dispatchDidFinishDocumentLoad() |
| 440 { | 424 { |
| 441 if (!m_webFrame->parent()) { | |
| 442 if (WebViewImpl* webview = m_webFrame->viewImpl()) | |
| 443 webview->didFinishMainFrameDocumentLoad(); | |
| 444 } | |
| 445 | |
| 446 // TODO(dglazkov): Sadly, workers are WebFrameClients, and they can totally | 425 // TODO(dglazkov): Sadly, workers are WebFrameClients, and they can totally |
| 447 // destroy themselves when didFinishDocumentLoad is invoked, and in turn des troy | 426 // destroy themselves when didFinishDocumentLoad is invoked, and in turn des troy |
| 448 // the fake WebLocalFrame that they create, which means that you should not | 427 // the fake WebLocalFrame that they create, which means that you should not |
| 449 // put any code touching `this` after the two lines below. | 428 // put any code touching `this` after the two lines below. |
| 450 if (m_webFrame->client()) | 429 if (m_webFrame->client()) |
| 451 m_webFrame->client()->didFinishDocumentLoad(m_webFrame); | 430 m_webFrame->client()->didFinishDocumentLoad(m_webFrame); |
| 452 } | 431 } |
| 453 | 432 |
| 454 void FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache(const Resourc eRequest& request, const ResourceResponse& response) | 433 void FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache(const Resourc eRequest& request, const ResourceResponse& response) |
| 455 { | 434 { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 977 { | 956 { |
| 978 if (m_webFrame->client()) | 957 if (m_webFrame->client()) |
| 979 return m_webFrame->client()->allowWebGL(enabledPerSettings); | 958 return m_webFrame->client()->allowWebGL(enabledPerSettings); |
| 980 | 959 |
| 981 return enabledPerSettings; | 960 return enabledPerSettings; |
| 982 } | 961 } |
| 983 | 962 |
| 984 void FrameLoaderClientImpl::dispatchWillInsertBody() | 963 void FrameLoaderClientImpl::dispatchWillInsertBody() |
| 985 { | 964 { |
| 986 if (m_webFrame->client()) | 965 if (m_webFrame->client()) |
| 987 m_webFrame->client()->willInsertBody(m_webFrame); | 966 m_webFrame->client()->willInsertBody(m_webFrame); |
|
Bryan McQuade
2016/04/26 14:28:34
it's great that we're reducing the callbacks from
| |
| 988 | |
| 989 if (m_webFrame->parent()) | |
| 990 return; | |
| 991 | |
| 992 if (m_webFrame->viewImpl()) | |
| 993 m_webFrame->viewImpl()->willInsertMainFrameDocumentBody(); | |
| 994 } | 967 } |
| 995 | 968 |
| 996 PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerP rovider() | 969 PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerP rovider() |
| 997 { | 970 { |
| 998 if (!m_webFrame->client()) | 971 if (!m_webFrame->client()) |
| 999 return nullptr; | 972 return nullptr; |
| 1000 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); | 973 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); |
| 1001 } | 974 } |
| 1002 | 975 |
| 1003 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) | 976 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1052 return nullptr; | 1025 return nullptr; |
| 1053 return m_webFrame->client()->frameBlameContext(); | 1026 return m_webFrame->client()->frameBlameContext(); |
| 1054 } | 1027 } |
| 1055 | 1028 |
| 1056 LinkResource* FrameLoaderClientImpl::createServiceWorkerLinkResource(HTMLLinkEle ment* owner) | 1029 LinkResource* FrameLoaderClientImpl::createServiceWorkerLinkResource(HTMLLinkEle ment* owner) |
| 1057 { | 1030 { |
| 1058 return ServiceWorkerLinkResource::create(owner); | 1031 return ServiceWorkerLinkResource::create(owner); |
| 1059 } | 1032 } |
| 1060 | 1033 |
| 1061 } // namespace blink | 1034 } // namespace blink |
| OLD | NEW |