Change the "close Chrome with downloads in progress" dialog to resemble kenmoore's mock
from issue 122037. Also use different text when exiting incognito mode (issue 88421).
BUG=122037,88421
TEST=manual
Review URL: http://codereview.chromium.org/9969193
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133977 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index 86499705..d3986b5 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -593,17 +593,14 @@
</message>
<!-- Remove in-progress downloads confirmation dialog -->
- <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING" desc="Title of the dialog asking for user confirmation to close the browser when one download is in-progress.">
- Do you want to exit Chromium with a download in progress?
+ <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when one download is in progress.">
+ A download is currently in progress. Do you want to exit Chromium and cancel the download?
</message>
- <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING" desc="Title of the dialog asking for user confirmation to close the browser when multiple downloads are in-progress.">
- Do you want to exit Chromium with <ph name="DOWNLOAD_COUNT">$1<ex>3</ex></ph> downloads in progress?
+ <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when multiple downloads are in progress.">
+ Downloads are currently in progress. Do you want to exit Chromium and cancel the downloads?
</message>
- <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when one download is in-progress.">
- If you close Chromium now, this download will be canceled.
- </message>
- <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when multiple downloads are in-progress.">
- If you close Chromium now, these downloads will be canceled.
+ <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the browser when one or more downloads are in progress.">
+ Yes, exit Chromium
</message>
<!-- "Create application shortcuts" dialog -->
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3bfbf50..4fa330e2 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -2757,17 +2757,29 @@
</if>
<!-- Remove in-progress downloads confirmation dialog -->
- <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 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.">
+ Download in progress
</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 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.">
+ Downloads in progress
</message>
- <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 name="IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_TITLE" desc="Title of the dialog asking for user confirmation to close the last incognito window when one incognito download is in progress.">
+ Incognito download in progress
</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 name="IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_TITLE" desc="Title of the dialog asking for user confirmation to close the last incognito window when multiple incognito downloads are in progress.">
+ Incognito downloads in progress
+ </message>
+ <message name="IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the last incognito window when one incognito download is in progress.">
+ An incognito download is currently in progress. Do you want to exit incognito mode and cancel the download?
+ </message>
+ <message name="IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the last incognito window when multiple incognito downloads are in progress.">
+ Incognito downloads are currently in progress. Do you want to exit incognito mode and cancel the downloads?
+ </message>
+ <message name="IDS_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the last incognito window when one or more incognito downloads are in progress.">
+ Yes, exit incognito mode
+ </message>
+ <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL" desc="Button text for canceling the closing of the browser or the last incognito window when one or more downloads are in progress.">
+ No
</message>
<!-- "Create application shortcuts" menu item -->
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 0642bd6..f23fef3f 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -518,17 +518,14 @@
</message>
<!-- Remove in-progress downloads confirmation dialog -->
- <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING" desc="Title of the dialog asking for user confirmation to close the browser when one download is in-progress.">
- Do you want to exit Google Chrome with a download in progress?
+ <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when one download is in progress.">
+ A download is currently in progress. Do you want to exit Google Chrome and cancel the download?
</message>
- <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING" desc="Title of the dialog asking for user confirmation to close the browser when multiple downloads are in-progress.">
- Do you want to exit Google Chrome with <ph name="DOWNLOAD_COUNT">$1<ex>3</ex></ph> downloads in progress?
+ <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when multiple downloads are in progress.">
+ Downloads are currently in progress. Do you want to exit Google Chrome and cancel the downloads?
</message>
- <message name="IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when one download is in-progress.">
- If you close Google Chrome now, this download will be canceled.
- </message>
- <message name="IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION" desc="Explanation of the dialog asking for user confirmation to close the browser when multiple downloads are in-progress.">
- If you close Google Chrome now, these downloads will be canceled.
+ <message name="IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL" desc="Button text for OKing to close the browser when one or more downloads are in progress.">
+ Yes, exit Chrome
</message>
<!-- "Create application shortcuts" dialog -->
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 3097714..5612008 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -627,7 +627,7 @@
// Helper function for populating and displaying the in progress downloads at
// exit alert panel.
- (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount {
- NSString* warningText = nil;
+ NSString* titleText = nil;
NSString* explanationText = nil;
NSString* waitTitle = nil;
NSString* exitTitle = nil;
@@ -635,37 +635,28 @@
// Set the dialog text based on whether or not there are multiple downloads.
if (downloadCount == 1) {
// Dialog text: warning and explanation.
- warningText = l10n_util::GetNSString(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING);
+ titleText = l10n_util::GetNSString(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE);
explanationText = l10n_util::GetNSString(
IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
-
- // Cancel download and exit button text.
- exitTitle = l10n_util::GetNSString(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
-
- // Wait for download button text.
- waitTitle = l10n_util::GetNSString(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
} else {
// Dialog text: warning and explanation.
- warningText = l10n_util::GetNSStringF(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING,
+ titleText = l10n_util::GetNSStringF(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE,
base::IntToString16(downloadCount));
explanationText = l10n_util::GetNSString(
IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
-
- // Cancel downloads and exit button text.
- exitTitle = l10n_util::GetNSString(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL);
-
- // Wait for downloads button text.
- waitTitle = l10n_util::GetNSString(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
}
+ // Cancel download and exit button text.
+ exitTitle = l10n_util::GetNSString(
+ IDS_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
+
+ // Wait for download button text.
+ waitTitle = l10n_util::GetNSString(
+ IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
// 'waitButton' is the default choice.
- int choice = NSRunAlertPanel(warningText, explanationText,
+ int choice = NSRunAlertPanel(titleText, explanationText,
waitTitle, exitTitle, nil);
return choice == NSAlertDefaultReturn ? YES : NO;
}
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 b619a40..8d30d40 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 @@
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 @@
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",
diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
index 91ad0f5..9079800b 100644
--- a/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
+++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view.cc
@@ -15,7 +15,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/size.h"
#include "ui/views/border.h"
-#include "ui/views/controls/label.h"
+#include "ui/views/controls/message_box_view.h"
#include "ui/views/layout/grid_layout.h"
#include "ui/views/widget/widget.h"
@@ -29,84 +29,60 @@
DownloadInProgressDialogView::DownloadInProgressDialogView(Browser* browser)
: browser_(browser),
- warning_(NULL),
- explanation_(NULL) {
+ message_box_view_(NULL) {
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.
-
- string16 warning_text;
string16 explanation_text;
- if (download_count == 1) {
- warning_text = l10n_util::GetStringUTF16(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING);
- explanation_text = l10n_util::GetStringUTF16(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
- ok_button_text_ = l10n_util::GetStringUTF16(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
- cancel_button_text_ = l10n_util::GetStringUTF16(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
- } else {
- warning_text = l10n_util::GetStringFUTF16(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING,
- base::IntToString16(download_count));
- explanation_text = l10n_util::GetStringUTF16(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
- ok_button_text_ = l10n_util::GetStringUTF16(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL);
- cancel_button_text_ = l10n_util::GetStringUTF16(
- 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::GetStringUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_TITLE);
+ explanation_text = l10n_util::GetStringUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
+ } else {
+ title_text_ = l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_TITLE);
+ explanation_text = l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
+ }
+ ok_button_text_ = l10n_util::GetStringUTF16(
+ 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::GetStringUTF16(
+ IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_TITLE);
+ explanation_text = l10n_util::GetStringUTF16(
+ IDS_SINGLE_INCOGNITO_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION);
+ } else {
+ title_text_ = l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_TITLE);
+ explanation_text = l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_INCOGNITO_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION);
+ }
+ ok_button_text_ = l10n_util::GetStringUTF16(
+ 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();
}
+ cancel_button_text_ = l10n_util::GetStringUTF16(
+ IDS_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
- // There are two lines of text: the bold warning label and the text
- // explanation label.
- views::GridLayout* layout = new views::GridLayout(this);
- SetLayoutManager(layout);
- const int columnset_id = 0;
- views::ColumnSet* column_set = layout->AddColumnSet(columnset_id);
- column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::LEADING, 1,
- views::GridLayout::USE_PREF, 0, 0);
-
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- gfx::Font bold_font = rb.GetFont(
- ui::ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
- warning_ = new views::Label(warning_text, bold_font);
- warning_->SetMultiLine(true);
- warning_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- warning_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10));
- layout->StartRow(0, columnset_id);
- layout->AddView(warning_);
-
- explanation_ = new views::Label(explanation_text);
- explanation_->SetMultiLine(true);
- explanation_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- explanation_->set_border(views::Border::CreateEmptyBorder(10, 10, 10, 10));
- layout->StartRow(0, columnset_id);
- layout->AddView(explanation_);
-
- dialog_dimensions_ = views::Widget::GetLocalizedContentsSize(
- IDS_DOWNLOAD_IN_PROGRESS_WIDTH_CHARS,
- IDS_DOWNLOAD_IN_PROGRESS_MINIMUM_HEIGHT_LINES);
- const int height =
- warning_->GetHeightForWidth(dialog_dimensions_.width()) +
- explanation_->GetHeightForWidth(dialog_dimensions_.width());
- dialog_dimensions_.set_height(std::max(height,
- dialog_dimensions_.height()));
+ message_box_view_ = new views::MessageBoxView(
+ views::MessageBoxView::NO_OPTIONS, explanation_text, string16());
}
DownloadInProgressDialogView::~DownloadInProgressDialogView() {}
-gfx::Size DownloadInProgressDialogView::GetPreferredSize() {
- return dialog_dimensions_;
+int DownloadInProgressDialogView::GetDefaultDialogButton() const {
+ return ui::DIALOG_BUTTON_CANCEL;
}
string16 DownloadInProgressDialogView::GetDialogButtonLabel(
@@ -115,10 +91,6 @@
ok_button_text_ : cancel_button_text_;
}
-int DownloadInProgressDialogView::GetDefaultDialogButton() const {
- return ui::DIALOG_BUTTON_CANCEL;
-}
-
bool DownloadInProgressDialogView::Cancel() {
browser_->InProgressDownloadResponse(false);
return true;
@@ -134,9 +106,21 @@
}
string16 DownloadInProgressDialogView::GetWindowTitle() const {
- return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+ return title_text_;
+}
+
+void DownloadInProgressDialogView::DeleteDelegate() {
+ delete this;
+}
+
+views::Widget* DownloadInProgressDialogView::GetWidget() {
+ return message_box_view_->GetWidget();
+}
+
+const views::Widget* DownloadInProgressDialogView::GetWidget() const {
+ return message_box_view_->GetWidget();
}
views::View* DownloadInProgressDialogView::GetContentsView() {
- return this;
+ return message_box_view_;
}
diff --git a/chrome/browser/ui/views/download/download_in_progress_dialog_view.h b/chrome/browser/ui/views/download/download_in_progress_dialog_view.h
index 0540d7d..8b7960d6 100644
--- a/chrome/browser/ui/views/download/download_in_progress_dialog_view.h
+++ b/chrome/browser/ui/views/download/download_in_progress_dialog_view.h
@@ -13,10 +13,10 @@
class Browser;
namespace views {
-class Label;
+class MessageBoxView;
}
-class DownloadInProgressDialogView : public views::DialogDelegateView {
+class DownloadInProgressDialogView : public views::DialogDelegate {
public:
static void Show(Browser* browser, gfx::NativeWindow parent_window);
@@ -24,22 +24,24 @@
explicit DownloadInProgressDialogView(Browser* browser);
virtual ~DownloadInProgressDialogView();
- // views::View:
- virtual gfx::Size GetPreferredSize() OVERRIDE;
-
- // views::DialogDelegateView:
- virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
+ // views::DialogDelegate:
virtual int GetDefaultDialogButton() const OVERRIDE;
+ virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
virtual bool Cancel() OVERRIDE;
virtual bool Accept() OVERRIDE;
+
+ // views::WidgetDelegate:
virtual ui::ModalType GetModalType() const OVERRIDE;
virtual string16 GetWindowTitle() const OVERRIDE;
+ virtual void DeleteDelegate() OVERRIDE;
+ virtual views::Widget* GetWidget() OVERRIDE;
+ virtual const views::Widget* GetWidget() const OVERRIDE;
virtual views::View* GetContentsView() OVERRIDE;
Browser* browser_;
- views::Label* warning_;
- views::Label* explanation_;
+ views::MessageBoxView* message_box_view_;
+ string16 title_text_;
string16 ok_button_text_;
string16 cancel_button_text_;