forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The download client should be able to determine if a placeholder shou…
…ld be used https://bugs.webkit.org/show_bug.cgi?id=278737 rdar://134794671 Reviewed by Alex Christensen. The download client should be able to determine if a placeholder should be used for the final location of the download. This patch prepares for this by passing the value from the UI process to the Networking process. This was previously landed in <https://commits.webkit.org/283043@main>. This version addresses a build error. * Source/WebKit/NetworkProcess/Downloads/Download.h: * Source/WebKit/NetworkProcess/Downloads/DownloadManager.cpp: (WebKit::DownloadManager::publishDownloadProgress): * Source/WebKit/NetworkProcess/Downloads/DownloadManager.h: * Source/WebKit/NetworkProcess/Downloads/PendingDownload.cpp: (WebKit::PendingDownload::publishProgress): (WebKit::PendingDownload::didBecomeDownload): * Source/WebKit/NetworkProcess/Downloads/PendingDownload.h: * Source/WebKit/NetworkProcess/Downloads/cocoa/DownloadCocoa.mm: (WebKit::Download::publishProgress): * Source/WebKit/NetworkProcess/NetworkProcess.cpp: (WebKit::NetworkProcess::publishDownloadProgress): * Source/WebKit/NetworkProcess/NetworkProcess.h: * Source/WebKit/NetworkProcess/NetworkProcess.messages.in: * Source/WebKit/Shared/API/Cocoa/WebKitPrivate.h: * Source/WebKit/UIProcess/API/Cocoa/_WKDownload.mm: (-[_WKDownload publishProgressAtURL:]): * Source/WebKit/UIProcess/API/Cocoa/WKDownload.mm: (-[WKDownload setDelegate:]): * Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegate.h: * Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegatePrivate.h: Added. * Source/WebKit/UIProcess/Downloads/DownloadProxy.cpp: (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): * Source/WebKit/UIProcess/Downloads/DownloadProxy.h: (WebKit::DownloadProxy::setUseDownloadPlaceholder): * Source/WebKit/UIProcess/Downloads/DownloadProxyCocoa.mm: (WebKit::DownloadProxy::publishProgress): * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm: (TestWebKitAPI::DecidePlaceholderPolicy)): * Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.h: * Tools/TestWebKitAPI/cocoa/TestDownloadDelegate.mm: (-[TestDownloadDelegate _download:decidePlaceholderPolicy:]): Canonical link: https://commits.webkit.org/283071@main
- Loading branch information
Showing
23 changed files
with
235 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Source/WebKit/UIProcess/API/Cocoa/WKDownloadDelegatePrivate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2024 Apple Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, | ||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS | ||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
* THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <WebKit/WKDownloadDelegate.h> | ||
#import <WebKit/WKFoundation.h> | ||
|
||
@class WKDownload; | ||
|
||
/* @enum _WKPlaceholderPolicy | ||
@abstract The policy for creating a placeholder file in the Downloads directory during downloads. | ||
@constant _WKPlaceholderPolicyDisable Do not create a placeholder file. | ||
@constant _WKPlaceholderPolicyEnable Create a placeholder file. | ||
*/ | ||
typedef NS_ENUM(NSInteger, _WKPlaceholderPolicy) { | ||
_WKPlaceholderPolicyDisable, | ||
_WKPlaceholderPolicyEnable, | ||
} NS_SWIFT_NAME(WKDownload.PlaceholderPolicy) WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
WK_SWIFT_UI_ACTOR | ||
@protocol WKDownloadDelegatePrivate <WKDownloadDelegate> | ||
|
||
@optional | ||
|
||
/* @abstract Invoked when the download needs a placeholder policy from the client. | ||
@param download The download for which we need a placeholder policy | ||
@param completionHandler The completion handler that should be invoked with the chosen policy | ||
@discussion The placeholder policy specifies whether a placeholder file should be created in | ||
the Downloads directory when the download is in progress. | ||
*/ | ||
- (void)_download:(WKDownload *)download decidePlaceholderPolicy:(void (^)(_WKPlaceholderPolicy))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.