diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 06:09:27 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 06:09:27 +0000 |
commit | 1997ef8f2173f1382acd68ff5521e3c0ffb9d45d (patch) | |
tree | 6f11b10b8d80911869a6b8bce5796adf0e4d4495 | |
parent | f6f60dd8dfc356f4a4029a7e2f2e7550a15ecebd (diff) | |
download | chromium_src-1997ef8f2173f1382acd68ff5521e3c0ffb9d45d.zip chromium_src-1997ef8f2173f1382acd68ff5521e3c0ffb9d45d.tar.gz chromium_src-1997ef8f2173f1382acd68ff5521e3c0ffb9d45d.tar.bz2 |
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
-rw-r--r-- | chrome/app/generated_resources.grd | 17 | ||||
-rw-r--r-- | 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. --> </message> <!-- Remove in-progress downloads confirmation dialog --> - <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_TITLE" desc="Title of the dialog asking for user confirmation to close the browser when downloads are in-progress."> - You have <ph name="DOWNLOAD_COUNT">$1<ex>3</ex></ph> download(s) in progress. If you close Google Chrome now, these downloads will be canceled. + <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE" desc="Title of the dialog asking for user confirmation to close the browser when one download is in-progress."> + You have one download in progress. If you close Google Chrome now, this download will be canceled. </message> - <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the browser when downloads are in-progress."> + <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE" desc="Title of the dialog asking for user confirmation to close the browser when multiple downloads are in-progress."> + You have <ph name="DOWNLOAD_COUNT">$1<ex>3</ex></ph> downloads in progress. If you close Google Chrome now, these downloads will be canceled. + </message> + <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the browser when a single download is in-progress."> + Close and cancel download + </message> + <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the browser when multiple downloads are in-progress."> Close and cancel downloads </message> - <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL" desc="Button text for canceling the closing of the browser when downloads are in-progress."> + <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL" desc="Button text for canceling the closing of the browser when a single download is in-progress."> + Wait for download to finish + </message> + <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL" desc="Button text for canceling the closing of the browser when downloads are in-progress."> Wait for downloads to finish </message> 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); }; |