Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
106 #include "wtf/StringExtras.h" 107 #include "wtf/StringExtras.h"
107 #include "wtf/text/CString.h" 108 #include "wtf/text/CString.h"
108 #include "wtf/text/WTFString.h" 109 #include "wtf/text/WTFString.h"
110 #include <memory>
109 #include <v8.h> 111 #include <v8.h>
110 112
111 namespace blink { 113 namespace blink {
112 114
113 namespace { 115 namespace {
114 116
115 // Convenience helper for frame tree helpers in FrameClient to reduce the amount 117 // 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 118 // 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: 119 // 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(). 120 // 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
796 798
797 if (!webPlugin->initialize(container)) 799 if (!webPlugin->initialize(container))
798 return nullptr; 800 return nullptr;
799 801
800 if (policy != AllowDetachedPlugin && !element->layoutObject()) 802 if (policy != AllowDetachedPlugin && !element->layoutObject())
801 return nullptr; 803 return nullptr;
802 804
803 return container; 805 return container;
804 } 806 }
805 807
806 PassOwnPtr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer( 808 std::unique_ptr<WebMediaPlayer> FrameLoaderClientImpl::createWebMediaPlayer(
807 HTMLMediaElement& htmlMediaElement, 809 HTMLMediaElement& htmlMediaElement,
808 const WebMediaPlayerSource& source, 810 const WebMediaPlayerSource& source,
809 WebMediaPlayerClient* client) 811 WebMediaPlayerClient* client)
810 { 812 {
811 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame( 813 WebLocalFrameImpl* webFrame = WebLocalFrameImpl::fromFrame(
812 htmlMediaElement.document().frame()); 814 htmlMediaElement.document().frame());
813 815
814 if (!webFrame || !webFrame->client()) 816 if (!webFrame || !webFrame->client())
815 return nullptr; 817 return nullptr;
816 818
817 WebMediaSession* webMediaSession = nullptr; 819 WebMediaSession* webMediaSession = nullptr;
818 if (MediaSession* mediaSession = HTMLMediaElementMediaSession::session(htmlM ediaElement)) 820 if (MediaSession* mediaSession = HTMLMediaElementMediaSession::session(htmlM ediaElement))
819 webMediaSession = mediaSession->getWebMediaSession(); 821 webMediaSession = mediaSession->getWebMediaSession();
820 822
821 HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMe dia::from(htmlMediaElement); 823 HTMLMediaElementEncryptedMedia& encryptedMedia = HTMLMediaElementEncryptedMe dia::from(htmlMediaElement);
822 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement) ); 824 WebString sinkId(HTMLMediaElementAudioOutputDevice::sinkId(htmlMediaElement) );
823 return adoptPtr(webFrame->client()->createMediaPlayer(source, 825 return wrapUnique(webFrame->client()->createMediaPlayer(source,
824 client, &encryptedMedia, 826 client, &encryptedMedia,
825 encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession)); 827 encryptedMedia.contentDecryptionModule(), sinkId, webMediaSession));
826 } 828 }
827 829
828 PassOwnPtr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession() 830 std::unique_ptr<WebMediaSession> FrameLoaderClientImpl::createWebMediaSession()
829 { 831 {
830 if (!m_webFrame->client()) 832 if (!m_webFrame->client())
831 return nullptr; 833 return nullptr;
832 834
833 return adoptPtr(m_webFrame->client()->createMediaSession()); 835 return wrapUnique(m_webFrame->client()->createMediaSession());
834 } 836 }
835 837
836 ObjectContentType FrameLoaderClientImpl::getObjectContentType( 838 ObjectContentType FrameLoaderClientImpl::getObjectContentType(
837 const KURL& url, 839 const KURL& url,
838 const String& explicitMimeType, 840 const String& explicitMimeType,
839 bool shouldPreferPlugInsForImages) 841 bool shouldPreferPlugInsForImages)
840 { 842 {
841 // This code is based on Apple's implementation from 843 // This code is based on Apple's implementation from
842 // WebCoreSupport/WebFrameBridge.mm. 844 // WebCoreSupport/WebFrameBridge.mm.
843 845
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 958
957 return enabledPerSettings; 959 return enabledPerSettings;
958 } 960 }
959 961
960 void FrameLoaderClientImpl::dispatchWillInsertBody() 962 void FrameLoaderClientImpl::dispatchWillInsertBody()
961 { 963 {
962 if (m_webFrame->client()) 964 if (m_webFrame->client())
963 m_webFrame->client()->willInsertBody(m_webFrame); 965 m_webFrame->client()->willInsertBody(m_webFrame);
964 } 966 }
965 967
966 PassOwnPtr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWorkerP rovider() 968 std::unique_ptr<WebServiceWorkerProvider> FrameLoaderClientImpl::createServiceWo rkerProvider()
967 { 969 {
968 if (!m_webFrame->client()) 970 if (!m_webFrame->client())
969 return nullptr; 971 return nullptr;
970 return adoptPtr(m_webFrame->client()->createServiceWorkerProvider()); 972 return wrapUnique(m_webFrame->client()->createServiceWorkerProvider());
971 } 973 }
972 974
973 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader) 975 bool FrameLoaderClientImpl::isControlledByServiceWorker(DocumentLoader& loader)
974 { 976 {
975 return m_webFrame->client() && m_webFrame->client()->isControlledByServiceWo rker(*WebDataSourceImpl::fromDocumentLoader(&loader)); 977 return m_webFrame->client() && m_webFrame->client()->isControlledByServiceWo rker(*WebDataSourceImpl::fromDocumentLoader(&loader));
976 } 978 }
977 979
978 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader) 980 int64_t FrameLoaderClientImpl::serviceWorkerID(DocumentLoader& loader)
979 { 981 {
980 if (!m_webFrame->client()) 982 if (!m_webFrame->client())
981 return -1; 983 return -1;
982 return m_webFrame->client()->serviceWorkerID(*WebDataSourceImpl::fromDocumen tLoader(&loader)); 984 return m_webFrame->client()->serviceWorkerID(*WebDataSourceImpl::fromDocumen tLoader(&loader));
983 } 985 }
984 986
985 SharedWorkerRepositoryClient* FrameLoaderClientImpl::sharedWorkerRepositoryClien t() 987 SharedWorkerRepositoryClient* FrameLoaderClientImpl::sharedWorkerRepositoryClien t()
986 { 988 {
987 return m_webFrame->sharedWorkerRepositoryClient(); 989 return m_webFrame->sharedWorkerRepositoryClient();
988 } 990 }
989 991
990 PassOwnPtr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicationCach eHost(WebApplicationCacheHostClient* client) 992 std::unique_ptr<WebApplicationCacheHost> FrameLoaderClientImpl::createApplicatio nCacheHost(WebApplicationCacheHostClient* client)
991 { 993 {
992 if (!m_webFrame->client()) 994 if (!m_webFrame->client())
993 return nullptr; 995 return nullptr;
994 return adoptPtr(m_webFrame->client()->createApplicationCacheHost(client)); 996 return wrapUnique(m_webFrame->client()->createApplicationCacheHost(client));
995 } 997 }
996 998
997 void FrameLoaderClientImpl::dispatchDidChangeManifest() 999 void FrameLoaderClientImpl::dispatchDidChangeManifest()
998 { 1000 {
999 if (m_webFrame->client()) 1001 if (m_webFrame->client())
1000 m_webFrame->client()->didChangeManifest(); 1002 m_webFrame->client()->didChangeManifest();
1001 } 1003 }
1002 1004
1003 unsigned FrameLoaderClientImpl::backForwardLength() 1005 unsigned FrameLoaderClientImpl::backForwardLength()
1004 { 1006 {
(...skipping 24 matching lines...) Expand all
1029 } 1031 }
1030 1032
1031 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType() 1033 WebEffectiveConnectionType FrameLoaderClientImpl::getEffectiveConnectionType()
1032 { 1034 {
1033 if (m_webFrame->client()) 1035 if (m_webFrame->client())
1034 return m_webFrame->client()->getEffectiveConnectionType(); 1036 return m_webFrame->client()->getEffectiveConnectionType();
1035 return WebEffectiveConnectionType::TypeUnknown; 1037 return WebEffectiveConnectionType::TypeUnknown;
1036 } 1038 }
1037 1039
1038 } // namespace blink 1040 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/FrameLoaderClientImpl.h ('k') | third_party/WebKit/Source/web/FullscreenController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698