| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 #include "public/web/WebPlugin.h" | 92 #include "public/web/WebPlugin.h" |
| 93 #include "public/web/WebPluginParams.h" | 93 #include "public/web/WebPluginParams.h" |
| 94 #include "public/web/WebViewClient.h" | 94 #include "public/web/WebViewClient.h" |
| 95 #include "web/DevToolsEmulator.h" | 95 #include "web/DevToolsEmulator.h" |
| 96 #include "web/SharedWorkerRepositoryClientImpl.h" | 96 #include "web/SharedWorkerRepositoryClientImpl.h" |
| 97 #include "web/WebDataSourceImpl.h" | 97 #include "web/WebDataSourceImpl.h" |
| 98 #include "web/WebDevToolsAgentImpl.h" | 98 #include "web/WebDevToolsAgentImpl.h" |
| 99 #include "web/WebDevToolsFrontendImpl.h" | 99 #include "web/WebDevToolsFrontendImpl.h" |
| 100 #include "web/WebLocalFrameImpl.h" | 100 #include "web/WebLocalFrameImpl.h" |
| 101 #include "web/WebPluginContainerImpl.h" | 101 #include "web/WebPluginContainerImpl.h" |
| 102 #include "web/WebPluginLoadObserver.h" | |
| 103 #include "web/WebViewImpl.h" | 102 #include "web/WebViewImpl.h" |
| 104 #include "wtf/StringExtras.h" | 103 #include "wtf/StringExtras.h" |
| 105 #include "wtf/text/CString.h" | 104 #include "wtf/text/CString.h" |
| 106 #include "wtf/text/WTFString.h" | 105 #include "wtf/text/WTFString.h" |
| 107 #include <v8.h> | 106 #include <v8.h> |
| 108 | 107 |
| 109 namespace blink { | 108 namespace blink { |
| 110 | 109 |
| 111 namespace { | 110 namespace { |
| 112 | 111 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 if (m_webFrame->client()) | 486 if (m_webFrame->client()) |
| 488 m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryIte
m(item), static_cast<WebHistoryCommitType>(commitType)); | 487 m_webFrame->client()->didCommitProvisionalLoad(m_webFrame, WebHistoryIte
m(item), static_cast<WebHistoryCommitType>(commitType)); |
| 489 WebDevToolsAgentImpl* devToolsAgent = WebLocalFrameImpl::fromFrame(m_webFram
e->frame()->localFrameRoot())->devToolsAgentImpl(); | 488 WebDevToolsAgentImpl* devToolsAgent = WebLocalFrameImpl::fromFrame(m_webFram
e->frame()->localFrameRoot())->devToolsAgentImpl(); |
| 490 if (devToolsAgent) | 489 if (devToolsAgent) |
| 491 devToolsAgent->didCommitLoadForLocalFrame(m_webFrame->frame()); | 490 devToolsAgent->didCommitLoadForLocalFrame(m_webFrame->frame()); |
| 492 } | 491 } |
| 493 | 492 |
| 494 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( | 493 void FrameLoaderClientImpl::dispatchDidFailProvisionalLoad( |
| 495 const ResourceError& error, HistoryCommitType commitType) | 494 const ResourceError& error, HistoryCommitType commitType) |
| 496 { | 495 { |
| 497 OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_we
bFrame->frame()->loader().provisionalDocumentLoader()); | |
| 498 m_webFrame->didFail(error, true, commitType); | 496 m_webFrame->didFail(error, true, commitType); |
| 499 if (observer) | |
| 500 observer->didFailLoading(error); | |
| 501 } | 497 } |
| 502 | 498 |
| 503 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error, Hist
oryCommitType commitType) | 499 void FrameLoaderClientImpl::dispatchDidFailLoad(const ResourceError& error, Hist
oryCommitType commitType) |
| 504 { | 500 { |
| 505 OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_we
bFrame->frame()->loader().documentLoader()); | |
| 506 m_webFrame->didFail(error, false, commitType); | 501 m_webFrame->didFail(error, false, commitType); |
| 507 if (observer) | |
| 508 observer->didFailLoading(error); | |
| 509 | |
| 510 // Don't clear the redirect chain, this will happen in the middle of client | |
| 511 // redirects, and we need the context. The chain will be cleared when the | |
| 512 // provisional load succeeds or fails, not the "real" one. | |
| 513 } | 502 } |
| 514 | 503 |
| 515 void FrameLoaderClientImpl::dispatchDidFinishLoad() | 504 void FrameLoaderClientImpl::dispatchDidFinishLoad() |
| 516 { | 505 { |
| 517 OwnPtrWillBeRawPtr<WebPluginLoadObserver> observer = pluginLoadObserver(m_we
bFrame->frame()->loader().documentLoader()); | 506 m_webFrame->didFinish(); |
| 518 | |
| 519 if (m_webFrame->client()) | |
| 520 m_webFrame->client()->didFinishLoad(m_webFrame); | |
| 521 | |
| 522 if (observer) | |
| 523 observer->didFinishLoading(); | |
| 524 | |
| 525 // Don't clear the redirect chain, this will happen in the middle of client | |
| 526 // redirects, and we need the context. The chain will be cleared when the | |
| 527 // provisional load succeeds or fails, not the "real" one. | |
| 528 } | 507 } |
| 529 | 508 |
| 530 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() | 509 void FrameLoaderClientImpl::dispatchDidChangeThemeColor() |
| 531 { | 510 { |
| 532 if (m_webFrame->client()) | 511 if (m_webFrame->client()) |
| 533 m_webFrame->client()->didChangeThemeColor(); | 512 m_webFrame->client()->didChangeThemeColor(); |
| 534 } | 513 } |
| 535 | 514 |
| 536 static bool allowCreatingBackgroundTabs() | 515 static bool allowCreatingBackgroundTabs() |
| 537 { | 516 { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 855 |
| 877 if (plugInSupportsMIMEType) | 856 if (plugInSupportsMIMEType) |
| 878 return ObjectContentNetscapePlugin; | 857 return ObjectContentNetscapePlugin; |
| 879 | 858 |
| 880 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) | 859 if (MIMETypeRegistry::isSupportedNonImageMIMEType(mimeType)) |
| 881 return ObjectContentFrame; | 860 return ObjectContentFrame; |
| 882 | 861 |
| 883 return ObjectContentNone; | 862 return ObjectContentNone; |
| 884 } | 863 } |
| 885 | 864 |
| 886 PassOwnPtrWillBeRawPtr<WebPluginLoadObserver> FrameLoaderClientImpl::pluginLoadO
bserver(DocumentLoader* loader) | |
| 887 { | |
| 888 return WebDataSourceImpl::fromDocumentLoader(loader)->releasePluginLoadObser
ver(); | |
| 889 } | |
| 890 | |
| 891 WebCookieJar* FrameLoaderClientImpl::cookieJar() const | 865 WebCookieJar* FrameLoaderClientImpl::cookieJar() const |
| 892 { | 866 { |
| 893 if (!m_webFrame->client()) | 867 if (!m_webFrame->client()) |
| 894 return 0; | 868 return 0; |
| 895 return m_webFrame->client()->cookieJar(m_webFrame); | 869 return m_webFrame->client()->cookieJar(m_webFrame); |
| 896 } | 870 } |
| 897 | 871 |
| 898 bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( | 872 bool FrameLoaderClientImpl::willCheckAndDispatchMessageEvent( |
| 899 SecurityOrigin* target, MessageEvent* event, LocalFrame* sourceFrame) const | 873 SecurityOrigin* target, MessageEvent* event, LocalFrame* sourceFrame) const |
| 900 { | 874 { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 return m_webFrame->sharedWorkerRepositoryClient(); | 968 return m_webFrame->sharedWorkerRepositoryClient(); |
| 995 } | 969 } |
| 996 | 970 |
| 997 PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCach
eHost(WebApplicationCacheHostClient* client) | 971 PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCach
eHost(WebApplicationCacheHostClient* client) |
| 998 { | 972 { |
| 999 if (!m_webFrame->client()) | 973 if (!m_webFrame->client()) |
| 1000 return nullptr; | 974 return nullptr; |
| 1001 return adoptPtr(m_webFrame->client()->createApplicationCacheHost(m_webFrame,
client)); | 975 return adoptPtr(m_webFrame->client()->createApplicationCacheHost(m_webFrame,
client)); |
| 1002 } | 976 } |
| 1003 | 977 |
| 1004 void FrameLoaderClientImpl::didStopAllLoaders() | |
| 1005 { | |
| 1006 if (m_webFrame->client()) | |
| 1007 m_webFrame->client()->didAbortLoading(m_webFrame); | |
| 1008 } | |
| 1009 | |
| 1010 void FrameLoaderClientImpl::dispatchDidChangeManifest() | 978 void FrameLoaderClientImpl::dispatchDidChangeManifest() |
| 1011 { | 979 { |
| 1012 if (m_webFrame->client()) | 980 if (m_webFrame->client()) |
| 1013 m_webFrame->client()->didChangeManifest(m_webFrame); | 981 m_webFrame->client()->didChangeManifest(m_webFrame); |
| 1014 } | 982 } |
| 1015 | 983 |
| 1016 unsigned FrameLoaderClientImpl::backForwardLength() | 984 unsigned FrameLoaderClientImpl::backForwardLength() |
| 1017 { | 985 { |
| 1018 WebViewImpl* webview = m_webFrame->viewImpl(); | 986 WebViewImpl* webview = m_webFrame->viewImpl(); |
| 1019 if (!webview || !webview->client()) | 987 if (!webview || !webview->client()) |
| 1020 return 0; | 988 return 0; |
| 1021 return webview->client()->historyBackListCount() + 1 + webview->client()->hi
storyForwardListCount(); | 989 return webview->client()->historyBackListCount() + 1 + webview->client()->hi
storyForwardListCount(); |
| 1022 } | 990 } |
| 1023 | 991 |
| 1024 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde
nTerminationDisablerType type) | 992 void FrameLoaderClientImpl::suddenTerminationDisablerChanged(bool present, Sudde
nTerminationDisablerType type) |
| 1025 { | 993 { |
| 1026 if (m_webFrame->client()) { | 994 if (m_webFrame->client()) { |
| 1027 m_webFrame->client()->suddenTerminationDisablerChanged( | 995 m_webFrame->client()->suddenTerminationDisablerChanged( |
| 1028 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>(
type)); | 996 present, static_cast<WebFrameClient::SuddenTerminationDisablerType>(
type)); |
| 1029 } | 997 } |
| 1030 } | 998 } |
| 1031 | 999 |
| 1032 } // namespace blink | 1000 } // namespace blink |
| OLD | NEW |