Commit b6dd9b64 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Update 'Stop Download?' button titles for Download Manager.

Old dialog had confusing language: "Cancel Download?" "Cancel" | "OK"
New dialog has the following language: Stop download?" "Continue | Stop"

Bug: 825040
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I293b2897a222291695d2064d796f4b590fa9e90c
Reviewed-on: https://chromium-review.googlesource.com/1003312
Commit-Queue: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549903}
parent 20a5cc4f
......@@ -595,7 +595,13 @@ locale. The strings in this file are specific to iOS.
Install
</message>
<message name="IDS_IOS_DOWNLOAD_MANAGER_CANCEL_CONFIRMATION" desc="Alert title to confirm download cancellation [Length: 30em] [iOS only]">
Cancel Download?
Stop Download?
</message>
<message name="IDS_IOS_DOWNLOAD_MANAGER_CONTINUE" desc="The title of Continue button in the Stop Download? confirmation dialog [30em]">
Continue
</message>
<message name="IDS_IOS_DOWNLOAD_MANAGER_STOP" desc="The title of Stop button in the Stop Download? confirmation dialog [30em]">
Stop
</message>
<message name="IDS_IOS_DOWNLOAD_MANAGER_REPLACE_CONFIRMATION" desc="Alert title to confirm download old download replacement [Length: 30em] [iOS only]">
Start New Download?
......
......@@ -225,12 +225,12 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver,
- (void)downloadManagerTabHelper:(nonnull DownloadManagerTabHelper*)tabHelper
decidePolicyForDownload:(nonnull web::DownloadTask*)download
completionHandler:(nonnull void (^)(NewDownloadPolicy))handler {
NSString* title =
l10n_util::GetNSString(IDS_IOS_DOWNLOAD_MANAGER_REPLACE_CONFIRMATION);
NSString* message = l10n_util::GetNSString(
IDS_IOS_DOWNLOAD_MANAGER_REPLACE_CONFIRMATION_MESSAGE);
const int title = IDS_IOS_DOWNLOAD_MANAGER_REPLACE_CONFIRMATION;
const int message = IDS_IOS_DOWNLOAD_MANAGER_REPLACE_CONFIRMATION_MESSAGE;
[self runConfirmationDialogWithTitle:title
message:message
confirmTitle:IDS_OK
cancelTitle:IDS_CANCEL
completionHandler:^(BOOL confirmed) {
UMA_HISTOGRAM_BOOLEAN("Download.IOSDownloadReplaced",
confirmed);
......@@ -292,10 +292,11 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver,
}
__weak DownloadManagerCoordinator* weakSelf = self;
NSString* title =
l10n_util::GetNSString(IDS_IOS_DOWNLOAD_MANAGER_CANCEL_CONFIRMATION);
int title = IDS_IOS_DOWNLOAD_MANAGER_CANCEL_CONFIRMATION;
[self runConfirmationDialogWithTitle:title
message:nil
message:-1
confirmTitle:IDS_IOS_DOWNLOAD_MANAGER_STOP
cancelTitle:IDS_IOS_DOWNLOAD_MANAGER_CONTINUE
completionHandler:^(BOOL confirmed) {
if (confirmed) {
UMA_HISTOGRAM_ENUMERATION(
......@@ -356,18 +357,23 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver,
downloadTask->Cancel();
}
// Presents UIAlertController with |title|, |message| and two buttons (OK and
// Cancel). |handler| is called with YES if OK button was tapped and with NO
// if Cancel button was tapped.
- (void)runConfirmationDialogWithTitle:(NSString*)title
message:(NSString*)message
// Presents UIAlertController with |titleID|, |messageID| and two buttons
// (confirmTitleID and cancelTitleID). |handler| is called with YES if confirm
// button was tapped and with NO if Cancel button was tapped. |messageID| is
// optional and can be -1.
- (void)runConfirmationDialogWithTitle:(int)titleID
message:(int)messageID
confirmTitle:(int)confirmTitleID
cancelTitle:(int)cancelTitleID
completionHandler:(void (^)(BOOL confirmed))handler {
NSString* message = messageID != -1 ? l10n_util::GetNSString(messageID) : nil;
NSString* title = l10n_util::GetNSString(titleID);
_confirmationDialog =
[UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* OKAction =
[UIAlertAction actionWithTitle:l10n_util::GetNSString(IDS_OK)
[UIAlertAction actionWithTitle:l10n_util::GetNSString(confirmTitleID)
style:UIAlertActionStyleDefault
handler:^(UIAlertAction*) {
handler(YES);
......@@ -375,7 +381,7 @@ class UnopenedDownloadsTracker : public web::DownloadTaskObserver,
[_confirmationDialog addAction:OKAction];
UIAlertAction* cancelAction =
[UIAlertAction actionWithTitle:l10n_util::GetNSString(IDS_CANCEL)
[UIAlertAction actionWithTitle:l10n_util::GetNSString(cancelTitleID)
style:UIAlertActionStyleCancel
handler:^(UIAlertAction*) {
handler(NO);
......
......@@ -698,7 +698,7 @@ TEST_F(DownloadManagerCoordinatorTest, CloseInProgressDownload) {
isKindOfClass:[UIAlertController class]]);
UIAlertController* alert = base::mac::ObjCCast<UIAlertController>(
base_view_controller_.presentedViewController);
EXPECT_NSEQ(@"Cancel Download?", alert.title);
EXPECT_NSEQ(@"Stop Download?", alert.title);
EXPECT_FALSE(alert.message);
// Stop to avoid holding a dangling pointer to destroyed task.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment