From 1997ef8f2173f1382acd68ff5521e3c0ffb9d45d Mon Sep 17 00:00:00 2001 From: "jcampan@chromium.org" Date: Tue, 2 Jun 2009 06:09:27 +0000 Subject: Makes the text of the in-progress download dialog better by special-casing the single download case. BUG=11278 TEST=Start a big download, close Chrome. A dialog warning that a download is in progress should be shown. Check that the main text and button text use singular when referring to the download. Start several big downloads. Close Chrome, check the text now uses plural. Review URL: http://codereview.chromium.org/119009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17387 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/app/generated_resources.grd | 17 +++++++++++++---- chrome/browser/views/frame/browser_view.cc | 29 ++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 81d38e4..02e753b 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -1605,13 +1605,22 @@ each locale. --> - - You have $13 download(s) in progress. If you close Google Chrome now, these downloads will be canceled. + + You have one download in progress. If you close Google Chrome now, this download will be canceled. - + + You have $13 downloads in progress. If you close Google Chrome now, these downloads will be canceled. + + + Close and cancel download + + Close and cancel downloads - + + Wait for download to finish + + Wait for downloads to finish diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index e7ffef4..f8f5532 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -206,8 +206,25 @@ class DownloadInProgressConfirmDialogDelegate : public views::DialogDelegate, : browser_(browser) { int download_count = browser->profile()->GetDownloadManager()-> in_progress_count(); - label_ = new views::Label(l10n_util::GetStringF( - IDS_DOWNLOAD_REMOVE_CONFIRM_TITLE, download_count)); + + std::wstring label_text; + if (download_count == 1) { + label_text = + l10n_util::GetString(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE); + ok_button_text_ = l10n_util::GetString( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); + cancel_button_text_ = l10n_util::GetString( + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); + } else { + label_text = + l10n_util::GetStringF(IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE, + download_count); + ok_button_text_ = l10n_util::GetString( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL); + cancel_button_text_ = l10n_util::GetString( + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); + } + label_ = new views::Label(label_text); label_->SetMultiLine(true); label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); label_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10)); @@ -232,11 +249,10 @@ class DownloadInProgressConfirmDialogDelegate : public views::DialogDelegate, virtual std::wstring GetDialogButtonLabel( MessageBoxFlags::DialogButton button) const { if (button == MessageBoxFlags::DIALOGBUTTON_OK) - return l10n_util::GetString(IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL); + return ok_button_text_; DCHECK_EQ(MessageBoxFlags::DIALOGBUTTON_CANCEL, button); - return l10n_util::GetString( - IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL); + return cancel_button_text_; } virtual bool Accept() { @@ -264,6 +280,9 @@ class DownloadInProgressConfirmDialogDelegate : public views::DialogDelegate, Browser* browser_; views::Label* label_; + std::wstring ok_button_text_; + std::wstring cancel_button_text_; + DISALLOW_COPY_AND_ASSIGN(DownloadInProgressConfirmDialogDelegate); }; -- cgit v1.1