void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef, const void* clientInfo) { // The concept of the ".download bundle" is internal to the Download, so we try to hide its // existence by reporting the final destination was created, when in reality the bundle was created. Download* download = downloadFromClientInfo(clientInfo); download->didCreateDestination(download->destination()); }
void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef cfURLDownloadRef, CFStringRef objectName, const void* clientInfo) { Download* download = downloadFromClientInfo(clientInfo); bool allowOverwrite; String destination = download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite); if (destination.isNull()) return; RetainPtr<CFStringRef> cfPath(AdoptCF, CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar*>(destination.characters()), destination.length(), kCFAllocatorNull)); RetainPtr<CFURLRef> pathURL(AdoptCF, CFURLCreateWithFileSystemPath(0, cfPath.get(), kCFURLWindowsPathStyle, false)); CFURLDownloadSetDestination(cfURLDownloadRef, pathURL.get(), allowOverwrite); }
void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void* clientInfo) { CoreIPC::DataReference dataReference(0, 0); downloadFromClientInfo(clientInfo)->didFail(ResourceError(error), dataReference); }
void didFinishCallback(CFURLDownloadRef, const void* clientInfo) { downloadFromClientInfo(clientInfo)->didFinish(); }
void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void* clientInfo) { Download* download = downloadFromClientInfo(clientInfo); bool allowOverwrite; download->decideDestinationWithSuggestedFilename(objectName, allowOverwrite); }
Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodingType, const void* clientInfo) { return downloadFromClientInfo(clientInfo)->shouldDecodeSourceDataOfMIMEType(encodingType); }
void didReceiveDataCallback(CFURLDownloadRef, CFIndex length, const void* clientInfo) { downloadFromClientInfo(clientInfo)->didReceiveData(length); }
void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, const void* clientInfo) { downloadFromClientInfo(clientInfo)->didReceiveResponse(ResourceResponse(response)); }
void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef, CFURLAuthChallengeRef challenge, const void* clientInfo) { Download* download = downloadFromClientInfo(clientInfo); download->didReceiveAuthenticationChallenge(AuthenticationChallenge(challenge, download->authenticationClient())); }
void didStartCallback(CFURLDownloadRef, const void* clientInfo) { downloadFromClientInfo(clientInfo)->didStart(); }
void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef url, const void* clientInfo) { RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyFileSystemPath(url, kCFURLWindowsPathStyle)); String result(path.get()); downloadFromClientInfo(clientInfo)->didCreateDestination(result); }