Changeset 166186 in webkit
- Timestamp:
- Mar 24, 2014 12:44:35 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r166182 r166186 1 2014-03-24 Andy Estes <aestes@apple.com> 2 3 [iOS] Download support by CFURLDownloadRef under USE(CFNETWORK). 4 https://bugs.webkit.org/show_bug.cgi?id=129322 5 6 Reviewed by Anders Carlsson. 7 8 * platform/network/ResourceHandle.h: 9 * platform/network/cf/ResourceHandleCFNet.cpp: 10 (WebCore::ResourceHandle::releaseConnectionForDownload): Changed to 11 return a RetainPtr that adopts the connection's retain count. 12 1 13 2014-03-24 Enrica Casucci <enrica@apple.com> 2 14 -
trunk/Source/WebCore/platform/network/ResourceHandle.h
r165676 r166186 139 139 CFURLStorageSessionRef storageSession() const; 140 140 CFURLConnectionRef connection() const; 141 CFURLConnectionRefreleaseConnectionForDownload();141 RetainPtr<CFURLConnectionRef> releaseConnectionForDownload(); 142 142 const ResourceRequest& currentRequest() const; 143 143 static void setHostAllowsAnyHTTPSCertificate(const String&); -
trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
r165676 r166186 461 461 } 462 462 463 CFURLConnectionRefResourceHandle::releaseConnectionForDownload()463 RetainPtr<CFURLConnectionRef> ResourceHandle::releaseConnectionForDownload() 464 464 { 465 465 LOG(Network, "CFNet - Job %p releasing connection %p for download", this, d->m_connection.get()); 466 return d->m_connection.leakRef();466 return std::move(d->m_connection); 467 467 } 468 468 -
trunk/Source/WebKit/mac/ChangeLog
r166168 r166186 1 2014-03-24 Andy Estes <aestes@apple.com> 2 3 [iOS] Download support by CFURLDownloadRef under USE(CFNETWORK). 4 https://bugs.webkit.org/show_bug.cgi?id=129322 5 6 Reviewed by Anders Carlsson. 7 8 * WebCoreSupport/WebFrameLoaderClient.mm: 9 (WebFrameLoaderClient::convertMainResourceLoadToDownload): Use the 10 RetainPtr returned by releaseConnectionForDownload() rather than 11 manually releasing. 12 1 13 2014-03-24 Jon Lee <jonlee@apple.com> 2 14 -
trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
r166144 r166186 331 331 #if USE(CFNETWORK) 332 332 ASSERT([WebDownload respondsToSelector:@selector(_downloadWithLoadingCFURLConnection:request:response:delegate:proxy:)]); 333 CFURLConnectionRef connection = handle->connection(); 334 [WebDownload _downloadWithLoadingCFURLConnection:connection 335 request:request.cfURLRequest(UpdateHTTPBody) 336 response:response.cfURLResponse() 337 delegate:[webView downloadDelegate] 338 proxy:nil]; 339 340 // Release the connection since the NSURLDownload (actually CFURLDownload) will retain the connection and use it. 341 handle->releaseConnectionForDownload(); 342 CFRelease(connection); 333 auto connection = handle->releaseConnectionForDownload(); 334 [WebDownload _downloadWithLoadingCFURLConnection:connection.get() request:request.cfURLRequest(UpdateHTTPBody) response:response.cfURLResponse() delegate:[webView downloadDelegate] proxy:nil]; 343 335 #else 344 [WebDownload _downloadWithLoadingConnection:handle->connection() 345 request:request.nsURLRequest(UpdateHTTPBody) 346 response:response.nsURLResponse() 347 delegate:[webView downloadDelegate] 348 proxy:nil]; 336 [WebDownload _downloadWithLoadingConnection:handle->connection() request:request.nsURLRequest(UpdateHTTPBody) response:response.nsURLResponse() delegate:[webView downloadDelegate] proxy:nil]; 349 337 #endif 350 338 } -
trunk/Source/WebKit2/ChangeLog
r166162 r166186 1 2014-03-24 Andy Estes <aestes@apple.com> 2 3 [iOS] Download support by CFURLDownloadRef under USE(CFNETWORK). 4 https://bugs.webkit.org/show_bug.cgi?id=129322 5 6 Reviewed by Anders Carlsson. 7 8 Based on an original patch by Yongjun Zhang <yongjun_zhang@apple.com>. 9 10 * Shared/Cocoa/APIObject.mm: 11 (API::Object::newObject): 12 * Shared/Downloads/ios/DownloadIOS.mm: 13 (WebKit::dispatchOnMainThread): 14 (WebKit::toDownload): 15 (WebKit::setUpDownloadClient): 16 (WebKit::Download::startWithHandle): 17 * UIProcess/API/APIDownloadClient.h: 18 (API::DownloadClient::~DownloadClient): 19 * UIProcess/API/C/WKContext.cpp: 20 (WKContextSetDownloadClient): 21 * UIProcess/API/Cocoa/WKProcessPool.mm: 22 (-[WKProcessPool _downloadDelegate]): 23 (-[WKProcessPool _setDownloadDelegate:]): 24 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 25 * UIProcess/API/Cocoa/_WKDownload.h: Added. 26 * UIProcess/API/Cocoa/_WKDownload.mm: Added. 27 (WebKit::wrapper): 28 (WebKit::createAPIDownloadClient): 29 (-[_WKDownload dealloc]): 30 (-[_WKDownload API::]): 31 * UIProcess/API/Cocoa/_WKDownloadDelegate.h: Added. 32 * UIProcess/API/Cocoa/_WKDownloadInternal.h: Added. 33 * UIProcess/Cocoa/DownloadClient.h: Added. 34 * UIProcess/Cocoa/DownloadClient.mm: Added. 35 * WebKit2.xcodeproj/project.pbxproj: 36 1 37 2014-03-24 Dániel Bátyai <dbatyai.u-szeged@partner.samsung.com> 2 38 -
trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm
r164603 r166186 29 29 #if WK_API_ENABLED 30 30 31 #import "_WKDownloadInternal.h" 31 32 #import "WKBackForwardListInternal.h" 32 33 #import "WKBackForwardListItemInternal.h" … … 114 115 break; 115 116 117 case Type::Download: 118 wrapper = [_WKDownload alloc]; 119 break; 120 116 121 case Type::Error: 117 122 wrapper = NSAllocateObject([WKNSError self], size, nullptr); -
trunk/Source/WebKit2/Shared/Downloads/ios/DownloadIOS.mm
r164776 r166186 29 29 #if PLATFORM(IOS) 30 30 31 #import "DataReference.h" 32 #import <CFNetwork/CFURLDownload.h> 31 33 #import <WebCore/NotImplemented.h> 34 #import <WebCore/ResourceError.h> 35 #import <WebCore/ResourceHandle.h> 36 #import <WebCore/ResourceResponse.h> 37 #import <wtf/RetainPtr.h> 38 #import <wtf/RunLoop.h> 32 39 33 40 using namespace WebCore; 34 41 35 42 namespace WebKit { 36 43 44 // FIXME: If possible, we should consider moving some callbacks off the main thread or at least 45 // making them asynchonous calls. 46 static void dispatchOnMainThread(void(^block)()) 47 { 48 if (RunLoop::isMain()) { 49 block(); 50 return; 51 } 52 53 dispatch_sync(dispatch_get_main_queue(), block); 54 } 55 56 static inline Download* toDownload(const void* clientInfo) 57 { 58 return static_cast<Download*>(const_cast<void*>(clientInfo)); 59 } 60 61 static void setUpDownloadClient(CFURLDownloadClient& client, Download& download) 62 { 63 memset(&client, 0, sizeof(client)); 64 client.clientInfo = &download; 65 66 client.didStart = [](CFURLDownloadRef, const void* clientInfo) { 67 dispatchOnMainThread(^{ 68 toDownload(clientInfo)->didStart(); 69 }); 70 }; 71 72 client.willSendRequest = [](CFURLDownloadRef, CFURLRequestRef request, CFURLResponseRef, const void*) -> CFURLRequestRef { 73 return CFRetain(request); 74 }; 75 76 client.didReceiveResponse = [](CFURLDownloadRef, CFURLResponseRef response, const void* clientInfo) { 77 dispatchOnMainThread(^{ 78 toDownload(clientInfo)->didReceiveResponse(response); 79 }); 80 }; 81 82 client.didReceiveData = [](CFURLDownloadRef, CFIndex length, const void* clientInfo) { 83 dispatchOnMainThread(^{ 84 toDownload(clientInfo)->didReceiveData(length); 85 }); 86 }; 87 88 client.shouldDecodeDataOfMIMEType = [](CFURLDownloadRef, CFStringRef encodingType, const void* clientInfo) -> Boolean { 89 __block BOOL returnValue = NO; 90 dispatchOnMainThread(^{ 91 returnValue = toDownload(clientInfo)->shouldDecodeSourceDataOfMIMEType(encodingType); 92 }); 93 return returnValue; 94 }; 95 96 client.decideDestinationWithSuggestedObjectName = [](CFURLDownloadRef downloadRef, CFStringRef objectName, const void* clientInfo) { 97 dispatchOnMainThread(^{ 98 BOOL allowOverwrite; 99 String destination = toDownload(clientInfo)->decideDestinationWithSuggestedFilename(objectName, allowOverwrite); 100 if (!destination.isNull()) 101 CFURLDownloadSetDestination(downloadRef, reinterpret_cast<CFURLRef>([NSURL fileURLWithPath:destination]), allowOverwrite); 102 }); 103 }; 104 105 client.didCreateDestination = [](CFURLDownloadRef, CFURLRef path, const void* clientInfo) { 106 dispatchOnMainThread(^{ 107 toDownload(clientInfo)->didCreateDestination(CFURLGetString(path)); 108 }); 109 }; 110 111 client.didFinish = [](CFURLDownloadRef, const void* clientInfo) { 112 dispatchOnMainThread(^{ 113 toDownload(clientInfo)->didFinish(); 114 }); 115 }; 116 117 client.didFail = [](CFURLDownloadRef downloadRef, CFErrorRef error, const void* clientInfo) { 118 dispatchOnMainThread(^{ 119 auto resumeData = adoptCF(CFURLDownloadCopyResumeData(downloadRef)); 120 toDownload(clientInfo)->didFail(error, IPC::DataReference(CFDataGetBytePtr(resumeData.get()), CFDataGetLength(resumeData.get()))); 121 }); 122 }; 123 } 124 37 125 void Download::start() 38 126 { … … 40 128 } 41 129 42 void Download::startWithHandle(ResourceHandle* , const ResourceResponse&)130 void Download::startWithHandle(ResourceHandle* handle, const ResourceResponse& response) 43 131 { 44 notImplemented(); 132 CFURLDownloadClient client; 133 setUpDownloadClient(client, *this); 134 m_download = adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(NULL, handle->releaseConnectionForDownload().get(), m_request.cfURLRequest(UpdateHTTPBody), response.cfURLResponse(), &client)); 45 135 } 46 136 -
trunk/Source/WebKit2/UIProcess/API/APIDownloadClient.h
r166096 r166186 30 30 31 31 namespace WebCore { 32 class ResourceError; 32 33 class ResourceResponse; 33 class ResourceError;34 34 } 35 35 36 36 namespace WebKit { 37 37 class AuthenticationChallengeProxy; 38 class DownloadProxy; 38 39 class WebContext; 39 class DownloadProxy;40 40 } 41 41 … … 44 44 class DownloadClient { 45 45 public: 46 virtual ~DownloadClient() 46 virtual ~DownloadClient() { } 47 47 48 48 virtual void didStart(WebKit::WebContext*, WebKit::DownloadProxy*) { } … … 51 51 virtual void didReceiveData(WebKit::WebContext*, WebKit::DownloadProxy*, uint64_t length) { } 52 52 virtual bool shouldDecodeSourceDataOfMIMEType(WebKit::WebContext*, WebKit::DownloadProxy*, const WTF::String& mimeType) { return true; } 53 virtual WTF::String decideDestinationWithSuggestedFilename(WebKit::WebContext*, WebKit::DownloadProxy*, const WTF::String& filename, bool& allowOverwrite) 54 { 55 return WTF::String(); 56 } 53 virtual WTF::String decideDestinationWithSuggestedFilename(WebKit::WebContext*, WebKit::DownloadProxy*, const WTF::String& filename, bool& allowOverwrite) { return {}; } 57 54 virtual void didCreateDestination(WebKit::WebContext*, WebKit::DownloadProxy*, const WTF::String& path) { } 58 55 virtual void didFinish(WebKit::WebContext*, WebKit::DownloadProxy*) { } -
trunk/Source/WebKit2/UIProcess/API/C/WKContext.cpp
r166096 r166186 171 171 { 172 172 if (!m_client.didStart) 173 return;173 return; 174 174 175 175 m_client.didStart(toAPI(webContext), toAPI(downloadProxy), m_client.base.clientInfo); … … 179 179 { 180 180 if (!m_client.didReceiveAuthenticationChallenge) 181 return;181 return; 182 182 183 183 m_client.didReceiveAuthenticationChallenge(toAPI(webContext), toAPI(downloadProxy), toAPI(authenticationChallengeProxy), m_client.base.clientInfo); … … 187 187 { 188 188 if (!m_client.didReceiveResponse) 189 return;189 return; 190 190 191 191 m_client.didReceiveResponse(toAPI(webContext), toAPI(downloadProxy), toAPI(API::URLResponse::create(response).get()), m_client.base.clientInfo); … … 195 195 { 196 196 if (!m_client.didReceiveData) 197 return;197 return; 198 198 199 199 m_client.didReceiveData(toAPI(webContext), toAPI(downloadProxy), length, m_client.base.clientInfo); … … 203 203 { 204 204 if (!m_client.shouldDecodeSourceDataOfMIMEType) 205 return true;205 return true; 206 206 207 207 return m_client.shouldDecodeSourceDataOfMIMEType(toAPI(webContext), toAPI(downloadProxy), toAPI(mimeType.impl()), m_client.base.clientInfo); … … 211 211 { 212 212 if (!m_client.decideDestinationWithSuggestedFilename) 213 return String();213 return String(); 214 214 215 215 WKRetainPtr<WKStringRef> destination(AdoptWK, m_client.decideDestinationWithSuggestedFilename(toAPI(webContext), toAPI(downloadProxy), toAPI(filename.impl()), &allowOverwrite, m_client.base.clientInfo)); … … 220 220 { 221 221 if (!m_client.didCreateDestination) 222 return;222 return; 223 223 224 224 m_client.didCreateDestination(toAPI(webContext), toAPI(downloadProxy), toAPI(path.impl()), m_client.base.clientInfo); … … 228 228 { 229 229 if (!m_client.didFinish) 230 return;230 return; 231 231 232 232 m_client.didFinish(toAPI(webContext), toAPI(downloadProxy), m_client.base.clientInfo); … … 236 236 { 237 237 if (!m_client.didFail) 238 return;238 return; 239 239 240 240 m_client.didFail(toAPI(webContext), toAPI(downloadProxy), toAPI(error), m_client.base.clientInfo); … … 244 244 { 245 245 if (!m_client.didCancel) 246 return;246 return; 247 247 248 248 m_client.didCancel(toAPI(webContext), toAPI(downloadProxy), m_client.base.clientInfo); … … 252 252 { 253 253 if (!m_client.processDidCrash) 254 return;254 return; 255 255 256 256 m_client.processDidCrash(toAPI(webContext), toAPI(downloadProxy), m_client.base.clientInfo); -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm
r166011 r166186 29 29 #if WK_API_ENABLED 30 30 31 #import "_WKDownloadDelegate.h" 31 32 #import "CacheModel.h" 33 #import "DownloadClient.h" 32 34 #import "HistoryClient.h" 33 35 #import "ProcessModel.h" 34 36 #import "WKObject.h" 35 37 #import "WKProcessPoolConfigurationPrivate.h" 38 #import "WeakObjCPtr.h" 36 39 #import "WebCertificateInfo.h" 37 40 #import "WebContext.h" … … 59 62 #endif 60 63 61 @implementation WKProcessPool 64 @implementation WKProcessPool { 65 WebKit::WeakObjCPtr<id <_WKDownloadDelegate>> _downloadDelegate; 66 } 62 67 63 68 - (instancetype)init … … 174 179 } 175 180 181 - (id <_WKDownloadDelegate>)_downloadDelegate 182 { 183 return _downloadDelegate.getAutoreleased(); 184 } 185 186 - (void)_setDownloadDelegate:(id <_WKDownloadDelegate>)downloadDelegate 187 { 188 _downloadDelegate = downloadDelegate; 189 _context->setDownloadClient(std::make_unique<WebKit::DownloadClient>(downloadDelegate)); 190 } 191 176 192 @end 177 193 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r166011 r166186 29 29 30 30 @class _WKProcessPoolConfiguration; 31 @protocol _WKDownloadDelegate; 31 32 32 33 @interface WKProcessPool (WKPrivate) … … 42 43 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 43 44 45 @property (nonatomic, weak, setter=_setDownloadDelegate:) id <_WKDownloadDelegate> _downloadDelegate; 46 44 47 @end 45 48 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDownload.h
r166185 r166186 24 24 */ 25 25 26 #import <WebKit2/WK ProcessPool.h>26 #import <WebKit2/WKFoundation.h> 27 27 28 28 #if WK_API_ENABLED 29 29 30 @class _WKProcessPoolConfiguration; 30 #import <Foundation/Foundation.h> 31 31 32 @interface WKProcessPool (WKPrivate) 33 34 - (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration WK_DESIGNATED_INITIALIZER; 35 36 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; 37 38 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 39 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 40 41 - (id)_objectForBundleParameter:(NSString *)parameter; 42 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 32 WK_API_CLASS 33 @interface _WKDownload : NSObject 43 34 44 35 @end 45 36 46 #endif 37 #endif // WK_API_ENABLED -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDownload.mm
r166185 r166186 24 24 */ 25 25 26 #import <WebKit2/WKProcessPool.h> 26 #import "config.h" 27 #import "_WKDownloadInternal.h" 27 28 28 29 #if WK_API_ENABLED 29 30 30 @class _WKProcessPoolConfiguration; 31 #import "DownloadProxy.h" 31 32 32 @interface WKProcessPool (WKPrivate) 33 @implementation _WKDownload { 34 API::ObjectStorage<WebKit::DownloadProxy> _download; 35 } 33 36 34 - (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration WK_DESIGNATED_INITIALIZER; 37 - (void)dealloc 38 { 39 _download->~DownloadProxy(); 35 40 36 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; 41 [super dealloc]; 42 } 37 43 38 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 39 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 44 #pragma mark WKObject protocol implementation 40 45 41 - (id)_objectForBundleParameter:(NSString *)parameter; 42 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 46 - (API::Object&)_apiObject 47 { 48 return *_download; 49 } 43 50 44 51 @end 45 52 46 #endif 53 #endif // WK_API_ENABLED -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDownloadDelegate.h
r166185 r166186 24 24 */ 25 25 26 #import <WebKit2/WK ProcessPool.h>26 #import <WebKit2/WKFoundation.h> 27 27 28 28 #if WK_API_ENABLED 29 29 30 @class _WKProcessPoolConfiguration; 30 #import <Foundation/Foundation.h> 31 31 32 @ interface WKProcessPool (WKPrivate)32 @class _WKDownload; 33 33 34 - (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration WK_DESIGNATED_INITIALIZER; 35 36 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; 37 38 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 39 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 40 41 - (id)_objectForBundleParameter:(NSString *)parameter; 42 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 43 34 @protocol _WKDownloadDelegate <NSObject> 35 @optional 36 - (void)_downloadDidStart:(_WKDownload *)download; 37 - (void)_download:(_WKDownload *)download didReceiveResponse:(NSURLResponse *)response; 38 - (void)_download:(_WKDownload *)download didReceiveData:(uint64_t)length; 39 - (NSString *)_download:(_WKDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename allowOverwrite:(BOOL *)allowOverwrite; 40 - (void)_downloadDidFinish:(_WKDownload *)download; 44 41 @end 45 42 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKDownloadInternal.h
r166185 r166186 24 24 */ 25 25 26 #import <WebKit2/WKProcessPool.h>26 #import "_WKDownload.h" 27 27 28 28 #if WK_API_ENABLED 29 29 30 @class _WKProcessPoolConfiguration; 30 #import "WKObject.h" 31 31 32 @ interface WKProcessPool (WKPrivate)32 @protocol _WKDownloadDelegate; 33 33 34 - (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration WK_DESIGNATED_INITIALIZER; 34 namespace API { 35 class DownloadClient; 36 } 35 37 36 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; 38 namespace WebKit { 39 std::unique_ptr<API::DownloadClient> createAPIDownloadClient(id <_WKDownloadDelegate>); 40 } 37 41 38 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 39 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 40 41 - (id)_objectForBundleParameter:(NSString *)parameter; 42 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 43 42 @interface _WKDownload () <WKObject> 44 43 @end 45 44 46 #endif 45 #endif // WK_API_ENABLED -
trunk/Source/WebKit2/UIProcess/Cocoa/DownloadClient.h
r166185 r166186 24 24 */ 25 25 26 #import <WebKit2/WKProcessPool.h> 26 #ifndef DownloadClient_h 27 #define DownloadClient_h 28 29 #import "WKFoundation.h" 27 30 28 31 #if WK_API_ENABLED 29 32 30 @class _WKProcessPoolConfiguration; 33 #import "APIDownloadClient.h" 34 #import "WeakObjCPtr.h" 31 35 32 @ interface WKProcessPool (WKPrivate)36 @protocol _WKDownloadDelegate; 33 37 34 - (instancetype)_initWithConfiguration:(_WKProcessPoolConfiguration *)configuration WK_DESIGNATED_INITIALIZER; 38 namespace WebCore { 39 class ResourceResponse; 40 } 35 41 36 @property (nonatomic, readonly) _WKProcessPoolConfiguration *_configuration; 42 namespace WebKit { 43 44 class DownloadClient final : public API::DownloadClient { 45 public: 46 explicit DownloadClient(id <_WKDownloadDelegate>); 47 48 private: 49 // From API::DownloadClient 50 virtual void didStart(WebContext*, DownloadProxy*); 51 virtual void didReceiveResponse(WebContext*, DownloadProxy*, const WebCore::ResourceResponse&); 52 virtual void didReceiveData(WebContext*, DownloadProxy*, uint64_t length); 53 virtual String decideDestinationWithSuggestedFilename(WebContext*, DownloadProxy*, const String& filename, bool& allowOverwriteParam); 54 virtual void didFinish(WebContext*, DownloadProxy*); 37 55 38 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 39 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 56 WeakObjCPtr<id <_WKDownloadDelegate>> m_delegate; 40 57 41 - (id)_objectForBundleParameter:(NSString *)parameter; 42 - (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter; 58 struct { 59 bool downloadDidStart : 1; 60 bool downloadDidReceiveResponse : 1; 61 bool downloadDidReceiveData : 1; 62 bool downloadDecideDestinationWithSuggestedFilenameAllowOverwrite : 1; 63 bool downloadDidFinish : 1; 64 } m_delegateMethods; 65 }; 43 66 44 @end 67 } // namespace WebKit 45 68 46 69 #endif 70 71 #endif // DownloadClient_h -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r166103 r166186 987 987 9FB5F394169E6A80002C25BF /* WKContextPrivateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FB5F392169E6A80002C25BF /* WKContextPrivateMac.mm */; }; 988 988 9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; 989 A1A4FE5A18DCE9FA00B5EA8A /* _WKDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */; settings = {ATTRIBUTES = (Private, ); }; }; 990 A1A4FE5B18DCE9FA00B5EA8A /* _WKDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */; }; 991 A1A4FE5C18DCE9FA00B5EA8A /* _WKDownloadInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */; }; 992 A1A4FE6118DD54A400B5EA8A /* _WKDownloadDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 993 A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */; }; 994 A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A1DF631118E0B7C8003A3E2A /* DownloadClient.h */; }; 989 995 A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 990 996 A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */; }; … … 2806 2812 9FB5F392169E6A80002C25BF /* WKContextPrivateMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKContextPrivateMac.mm; path = mac/WKContextPrivateMac.mm; sourceTree = "<group>"; }; 2807 2813 9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContextPrivateMac.h; path = mac/WKContextPrivateMac.h; sourceTree = "<group>"; }; 2814 A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownload.h; sourceTree = "<group>"; }; 2815 A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKDownload.mm; sourceTree = "<group>"; }; 2816 A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadInternal.h; sourceTree = "<group>"; }; 2817 A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKDownloadDelegate.h; sourceTree = "<group>"; }; 2818 A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DownloadClient.mm; sourceTree = "<group>"; }; 2819 A1DF631118E0B7C8003A3E2A /* DownloadClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadClient.h; sourceTree = "<group>"; }; 2808 2820 A1EDD2D91884ACE000BBFE98 /* All.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = All.xcconfig; sourceTree = "<group>"; }; 2809 2821 A1EDD2DB1884B96400BBFE98 /* PluginProcessShim.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = PluginProcessShim.xcconfig; sourceTree = "<group>"; }; … … 4183 4195 isa = PBXGroup; 4184 4196 children = ( 4185 2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */, 4186 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */, 4187 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */, 4188 0F0C365918C0555800F607D7 /* LayerRepresentation.h */, 4197 A1DF631118E0B7C8003A3E2A /* DownloadClient.h */, 4198 A1DF631018E0B7C8003A3E2A /* DownloadClient.mm */, 4189 4199 1A422F8D18B29C6400D8CD96 /* HistoryClient.h */, 4190 4200 1A422F8C18B29C6400D8CD96 /* HistoryClient.mm */, 4201 0F0C365918C0555800F607D7 /* LayerRepresentation.h */, 4191 4202 1ABC3DF41899E437004F0626 /* NavigationState.h */, 4192 4203 1ABC3DF31899E437004F0626 /* NavigationState.mm */, 4193 4204 1AFE436418B6C081009C7A48 /* UIClient.h */, 4194 4205 1AFE436318B6C081009C7A48 /* UIClient.mm */, 4206 2D7AAFD218C8640600A7ACD4 /* WKWebViewContentProvider.h */, 4207 2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */, 4208 2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */, 4195 4209 ); 4196 4210 path = Cocoa; … … 4544 4558 37A5E01118BBF937000A081E /* _WKActivatedElementInfo.mm */, 4545 4559 379A873518BBFA4300588AF2 /* _WKActivatedElementInfoInternal.h */, 4560 A1A4FE5718DCE9FA00B5EA8A /* _WKDownload.h */, 4561 A1A4FE5818DCE9FA00B5EA8A /* _WKDownload.mm */, 4562 A1A4FE6018DD54A400B5EA8A /* _WKDownloadDelegate.h */, 4563 A1A4FE5918DCE9FA00B5EA8A /* _WKDownloadInternal.h */, 4546 4564 379A873818BBFE0F00588AF2 /* _WKElementAction.h */, 4547 4565 379A873718BBFE0F00588AF2 /* _WKElementAction.mm */, … … 6556 6574 BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */, 6557 6575 378E1A4A18208CD60031007A /* WKNSString.h in Headers */, 6576 A1A4FE5C18DCE9FA00B5EA8A /* _WKDownloadInternal.h in Headers */, 6558 6577 2D8949F1182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h in Headers */, 6559 6578 0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */, … … 6661 6680 E152551B17011819003D7ADB /* NetworkResourceLoaderMessages.h in Headers */, 6662 6681 51CBBA10165219B6005BE8FD /* NetworkResourceLoadParameters.h in Headers */, 6682 A1DF631318E0B7C8003A3E2A /* DownloadClient.h in Headers */, 6663 6683 51829DA61637C70C000953D6 /* NetworkResourceLoadScheduler.h in Headers */, 6664 6684 31A2EC5614899C0900810D71 /* NotificationPermissionRequest.h in Headers */, … … 7040 7060 BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */, 7041 7061 ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */, 7062 A1A4FE5A18DCE9FA00B5EA8A /* _WKDownload.h in Headers */, 7042 7063 BC1B419811D41D570011E8DD /* WKBundlePagePrivate.h in Headers */, 7043 7064 BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */, … … 7064 7085 3309345B1315B9980097A7BC /* WKCookieManager.h in Headers */, 7065 7086 512F58FA12A88A5400629530 /* WKCredential.h in Headers */, 7087 A1A4FE6118DD54A400B5EA8A /* _WKDownloadDelegate.h in Headers */, 7066 7088 0FCB4E4618BBE044000FCFC9 /* PageClientImplIOS.h in Headers */, 7067 7089 518ACF1112B015F800B04B83 /* WKCredentialTypes.h in Headers */, … … 8218 8240 374436881820E7240049579F /* WKObject.mm in Sources */, 8219 8241 1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */, 8242 A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */, 8220 8243 1A0F29CB120B37160053D1B9 /* VisitedLinkTable.cpp in Sources */, 8221 8244 1AC1337F18590AE400F3EC05 /* RemoteObjectRegistry.mm in Sources */, … … 8405 8428 BC111B11112F5E4F00337BAB /* WebProcessProxy.cpp in Sources */, 8406 8429 51032F18180F73BB00961BB7 /* WebToDatabaseProcessConnection.cpp in Sources */, 8430 A1A4FE5B18DCE9FA00B5EA8A /* _WKDownload.mm in Sources */, 8407 8431 51D130581382F10500351EDD /* WebProcessProxyMac.mm in Sources */, 8408 8432 BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */, -
trunk/Tools/ChangeLog
r166177 r166186 1 2014-03-24 Andy Estes <aestes@apple.com> 2 3 [iOS] Download support by CFURLDownloadRef under USE(CFNETWORK). 4 https://bugs.webkit.org/show_bug.cgi?id=129322 5 6 Reviewed by Anders Carlsson. 7 8 Add an API test suite for _WKDownload. 9 10 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 11 * TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm: Added. 12 (-[DownloadDelegate initWithSourceURL:]): 13 (-[DownloadDelegate sourceURL]): 14 (-[DownloadDelegate _downloadDidStart:]): 15 (-[DownloadDelegate _download:didReceiveResponse:]): 16 (-[DownloadDelegate _download:didReceiveData:]): 17 (-[DownloadDelegate _download:decideDestinationWithSuggestedFilename:allowOverwrite:]): 18 (-[DownloadDelegate _downloadDidFinish:]): 19 (TEST): 20 (runTestWithNavigationDelegate): 21 (-[DownloadNavigationDelegate webView:decidePolicyForNavigationAction:decisionHandler:]): 22 (-[ConvertResponseToDownloadNavigationDelegate webView:decidePolicyForNavigationResponse:decisionHandler:]): 23 1 24 2014-03-24 Joseph Pecoraro <pecoraro@apple.com> 2 25 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r163053 r166186 143 143 9B4F8FA4159D52B1002D9F94 /* HTMLCollectionNamedItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */; }; 144 144 9B4F8FA7159D52DD002D9F94 /* HTMLCollectionNamedItem.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */; }; 145 A1A4FE5F18DD3DB700B5EA8A /* Download.mm in Sources */ = {isa = PBXBuildFile; fileRef = A1A4FE5D18DD3DB700B5EA8A /* Download.mm */; }; 145 146 A57A34F016AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm in Sources */ = {isa = PBXBuildFile; fileRef = A57A34EF16AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm */; }; 146 147 A57A34F216AF6B2B00C2501F /* PageVisibilityStateWithWindowChanges.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A57A34F116AF69E200C2501F /* PageVisibilityStateWithWindowChanges.html */; }; … … 470 471 9B4F8FA3159D52B1002D9F94 /* HTMLCollectionNamedItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HTMLCollectionNamedItem.mm; sourceTree = "<group>"; }; 471 472 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = HTMLCollectionNamedItem.html; sourceTree = "<group>"; }; 473 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Download.mm; sourceTree = "<group>"; }; 472 474 A57A34EF16AF677200C2501F /* PageVisibilityStateWithWindowChanges.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageVisibilityStateWithWindowChanges.mm; sourceTree = "<group>"; }; 473 475 A57A34F116AF69E200C2501F /* PageVisibilityStateWithWindowChanges.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = PageVisibilityStateWithWindowChanges.html; sourceTree = "<group>"; }; … … 673 675 isa = PBXGroup; 674 676 children = ( 677 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */, 675 678 1ABC3DED1899BE6D004F0626 /* Navigation.mm */, 676 679 ); … … 1208 1211 2D640B5517875DFF00BFAF99 /* ScrollPinningBehaviors.cpp in Sources */, 1209 1212 26300B1816755CD90066886D /* ListHashSet.cpp in Sources */, 1213 A1A4FE5F18DD3DB700B5EA8A /* Download.mm in Sources */, 1210 1214 52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */, 1211 1215 33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.