| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 #include "public/web/WebPluginParams.h" | 96 #include "public/web/WebPluginParams.h" |
| 97 #include "public/web/WebViewClient.h" | 97 #include "public/web/WebViewClient.h" |
| 98 #include "web/DevToolsEmulator.h" | 98 #include "web/DevToolsEmulator.h" |
| 99 #include "web/SharedWorkerRepositoryClientImpl.h" | 99 #include "web/SharedWorkerRepositoryClientImpl.h" |
| 100 #include "web/WebDataSourceImpl.h" | 100 #include "web/WebDataSourceImpl.h" |
| 101 #include "web/WebDevToolsAgentImpl.h" | 101 #include "web/WebDevToolsAgentImpl.h" |
| 102 #include "web/WebDevToolsFrontendImpl.h" | 102 #include "web/WebDevToolsFrontendImpl.h" |
| 103 #include "web/WebLocalFrameImpl.h" | 103 #include "web/WebLocalFrameImpl.h" |
| 104 #include "web/WebPluginContainerImpl.h" | 104 #include "web/WebPluginContainerImpl.h" |
| 105 #include "web/WebViewImpl.h" | 105 #include "web/WebViewImpl.h" |
| 106 #include "wtf/PtrUtil.h" | |
| 107 #include "wtf/StringExtras.h" | 106 #include "wtf/StringExtras.h" |
| 108 #include "wtf/text/CString.h" | 107 #include "wtf/text/CString.h" |
| 109 #include "wtf/text/WTFString.h" | 108 #include "wtf/text/WTFString.h" |
| 110 #include <memory> | |
| 111 #include <v8.h> | 109 #include <v8.h> |
| 112 | 110 |
| 113 namespace blink { | 111 namespace blink { |
| 114 | 112 |
| 115 namespace { | 113 namespace { |
| 116 | 114 |
| 117 // Convenience helper for frame tree helpers in FrameClient to reduce the amount | 115 // Convenience helper for frame tree helpers in FrameClient to reduce the amount |
| 118 // of null-checking boilerplate code. Since the frame tree is maintained in the | 116 // of null-checking boilerplate code. Since the frame tree is maintained in the |
| 119 // web/ layer, the frame tree helpers often have to deal with null WebFrames: | 117 // web/ layer, the frame tree helpers often have to deal with null WebFrames: |
| 120 // for example, a frame with no parent will return null for WebFrame::parent(). | 118 // for example, a frame with no parent will return null for WebFrame::parent(). |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 | 796 |
| 799 if (!webPlugin->initialize(container)) | 797 if (!webPlugin->initialize(container)) |
| 800 return nullptr; | 798 return nullptr; |
| 801 | 799 |
| 802 if (policy != AllowDetachedPlugin && !element->layoutObject()) | 800 if (policy != AllowDetachedPlugin && !element->layoutObject()) |
| 803 return nullptr; | 801 return nullptr; |
| 804 | 802 |
| 805 return container; | 803 return container; |
| 806 } | 804 } |
| 807 | 805 |
| 808 std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( | 806 PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( |
| 809 HTMLMediaElement& htmlMediaElement, | 807 HTMLMediaElement& htmlMediaElement, |
| 810 const WebMediaPlayerSource& source, | 808 const WebMediaPlayerSource& source, |
| 811 WebMediaPlayerClient* client) | 809 WebMediaPlayerClient* client) |
| 812 { | 810 { |
| 813 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame( | 811 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame( |
| 814 htmlMediaElement.document().frame()); | 812 htmlMediaElement.document().frame()); |
| 815 | 813 |
| 816 if (!webFrame || !webFrame->client()) | 814 if (!webFrame || !webFrame->client()) |
| 817 return nullptr; | 815 return nullptr; |
| 818 | 816 |
| 819 WebMediaSession* webMediaSession = nullptr; | 817 WebMediaSession* webMediaSession = nullptr; |
| 820 if (MediaSession* mediaSession = HTMLMediaElementMediaSession::session(htmlM
ediaElement)) | 818 if (MediaSession* mediaSession = HTMLMediaElementMediaSession::session(htmlM
ediaElement)) |
| 821 webMediaSession = mediaSession->getWebMediaSession(); | 819 webMediaSession = mediaSession->getWebMediaSession(); |
| 822 | 820 |
| 823 HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMe
dia::from(htmlMediaElement); | 821 HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMe
dia::from(htmlMediaElement); |
| 824 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)
); | 822 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement)
); |
| 825 return wrapUnique(webFrame->client()->createMediaPlayer(source, | 823 return adoptPtr(webFrame->client()->createMediaPlayer(source, |
| 826 client, &encryptedMedia, | 824 client, &encryptedMedia, |
| 827 encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession)); | 825 encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession)); |
| 828 } | 826 } |
| 829 | 827 |
| 830 std::unique_ptr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() | 828 PassOwnPtr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() |
| 831 { | 829 { |
| 832 if (!m_webFrame->client()) | 830 if (!m_webFrame->client()) |
| 833 return nullptr; | 831 return nullptr; |
| 834 | 832 |
| 835 return wrapUnique(m_webFrame->client()->createMediaSession()); | 833 return adoptPtr(m_webFrame->client()->createMediaSession()); |
| 836 } | 834 } |
| 837 | 835 |
| 838 ObjectContentType FrameLoaderClientImpl::getObjectContentType( | 836 ObjectContentType FrameLoaderClientImpl::getObjectContentType( |
| 839 const KURL& url, | 837 const KURL& url, |
| 840 const String& explicitMimeType, | 838 const String& explicitMimeType, |
| 841 bool shouldPreferPlugInsForImages) | 839 bool shouldPreferPlugInsForImages) |
| 842 { | 840 { |
| 843 // This code is based on Apple's implementation from | 841 // This code is based on Apple's implementation from |
| 844 // WebCoreSupport/WebFrameBridge.mm. | 842 // WebCoreSupport/WebFrameBridge.mm. |
| 845 | 843 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 | 956 |
| 959 return enabledPerSettings; | 957 return enabledPerSettings; |
| 960 } | 958 } |
| 961 | 959 |
| 962 void FrameLoaderClientImpl::dispatchWillInsertBody() | 960 void FrameLoaderClientImpl::dispatchWillInsertBody() |
| 963 { | 961 { |
| 964 if (m_webFrame->client()) | 962 if (m_webFrame->client()) |
| 965 m_webFrame->client()->willInsertBody(m_webFrame); | 963 m_webFrame->client()->willInsertBody(m_webFrame); |
| 966 } | 964 } |
| 967 | 965 |
| 968 std::unique_ptr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWo
rkerProvider() | 966 PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerP
rovider() |
| 969 { | 967 { |
| 970 if (!m_webFrame->client()) | 968 if (!m_webFrame->client()) |
| 971 return nullptr; | 969 return nullptr; |
| 972 return wrapUnique(m_webFrame->client()->createServiceWorkerProvider()); | 970 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); |
| 973 } | 971 } |
| 974 | 972 |
| 975 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) | 973 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) |
| 976 { | 974 { |
| 977 return m_webFrame->client() && m_webFrame->client()->isControlledByServiceWo
rker(*WebDataSourceImpl::fromDocumentLoader(&loader)); | 975 return m_webFrame->client() && m_webFrame->client()->isControlledByServiceWo
rker(*WebDataSourceImpl::fromDocumentLoader(&loader)); |
| 978 } | 976 } |
| 979 | 977 |
| 980 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader) | 978 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader) |
| 981 { | 979 { |
| 982 if (!m_webFrame->client()) | 980 if (!m_webFrame->client()) |
| 983 return -1; | 981 return -1; |
| 984 return m_webFrame->client()->serviceWorkerID(*WebDataSourceImpl::fromDocumen
tLoader(&loader)); | 982 return m_webFrame->client()->serviceWorkerID(*WebDataSourceImpl::fromDocumen
tLoader(&loader)); |
| 985 } | 983 } |
| 986 | 984 |
| 987 SharedWorkerRepositoryClient* FrameLoaderClientImpl::sharedWorkerRepositoryClien
t() | 985 SharedWorkerRepositoryClient* FrameLoaderClientImpl::sharedWorkerRepositoryClien
t() |
| 988 { | 986 { |
| 989 return m_webFrame->sharedWorkerRepositoryClient(); | 987 return m_webFrame->sharedWorkerRepositoryClient(); |
| 990 } | 988 } |
| 991 | 989 |
| 992 std::unique_ptr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicatio
nCacheHost(WebApplicationCacheHostClient* client) | 990 PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCach
eHost(WebApplicationCacheHostClient* client) |
| 993 { | 991 { |
| 994 if (!m_webFrame->client()) | 992 if (!m_webFrame->client()) |
| 995 return nullptr; | 993 return nullptr; |
| 996 return wrapUnique(m_webFrame->client()->createApplicationCacheHost(client)); | 994 return adoptPtr(m_webFrame->client()->createApplicationCacheHost(client)); |
| 997 } | 995 } |
| 998 | 996 |
| 999 void FrameLoaderClientImpl::dispatchDidChangeManifest() | 997 void FrameLoaderClientImpl::dispatchDidChangeManifest() |
| 1000 { | 998 { |
| 1001 if (m_webFrame->client()) | 999 if (m_webFrame->client()) |
| 1002 m_webFrame->client()->didChangeManifest(); | 1000 m_webFrame->client()->didChangeManifest(); |
| 1003 } | 1001 } |
| 1004 | 1002 |
| 1005 unsigned FrameLoaderClientImpl::backForwardLength() | 1003 unsigned FrameLoaderClientImpl::backForwardLength() |
| 1006 { | 1004 { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1031 } | 1029 } |
| 1032 | 1030 |
| 1033 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType() | 1031 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType() |
| 1034 { | 1032 { |
| 1035 if (m_webFrame->client()) | 1033 if (m_webFrame->client()) |
| 1036 return m_webFrame->client()->getEffectiveConnectionType(); | 1034 return m_webFrame->client()->getEffectiveConnectionType(); |
| 1037 return WebEffectiveConnectionType::TypeUnknown; | 1035 return WebEffectiveConnectionType::TypeUnknown; |
| 1038 } | 1036 } |
| 1039 | 1037 |
| 1040 } // namespace blink | 1038 } // namespace blink |
| OLD | NEW |