| Index: chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.cc
|
| diff --git a/chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.cc b/chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.cc
|
| index b619a40fa26776621f2b7cf6b82663e040203dfd..8d30d407c053e13c7dbef48e00e72b91f8b02fdd 100644
|
| --- a/chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.cc
|
| +++ b/chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.cc
|
| @@ -25,42 +25,51 @@ DownloadInProgressDialogGtk::DownloadInProgressDialogGtk(
|
| gfx::NativeWindow parent_window)
|
| : browser_(browser) {
|
| int download_count;
|
| - Browser::DownloadClosePreventionType type =
|
| + Browser::DownloadClosePreventionType dialog_type =
|
| browser_->OkToCloseWithInProgressDownloads(&download_count);
|
|
|
| - // This dialog should have been created within the same thread invocation
|
| - // as the original test that lead to us, so it should always not be ok
|
| - // to close.
|
| - DCHECK_NE(Browser::DOWNLOAD_CLOSE_OK, type);
|
| -
|
| - // TODO(rdsmith): This dialog should be different depending on whether we're
|
| - // closing the last incognito window of a profile or doing browser shutdown.
|
| - // See http://crbug.com/88421.
|
| -
|
| - std::string warning_text;
|
| + std::string title_text;
|
| std::string explanation_text;
|
| std::string ok_button_text;
|
| - std::string cancel_button_text;
|
| - if (download_count == 1) {
|
| - warning_text = l10n_util::GetStringUTF8(
|
| - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING);
|
| - explanation_text = l10n_util::GetStringUTF8(
|
| - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
|
| - ok_button_text = l10n_util::GetStringUTF8(
|
| - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
|
| - cancel_button_text = l10n_util::GetStringUTF8(
|
| - IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
|
| - } else {
|
| - warning_text = l10n_util::GetStringFUTF8(
|
| - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING,
|
| - base::IntToString16(download_count));
|
| - explanation_text = l10n_util::GetStringUTF8(
|
| - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
|
| - ok_button_text = l10n_util::GetStringUTF8(
|
| - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL);
|
| - cancel_button_text = l10n_util::GetStringUTF8(
|
| - IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
|
| + switch (dialog_type) {
|
| + case Browser::DOWNLOAD_CLOSE_BROWSER_SHUTDOWN:
|
| + if (download_count == 1) {
|
| + title_text = l10n_util::GetStringUTF8(
|
| + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE);
|
| + explanation_text = l10n_util::GetStringUTF8(
|
| + IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
|
| + } else {
|
| + title_text = l10n_util::GetStringUTF8(
|
| + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE);
|
| + explanation_text = l10n_util::GetStringUTF8(
|
| + IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
|
| + }
|
| + ok_button_text = l10n_util::GetStringUTF8(
|
| + IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
|
| + break;
|
| + case Browser::DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE:
|
| + if (download_count == 1) {
|
| + title_text = l10n_util::GetStringUTF8(
|
| + IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_TITLE);
|
| + explanation_text = l10n_util::GetStringUTF8(
|
| + IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
|
| + } else {
|
| + title_text = l10n_util::GetStringUTF8(
|
| + IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_TITLE);
|
| + explanation_text = l10n_util::GetStringUTF8(
|
| + IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
|
| + }
|
| + ok_button_text = l10n_util::GetStringUTF8(
|
| + IDS_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
|
| + break;
|
| + default:
|
| + // This dialog should have been created within the same thread invocation
|
| + // as the original test that lead to us, so it should always not be ok
|
| + // to close.
|
| + NOTREACHED();
|
| }
|
| + std::string cancel_button_text = l10n_util::GetStringUTF8(
|
| + IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
|
|
|
| GtkWidget* dialog = gtk_message_dialog_new(
|
| parent_window,
|
| @@ -68,11 +77,11 @@ DownloadInProgressDialogGtk::DownloadInProgressDialogGtk(
|
| GTK_MESSAGE_QUESTION,
|
| GTK_BUTTONS_NONE,
|
| "%s",
|
| - warning_text.c_str());
|
| - gtk_util::AddButtonToDialog(dialog, cancel_button_text.c_str(),
|
| - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
|
| - gtk_util::AddButtonToDialog(dialog, ok_button_text.c_str(),
|
| - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
|
| + title_text.c_str());
|
| + gtk_dialog_add_button(GTK_DIALOG(dialog),
|
| + cancel_button_text.c_str(), GTK_RESPONSE_REJECT);
|
| + gtk_dialog_add_button(GTK_DIALOG(dialog),
|
| + ok_button_text.c_str(), GTK_RESPONSE_ACCEPT);
|
|
|
| gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
| "%s",
|
|
|