diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 02:43:47 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 02:43:47 +0000 |
commit | 269f86de339fdf6e9e539c7350a1035ae78fddf7 (patch) | |
tree | a01853c7b2e36dc4d830fff87fe173a8ee3418b1 | |
parent | 857ecf3fa1b779a9238c881a96001a9adf440b08 (diff) | |
download | chromium_src-269f86de339fdf6e9e539c7350a1035ae78fddf7.zip chromium_src-269f86de339fdf6e9e539c7350a1035ae78fddf7.tar.gz chromium_src-269f86de339fdf6e9e539c7350a1035ae78fddf7.tar.bz2 |
views: Add an Options enum to MessageBoxView control.
R=sky@chromium.org
TBR=jam@chromium.org
Review URL: http://codereview.chromium.org/8553001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113331 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 165 insertions, 204 deletions
diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc index 6bcf303..b293fe6 100644 --- a/chrome/browser/chromeos/external_protocol_dialog.cc +++ b/chrome/browser/chromeos/external_protocol_dialog.cc @@ -17,7 +17,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/base/text/text_elider.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -109,7 +108,7 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, elided_url_without_scheme) + ASCIIToUTF16("\n\n"); message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kIsConfirmMessageBox, + views::MessageBoxView::NO_OPTIONS, message_text, string16(), kMessageWidth); diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index da5957d..9a1844b 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -25,7 +25,6 @@ #include "content/public/common/url_constants.h" #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/message_box_flags.h" #include "webkit/glue/webkit_glue.h" using content::BrowserThread; @@ -1677,7 +1676,7 @@ TEST_F(TabContentsTest, NoJSMessageOnInterstitials) { bool did_suppress_message = false; contents()->RunJavaScriptMessage(contents()->render_view_host(), ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), - kGURL, ui::MessageBoxFlags::kIsJavascriptAlert, dummy_message, + kGURL, ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, &did_suppress_message); EXPECT_TRUE(did_suppress_message); } diff --git a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc index be579cd..d48a722 100644 --- a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc +++ b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc @@ -50,7 +50,7 @@ JavaScriptAppModalDialog::JavaScriptAppModalDialog( content::JavaScriptDialogDelegate* delegate, ChromeJavaScriptDialogExtraData* extra_data, const string16& title, - int dialog_flags, + ui::JavascriptMessageType javascript_message_type, const string16& message_text, const string16& default_prompt_text, bool display_suppress_checkbox, @@ -58,7 +58,7 @@ JavaScriptAppModalDialog::JavaScriptAppModalDialog( IPC::Message* reply_msg) : AppModalDialog(delegate, title), extra_data_(extra_data), - dialog_flags_(dialog_flags), + javascript_message_type_(javascript_message_type), display_suppress_checkbox_(display_suppress_checkbox), is_before_unload_dialog_(is_before_unload_dialog), reply_msg_(reply_msg), diff --git a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h index 29dd8be..486e5cc 100644 --- a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h +++ b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h @@ -41,7 +41,7 @@ class JavaScriptAppModalDialog : public AppModalDialog { JavaScriptAppModalDialog(content::JavaScriptDialogDelegate* delegate, ChromeJavaScriptDialogExtraData* extra_data, const string16& title, - int dialog_flags, + ui::JavascriptMessageType javascript_message_type, const string16& message_text, const string16& default_prompt_text, bool display_suppress_checkbox, @@ -68,7 +68,9 @@ class JavaScriptAppModalDialog : public AppModalDialog { void SetOverridePromptText(const string16& prompt_text); // Accessors - int dialog_flags() const { return dialog_flags_; } + ui::JavascriptMessageType javascript_message_type() const { + return javascript_message_type_; + } string16 message_text() const { return message_text_; } string16 default_prompt_text() const { return default_prompt_text_; } bool display_suppress_checkbox() const { return display_suppress_checkbox_; } @@ -83,7 +85,7 @@ class JavaScriptAppModalDialog : public AppModalDialog { ChromeJavaScriptDialogExtraData* extra_data_; // Information about the message box is held in the following variables. - int dialog_flags_; + const ui::JavascriptMessageType javascript_message_type_; string16 message_text_; string16 default_prompt_text_; bool display_suppress_checkbox_; diff --git a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc index 9dc374a..f189ed2 100644 --- a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc +++ b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc @@ -15,21 +15,22 @@ #include "chrome/common/chrome_constants.h" #include "content/browser/javascript_dialogs.h" #include "grit/generated_resources.h" +#include "ui/base/javascript_message_type.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" class ChromeJavaScriptDialogCreator : public content::JavaScriptDialogCreator { public: static ChromeJavaScriptDialogCreator* GetInstance(); - virtual void RunJavaScriptDialog(content::JavaScriptDialogDelegate* delegate, - TitleType title_type, - const string16& title, - int dialog_flags, - const string16& message_text, - const string16& default_prompt_text, - IPC::Message* reply_message, - bool* did_suppress_message) OVERRIDE; + virtual void RunJavaScriptDialog( + content::JavaScriptDialogDelegate* delegate, + TitleType title_type, + const string16& title, + ui::JavascriptMessageType javascript_message_type, + const string16& message_text, + const string16& default_prompt_text, + IPC::Message* reply_message, + bool* did_suppress_message) OVERRIDE; virtual void RunBeforeUnloadDialog( content::JavaScriptDialogDelegate* delegate, @@ -75,7 +76,7 @@ void ChromeJavaScriptDialogCreator::RunJavaScriptDialog( content::JavaScriptDialogDelegate* delegate, TitleType title_type, const string16& title, - int dialog_flags, + ui::JavascriptMessageType javascript_message_type, const string16& message_text, const string16& default_prompt_text, IPC::Message* reply_message, @@ -101,14 +102,14 @@ void ChromeJavaScriptDialogCreator::RunJavaScriptDialog( display_suppress_checkbox = true; } - bool is_alert = dialog_flags == ui::MessageBoxFlags::kIsJavascriptAlert; + bool is_alert = javascript_message_type == ui::JAVASCRIPT_MESSAGE_TYPE_ALERT; string16 dialog_title = GetTitle(title_type, title, is_alert); AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( delegate, extra_data, dialog_title, - dialog_flags, + javascript_message_type, message_text, default_prompt_text, display_suppress_checkbox, @@ -130,7 +131,7 @@ void ChromeJavaScriptDialogCreator::RunBeforeUnloadDialog( delegate, extra_data, l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), - ui::MessageBoxFlags::kIsJavascriptConfirm, + ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, full_message, string16(), // default_prompt_text false, // display_suppress_checkbox diff --git a/chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h b/chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h index c97f5ad..2f1fc21 100644 --- a/chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h +++ b/chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,8 +12,8 @@ class JavaScriptAppModalDialog; class NativeAppModalDialog { public: - // Returns the buttons to be shown. See MessageBoxFlags for a description of - // the values. + // Returns the buttons to be shown. See ui::DialogButton for which buttons can + // be returned. virtual int GetAppModalDialogButtons() const = 0; // Shows the dialog. diff --git a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm index 0defd12..ea3acd4 100644 --- a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm +++ b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm @@ -14,7 +14,6 @@ #include "grit/generated_resources.h" #include "grit/ui_strings.h" #include "ui/base/l10n/l10n_util_mac.h" -#include "ui/base/message_box_flags.h" #include "ui/base/ui_base_types.h" // Helper object that receives the notification that the dialog/sheet is @@ -106,11 +105,11 @@ JSModalDialogCocoa::JSModalDialogCocoa(JavaScriptAppModalDialog* dialog) NSString* other_button = l10n_util::GetNSStringWithFixup(IDS_APP_CANCEL); bool text_field = false; bool one_button = false; - switch (dialog_->dialog_flags()) { - case ui::MessageBoxFlags::kIsJavascriptAlert: + switch (dialog_->javascript_message_type()) { + case ui::JAVASCRIPT_MESSAGE_TYPE_ALERT: one_button = true; break; - case ui::MessageBoxFlags::kIsJavascriptConfirm: + case ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: if (dialog_->is_before_unload_dialog()) { default_button = l10n_util::GetNSStringWithFixup( IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); @@ -118,7 +117,7 @@ JSModalDialogCocoa::JSModalDialogCocoa(JavaScriptAppModalDialog* dialog) IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); } break; - case ui::MessageBoxFlags::kIsJavascriptPrompt: + case ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT: text_field = true; break; diff --git a/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc index 2037b29..46bd7a9 100644 --- a/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc @@ -13,7 +13,6 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/base/ui_base_types.h" namespace { @@ -56,13 +55,13 @@ JSModalDialogGtk::JSModalDialogGtk(JavaScriptAppModalDialog* dialog, // We add in the OK button manually later because we want to focus it // explicitly. - switch (dialog_->dialog_flags()) { - case ui::MessageBoxFlags::kIsJavascriptAlert: + switch (dialog_->javascript_message_type()) { + case ui::JAVASCRIPT_MESSAGE_TYPE_ALERT: buttons = GTK_BUTTONS_NONE; message_type = GTK_MESSAGE_WARNING; break; - case ui::MessageBoxFlags::kIsJavascriptConfirm: + case ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: if (dialog_->is_before_unload_dialog()) { // onbeforeunload also uses a confirm prompt, it just has custom // buttons. We add the buttons using gtk_dialog_add_button below. @@ -73,7 +72,7 @@ JSModalDialogGtk::JSModalDialogGtk(JavaScriptAppModalDialog* dialog, message_type = GTK_MESSAGE_QUESTION; break; - case ui::MessageBoxFlags::kIsJavascriptPrompt: + case ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT: buttons = GTK_BUTTONS_CANCEL; message_type = GTK_MESSAGE_QUESTION; break; @@ -97,7 +96,8 @@ JSModalDialogGtk::JSModalDialogGtk(JavaScriptAppModalDialog* dialog, // Adjust content area as needed. Set up the prompt text entry or // suppression check box. - if (ui::MessageBoxFlags::kIsJavascriptPrompt == dialog_->dialog_flags()) { + if (dialog_->javascript_message_type() == + ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { GtkWidget* content_area = gtk_dialog_get_content_area(GTK_DIALOG(gtk_dialog_)); GtkWidget* text_box = gtk_entry_new(); @@ -133,7 +133,8 @@ JSModalDialogGtk::JSModalDialogGtk(JavaScriptAppModalDialog* dialog, // Add the OK button and focus it. GtkWidget* ok_button = gtk_dialog_add_button(GTK_DIALOG(gtk_dialog_), GTK_STOCK_OK, GTK_RESPONSE_OK); - if (ui::MessageBoxFlags::kIsJavascriptPrompt != dialog_->dialog_flags()) + if (dialog_->javascript_message_type() != + ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) gtk_widget_grab_focus(ok_button); } @@ -148,14 +149,14 @@ JSModalDialogGtk::~JSModalDialogGtk() { // JSModalDialogGtk, NativeAppModalDialog implementation: int JSModalDialogGtk::GetAppModalDialogButtons() const { - switch (dialog_->dialog_flags()) { - case ui::MessageBoxFlags::kIsJavascriptAlert: + switch (dialog_->javascript_message_type()) { + case ui::JAVASCRIPT_MESSAGE_TYPE_ALERT: return ui::DIALOG_BUTTON_OK; - case ui::MessageBoxFlags::kIsJavascriptConfirm: + case ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; - case ui::MessageBoxFlags::kIsJavascriptPrompt: + case ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT: return ui::DIALOG_BUTTON_OK; default: diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc index ff9725e..f63580c 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc @@ -16,7 +16,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/base/text/text_elider.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -147,7 +146,7 @@ ExternalProtocolDialog::ExternalProtocolDialog(TabContents* tab_contents, message_text += l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING); message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kIsConfirmMessageBox, + views::MessageBoxView::NO_OPTIONS, message_text, string16(), kMessageWidth); diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc index 6c23621..dad8f9b 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.cc +++ b/chrome/browser/ui/views/js_modal_dialog_views.cc @@ -11,7 +11,6 @@ #include "grit/generated_resources.h" #include "ui/base/keycodes/keyboard_codes.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/controls/textfield/textfield.h" #include "ui/views/widget/widget.h" @@ -19,13 +18,15 @@ //////////////////////////////////////////////////////////////////////////////// // JSModalDialogViews, public: -JSModalDialogViews::JSModalDialogViews( - JavaScriptAppModalDialog* parent) - : parent_(parent), - message_box_view_(new views::MessageBoxView( - parent->dialog_flags() | ui::MessageBoxFlags::kAutoDetectAlignment, - parent->message_text(), - parent->default_prompt_text())) { +JSModalDialogViews::JSModalDialogViews(JavaScriptAppModalDialog* parent) + : parent_(parent) { + int options = views::MessageBoxView::DETECT_ALIGNMENT; + if (parent->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) + options |= views::MessageBoxView::HAS_PROMPT_FIELD; + + message_box_view_ = new views::MessageBoxView(options, + parent->message_text(), + parent->default_prompt_text()); DCHECK(message_box_view_); message_box_view_->AddAccelerator( @@ -71,31 +72,23 @@ void JSModalDialogViews::CancelAppModalDialog() { // JSModalDialogViews, views::DialogDelegate implementation: int JSModalDialogViews::GetDefaultDialogButton() const { - if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasOKButton) + if (parent_->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_ALERT) return ui::DIALOG_BUTTON_OK; - if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasCancelButton) - return ui::DIALOG_BUTTON_CANCEL; - - return ui::DIALOG_BUTTON_NONE; + return ui::DIALOG_BUTTON_CANCEL; } int JSModalDialogViews::GetDialogButtons() const { - int dialog_buttons = ui::DIALOG_BUTTON_NONE; - if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasOKButton) - dialog_buttons = ui::DIALOG_BUTTON_OK; - - if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasCancelButton) - dialog_buttons |= ui::DIALOG_BUTTON_CANCEL; + if (parent_->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_ALERT) + return ui::DIALOG_BUTTON_OK; - return dialog_buttons; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; } string16 JSModalDialogViews::GetWindowTitle() const { return parent_->title(); } - void JSModalDialogViews::WindowClosing() { } diff --git a/chrome/browser/ui/views/repost_form_warning_view.cc b/chrome/browser/ui/views/repost_form_warning_view.cc index 325f80e..36d9290 100644 --- a/chrome/browser/ui/views/repost_form_warning_view.cc +++ b/chrome/browser/ui/views/repost_form_warning_view.cc @@ -14,7 +14,6 @@ #include "content/browser/tab_contents/tab_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" namespace browser { @@ -36,7 +35,7 @@ RepostFormWarningView::RepostFormWarningView( : controller_(new RepostFormWarningController(tab_contents)), message_box_view_(NULL) { message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kIsConfirmMessageBox, + views::MessageBoxView::NO_OPTIONS, l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING), string16()); TabContentsWrapper* wrapper = diff --git a/chrome/browser/ui/views/restart_message_box.cc b/chrome/browser/ui/views/restart_message_box.cc index 633895e..a85f6e4 100644 --- a/chrome/browser/ui/views/restart_message_box.cc +++ b/chrome/browser/ui/views/restart_message_box.cc @@ -8,7 +8,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -62,8 +61,7 @@ RestartMessageBox::RestartMessageBox(gfx::NativeWindow parent_window) { const int kDialogWidth = 400; // Also deleted when the window closes. message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kFlagHasMessage | - ui::MessageBoxFlags::kFlagHasOKButton, + views::MessageBoxView::NO_OPTIONS, l10n_util::GetStringUTF16(IDS_OPTIONS_RELAUNCH_REQUIRED), string16(), kDialogWidth); diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc index aa55cd1..5581baa 100644 --- a/chrome/browser/ui/views/simple_message_box_views.cc +++ b/chrome/browser/ui/views/simple_message_box_views.cc @@ -11,7 +11,6 @@ #include "chrome/browser/ui/views/window.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -42,24 +41,19 @@ bool ShowYesNoBox(gfx::NativeWindow parent, void SimpleMessageBoxViews::ShowErrorBox(gfx::NativeWindow parent_window, const string16& title, const string16& message) { - int dialog_flags = ui::MessageBoxFlags::kFlagHasMessage | - ui::MessageBoxFlags::kFlagHasOKButton; - // This is a reference counted object so it is given an initial increment // in the constructor with a corresponding decrement in DeleteDelegate(). - new SimpleMessageBoxViews(parent_window, dialog_flags, title, message); + new SimpleMessageBoxViews(parent_window, DIALOG_ERROR, title, message); } bool SimpleMessageBoxViews::ShowYesNoBox(gfx::NativeWindow parent_window, const string16& title, const string16& message) { - int dialog_flags = ui::MessageBoxFlags::kIsConfirmMessageBox; - // This is a reference counted object so it is given an initial increment // in the constructor plus an extra one below to ensure the dialog persists // until we retrieve the user response.. scoped_refptr<SimpleMessageBoxViews> dialog = - new SimpleMessageBoxViews(parent_window, dialog_flags, title, message); + new SimpleMessageBoxViews(parent_window, DIALOG_YES_NO, title, message); // Make sure Chrome doesn't attempt to shut down with the dialog up. g_browser_process->AddRefModule(); @@ -85,16 +79,9 @@ bool SimpleMessageBoxViews::Accept() { } int SimpleMessageBoxViews::GetDialogButtons() const { - // NOTE: It seems unsafe to assume that the flags for OK/cancel will always - // have the same value as the button ids. - int dialog_buttons = ui::DIALOG_BUTTON_NONE; - if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton) - dialog_buttons = ui::DIALOG_BUTTON_OK; - - if (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton) - dialog_buttons |= ui::DIALOG_BUTTON_CANCEL; - - return dialog_buttons; + if (type_ == DIALOG_ERROR) + return ui::DIALOG_BUTTON_OK; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; } string16 SimpleMessageBoxViews::GetDialogButtonLabel( @@ -135,15 +122,16 @@ const views::Widget* SimpleMessageBoxViews::GetWidget() const { // SimpleMessageBoxViews, private: SimpleMessageBoxViews::SimpleMessageBoxViews(gfx::NativeWindow parent_window, - int dialog_flags, + DialogType type, const string16& title, const string16& message) - : dialog_flags_(dialog_flags), + : type_(type), disposition_(DISPOSITION_UNKNOWN) { message_box_title_ = title; - message_box_view_ = new views::MessageBoxView(dialog_flags, - message, - string16()); + message_box_view_ = new views::MessageBoxView( + views::MessageBoxView::NO_OPTIONS, + message, + string16()); browser::CreateViewsWindow(parent_window, this, STYLE_GENERIC)->Show(); // Add reference to be released in DeleteDelegate(). diff --git a/chrome/browser/ui/views/simple_message_box_views.h b/chrome/browser/ui/views/simple_message_box_views.h index 1424885..7b66876 100644 --- a/chrome/browser/ui/views/simple_message_box_views.h +++ b/chrome/browser/ui/views/simple_message_box_views.h @@ -62,8 +62,13 @@ class SimpleMessageBoxViews : public views::DialogDelegate, virtual const views::Widget* GetWidget() const OVERRIDE; private: + enum DialogType { + DIALOG_ERROR, + DIALOG_YES_NO, + }; + SimpleMessageBoxViews(gfx::NativeWindow parent_window, - int dialog_flags, + DialogType type, const string16& title, const string16& message); virtual ~SimpleMessageBoxViews(); @@ -80,7 +85,7 @@ class SimpleMessageBoxViews : public views::DialogDelegate, virtual bool Dispatch(GdkEvent* event) OVERRIDE; #endif - int dialog_flags_; + const DialogType type_; string16 message_box_title_; views::MessageBoxView* message_box_view_; DispositionType disposition_; diff --git a/chrome/browser/ui/views/update_recommended_message_box.cc b/chrome/browser/ui/views/update_recommended_message_box.cc index ae2b945..7c1f696 100644 --- a/chrome/browser/ui/views/update_recommended_message_box.cc +++ b/chrome/browser/ui/views/update_recommended_message_box.cc @@ -12,7 +12,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -99,8 +98,7 @@ UpdateRecommendedMessageBox::UpdateRecommendedMessageBox( const string16 product_name = l10n_util::GetStringUTF16(kProductNameId); // Also deleted when the window closes. message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kFlagHasMessage | - ui::MessageBoxFlags::kFlagHasOKButton, + views::MessageBoxView::NO_OPTIONS, l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED, product_name), string16(), kDialogWidth); diff --git a/chrome/browser/ui/views/user_data_dir_dialog.cc b/chrome/browser/ui/views/user_data_dir_dialog.cc index d466fb3..d924a7c 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog.cc +++ b/chrome/browser/ui/views/user_data_dir_dialog.cc @@ -8,7 +8,6 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/message_box_view.h" #include "ui/views/widget/widget.h" @@ -30,7 +29,7 @@ UserDataDirDialog::UserDataDirDialog(const FilePath& user_data_dir) user_data_dir.LossyDisplayName()); const int kDialogWidth = 400; message_box_view_ = new views::MessageBoxView( - ui::MessageBoxFlags::kIsConfirmMessageBox, + views::MessageBoxView::NO_OPTIONS, message_text, string16(), kDialogWidth); diff --git a/content/browser/javascript_dialogs.h b/content/browser/javascript_dialogs.h index 175c1910..4b1af55 100644 --- a/content/browser/javascript_dialogs.h +++ b/content/browser/javascript_dialogs.h @@ -8,6 +8,7 @@ #include "base/string16.h" #include "content/common/content_export.h" +#include "ui/base/javascript_message_type.h" #include "ui/gfx/native_widget_types.h" namespace IPC { @@ -53,14 +54,15 @@ class JavaScriptDialogCreator { // Displays a JavaScript dialog. |did_suppress_message| will not be nil; if // |true| is returned in it, the caller will handle faking the reply. - virtual void RunJavaScriptDialog(JavaScriptDialogDelegate* delegate, - TitleType title_type, - const string16& title, - int dialog_flags, - const string16& message_text, - const string16& default_prompt_text, - IPC::Message* reply_message, - bool* did_suppress_message) = 0; + virtual void RunJavaScriptDialog( + JavaScriptDialogDelegate* delegate, + TitleType title_type, + const string16& title, + ui::JavascriptMessageType javascript_message_type, + const string16& message_text, + const string16& default_prompt_text, + IPC::Message* reply_message, + bool* did_suppress_message) = 0; // Displays a dialog asking the user if they want to leave a page. virtual void RunBeforeUnloadDialog(JavaScriptDialogDelegate* delegate, diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index d177462..f663f6e 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -1061,14 +1061,14 @@ void RenderViewHost::OnMsgRunJavaScriptMessage( const string16& message, const string16& default_prompt, const GURL& frame_url, - const int flags, + ui::JavascriptMessageType type, IPC::Message* reply_msg) { // While a JS message dialog is showing, tabs in the same process shouldn't // process input events. process()->SetIgnoreInputEvents(true); StopHangMonitorTimeout(); delegate_->RunJavaScriptMessage(this, message, default_prompt, frame_url, - flags, reply_msg, + type, reply_msg, &are_javascript_messages_suppressed_); } diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 99cc989..25f2006 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -25,6 +25,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" +#include "ui/base/javascript_message_type.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/window_open_disposition.h" @@ -552,7 +553,7 @@ class CONTENT_EXPORT RenderViewHost : public RenderWidgetHost { void OnMsgRunJavaScriptMessage(const string16& message, const string16& default_prompt, const GURL& frame_url, - const int flags, + ui::JavascriptMessageType type, IPC::Message* reply_msg); void OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, const string16& message, diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index d0b4255..f1e4ef0 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -19,6 +19,7 @@ #include "net/base/load_states.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" +#include "ui/base/javascript_message_type.h" #include "webkit/glue/window_open_disposition.h" class GURL; @@ -290,7 +291,7 @@ class CONTENT_EXPORT RenderViewHostDelegate : public IPC::Channel::Listener { const string16& message, const string16& default_prompt, const GURL& frame_url, - const int flags, + ui::JavascriptMessageType type, IPC::Message* reply_msg, bool* did_suppress_message) {} diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index e716148..a9d8aa7 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -1797,7 +1797,7 @@ void TabContents::RunJavaScriptMessage( const string16& message, const string16& default_prompt, const GURL& frame_url, - const int flags, + ui::JavascriptMessageType javascript_message_type, IPC::Message* reply_msg, bool* did_suppress_message) { // Suppress JavaScript dialogs when requested. Also suppress messages when @@ -1827,7 +1827,7 @@ void TabContents::RunJavaScriptMessage( dialog_creator_->RunJavaScriptDialog(this, title_type, title, - flags, + javascript_message_type, message, default_prompt, reply_msg, diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 7fa48b9..6a271ad 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -523,7 +523,7 @@ class CONTENT_EXPORT TabContents : public PageNavigator, const string16& message, const string16& default_prompt, const GURL& frame_url, - const int flags, + ui::JavascriptMessageType type, IPC::Message* reply_msg, bool* did_suppress_message) OVERRIDE; virtual void RunBeforeUnloadConfirm(const RenderViewHost* rvh, diff --git a/content/browser/tab_contents/tab_contents_delegate.cc b/content/browser/tab_contents/tab_contents_delegate.cc index e8ca205..f88e99e 100644 --- a/content/browser/tab_contents/tab_contents_delegate.cc +++ b/content/browser/tab_contents/tab_contents_delegate.cc @@ -234,14 +234,15 @@ class JavaScriptDialogCreatorStub : public content::JavaScriptDialogCreator { return Singleton<JavaScriptDialogCreatorStub>::get(); } - virtual void RunJavaScriptDialog(content::JavaScriptDialogDelegate* delegate, - TitleType title_type, - const string16& title, - int dialog_flags, - const string16& message_text, - const string16& default_prompt_text, - IPC::Message* reply_message, - bool* did_suppress_message) OVERRIDE { + virtual void RunJavaScriptDialog( + content::JavaScriptDialogDelegate* delegate, + TitleType title_type, + const string16& title, + ui::JavascriptMessageType javascript_message_type, + const string16& message_text, + const string16& default_prompt_text, + IPC::Message* reply_message, + bool* did_suppress_message) OVERRIDE { *did_suppress_message = true; } diff --git a/content/common/view_messages.h b/content/common/view_messages.h index d818295..5261e7a 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -34,6 +34,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "ui/base/ime/text_input_type.h" +#include "ui/base/javascript_message_type.h" #include "ui/base/range/range.h" #include "ui/gfx/rect.h" #include "webkit/glue/context_menu.h" @@ -70,6 +71,7 @@ IPC_ENUM_TRAITS(content::RendererPreferencesSubpixelRenderingEnum) IPC_ENUM_TRAITS(content::StopFindAction) IPC_ENUM_TRAITS(media::MediaLogEvent::Type) IPC_ENUM_TRAITS(ui::TextInputType) +IPC_ENUM_TRAITS(ui::JavascriptMessageType) IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::BoolAttribute) IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::FloatAttribute) IPC_ENUM_TRAITS(webkit_glue::WebAccessibility::IntAttribute) @@ -1582,7 +1584,7 @@ IPC_SYNC_MESSAGE_ROUTED4_2(ViewHostMsg_RunJavaScriptMessage, string16 /* in - alert message */, string16 /* in - default prompt */, GURL /* in - originating page URL */, - int /* in - dialog flags */, + ui::JavascriptMessageType /* in - type */, bool /* out - success */, string16 /* out - user_input field */) diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 3354cc1..066cea6 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -131,7 +131,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/base/message_box_flags.h" +#include "ui/base/javascript_message_type.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -1283,7 +1283,7 @@ void RenderViewImpl::LoadNavigationErrorPage( replace); } -bool RenderViewImpl::RunJavaScriptMessage(int type, +bool RenderViewImpl::RunJavaScriptMessage(ui::JavascriptMessageType type, const string16& message, const string16& default_value, const GURL& frame_url, @@ -1584,29 +1584,30 @@ bool RenderViewImpl::runFileChooser( return ScheduleFileChooser(ipc_params, chooser_completion); } -void RenderViewImpl::runModalAlertDialog( - WebFrame* frame, const WebString& message) { - RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptAlert, +void RenderViewImpl::runModalAlertDialog(WebFrame* frame, + const WebString& message) { + RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, message, string16(), frame->document().url(), NULL); } -bool RenderViewImpl::runModalConfirmDialog( - WebFrame* frame, const WebString& message) { - return RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptConfirm, +bool RenderViewImpl::runModalConfirmDialog(WebFrame* frame, + const WebString& message) { + return RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, message, string16(), frame->document().url(), NULL); } -bool RenderViewImpl::runModalPromptDialog( - WebFrame* frame, const WebString& message, const WebString& default_value, - WebString* actual_value) { +bool RenderViewImpl::runModalPromptDialog(WebFrame* frame, + const WebString& message, + const WebString& default_value, + WebString* actual_value) { string16 result; - bool ok = RunJavaScriptMessage(ui::MessageBoxFlags::kIsJavascriptPrompt, + bool ok = RunJavaScriptMessage(ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT, message, default_value, frame->document().url(), diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index a5a02a3..5487281 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h @@ -44,6 +44,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebViewClient.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationType.h" +#include "ui/base/javascript_message_type.h" #include "ui/gfx/surface/transport_dib.h" #include "webkit/glue/webpreferences.h" #include "webkit/media/webmediaplayer_delegate.h" @@ -715,7 +716,7 @@ class RenderViewImpl : public RenderWidget, const content::Referrer& referrer, WebKit::WebNavigationPolicy policy); - bool RunJavaScriptMessage(int type, + bool RunJavaScriptMessage(ui::JavascriptMessageType type, const string16& message, const string16& default_value, const GURL& frame_url, diff --git a/ipc/param_traits_macros.h b/ipc/param_traits_macros.h index 9b276e0..05ce403 100644 --- a/ipc/param_traits_macros.h +++ b/ipc/param_traits_macros.h @@ -27,7 +27,7 @@ #define IPC_ENUM_TRAITS(enum_name) \ namespace IPC { \ template <> \ - struct ParamTraits<enum_name> { \ + struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \ typedef enum_name param_type; \ static void Write(Message* m, const param_type& p); \ static bool Read(const Message* m, void** iter, param_type* p); \ diff --git a/ui/base/javascript_message_type.h b/ui/base/javascript_message_type.h new file mode 100644 index 0000000..03e1a83 --- /dev/null +++ b/ui/base/javascript_message_type.h @@ -0,0 +1,21 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_JAVASCRIPT_MESSAGE_TYPE_H_ +#define UI_BASE_JAVASCRIPT_MESSAGE_TYPE_H_ +#pragma once + +#include "ui/base/ui_export.h" + +namespace ui { + +enum UI_EXPORT JavascriptMessageType { + JAVASCRIPT_MESSAGE_TYPE_ALERT, + JAVASCRIPT_MESSAGE_TYPE_CONFIRM, + JAVASCRIPT_MESSAGE_TYPE_PROMPT +}; + +} // namespace ui + +#endif // UI_BASE_JAVASCRIPT_MESSAGE_TYPE_H_ diff --git a/ui/base/message_box_flags.h b/ui/base/message_box_flags.h deleted file mode 100644 index 207a97c..0000000 --- a/ui/base/message_box_flags.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_BASE_MESSAGE_BOX_FLAGS_H_ -#define UI_BASE_MESSAGE_BOX_FLAGS_H_ -#pragma once - -#include "base/basictypes.h" - -namespace ui { - -// This class contains flags used to communicate the type of message box -// to show. E.g., the renderer can request the browser to show a -// javascript alert or a javascript confirm message. -class MessageBoxFlags { - public: - static const int kFlagHasOKButton = 0x1; - static const int kFlagHasCancelButton = 0x2; - static const int kFlagHasPromptField = 0x4; - static const int kFlagHasMessage = 0x8; - - // The following flag is used to indicate whether the message's alignment - // should be autodetected or inherited from Chrome UI. Callers should pass - // the correct flag based on the origin of the message. If the message is - // from a web page (such as the JavaScript alert message), its alignment and - // directionality are based on the first character with strong directionality - // in the message. Chrome UI strings are localized string and therefore they - // should have the same alignment and directionality as those of the Chrome - // UI. For example, in RTL locales, even though some strings might begin with - // an English character, they should still be right aligned and be displayed - // Right-To-Left. - // - // TODO(xji): If the message is from a web page, then the message - // directionality should be determined based on the directionality of the web - // page. Please refer to http://crbug.com/7166 for more information. - static const int kAutoDetectAlignment = 0x10; - - static const int kIsConfirmMessageBox = kFlagHasMessage | - kFlagHasOKButton | - kFlagHasCancelButton; - static const int kIsJavascriptAlert = kFlagHasOKButton | kFlagHasMessage; - static const int kIsJavascriptConfirm = kIsJavascriptAlert | - kFlagHasCancelButton; - static const int kIsJavascriptPrompt = kIsJavascriptConfirm | - kFlagHasPromptField; - - private: - DISALLOW_IMPLICIT_CONSTRUCTORS(MessageBoxFlags); -}; - -} // namespace ui - -#endif // UI_BASE_MESSAGE_BOX_FLAGS_H_ @@ -144,6 +144,7 @@ 'base/ime/text_input_client.cc', 'base/ime/text_input_client.h', 'base/ime/text_input_type.h', + 'base/javascript_message_type.h', 'base/keycodes/keyboard_code_conversion.cc', 'base/keycodes/keyboard_code_conversion.h', 'base/keycodes/keyboard_code_conversion_gtk.cc', @@ -165,7 +166,6 @@ 'base/l10n/l10n_util_posix.cc', 'base/l10n/l10n_util_win.cc', 'base/l10n/l10n_util_win.h', - 'base/message_box_flags.h', 'base/message_box_win.cc', 'base/message_box_win.h', 'base/models/button_menu_item_model.cc', diff --git a/ui/views/controls/message_box_view.cc b/ui/views/controls/message_box_view.cc index 1c27627..6ce3217 100644 --- a/ui/views/controls/message_box_view.cc +++ b/ui/views/controls/message_box_view.cc @@ -10,7 +10,6 @@ #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/scoped_clipboard_writer.h" -#include "ui/base/message_box_flags.h" #include "ui/views/controls/button/checkbox.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" @@ -28,7 +27,7 @@ namespace views { /////////////////////////////////////////////////////////////////////////////// // MessageBoxView, public: -MessageBoxView::MessageBoxView(int dialog_flags, +MessageBoxView::MessageBoxView(int options, const string16& message, const string16& default_prompt, int message_width) @@ -37,10 +36,10 @@ MessageBoxView::MessageBoxView(int dialog_flags, icon_(NULL), checkbox_(NULL), message_width_(message_width) { - Init(dialog_flags, default_prompt); + Init(options, default_prompt); } -MessageBoxView::MessageBoxView(int dialog_flags, +MessageBoxView::MessageBoxView(int options, const string16& message, const string16& default_prompt) : message_label_(new Label(message)), @@ -48,7 +47,7 @@ MessageBoxView::MessageBoxView(int dialog_flags, icon_(NULL), checkbox_(NULL), message_width_(kDefaultMessageWidth) { - Init(dialog_flags, default_prompt); + Init(options, default_prompt); } MessageBoxView::~MessageBoxView() {} @@ -125,11 +124,11 @@ bool MessageBoxView::AcceleratorPressed(const ui::Accelerator& accelerator) { /////////////////////////////////////////////////////////////////////////////// // MessageBoxView, private: -void MessageBoxView::Init(int dialog_flags, +void MessageBoxView::Init(int options, const string16& default_prompt) { message_label_->SetMultiLine(true); message_label_->SetAllowCharacterBreak(true); - if (dialog_flags & ui::MessageBoxFlags::kAutoDetectAlignment) { + if (options & DETECT_ALIGNMENT) { // Determine the alignment and directionality based on the first character // with strong directionality. base::i18n::TextDirection direction = @@ -149,7 +148,7 @@ void MessageBoxView::Init(int dialog_flags, message_label_->SetHorizontalAlignment(Label::ALIGN_LEFT); } - if (dialog_flags & ui::MessageBoxFlags::kFlagHasPromptField) { + if (options & HAS_PROMPT_FIELD) { prompt_field_ = new Textfield; prompt_field_->SetText(default_prompt); } diff --git a/ui/views/controls/message_box_view.h b/ui/views/controls/message_box_view.h index cd81e40..8df16bc 100644 --- a/ui/views/controls/message_box_view.h +++ b/ui/views/controls/message_box_view.h @@ -23,12 +23,18 @@ class Textfield; // and Cancel buttons. class VIEWS_EXPORT MessageBoxView : public View { public: - MessageBoxView(int dialog_flags, + enum Options { + NO_OPTIONS = 0, + DETECT_ALIGNMENT = 1 << 0, + HAS_PROMPT_FIELD = 1 << 1, + }; + + MessageBoxView(int options, const string16& message, const string16& default_prompt, int message_width); - MessageBoxView(int dialog_flags, + MessageBoxView(int options, const string16& message, const string16& default_prompt); @@ -70,7 +76,7 @@ class VIEWS_EXPORT MessageBoxView : public View { private: // Sets up the layout manager and initializes the prompt field. This should // only be called once, from the constructor. - void Init(int dialog_flags, const string16& default_prompt); + void Init(int options, const string16& default_prompt); // Sets up the layout manager based on currently initialized views. Should be // called when a view is initialized or changed. diff --git a/ui/views/examples/message_box_example.cc b/ui/views/examples/message_box_example.cc index 3bb6eb7..c718077 100644 --- a/ui/views/examples/message_box_example.cc +++ b/ui/views/examples/message_box_example.cc @@ -20,7 +20,7 @@ MessageBoxExample::~MessageBoxExample() { void MessageBoxExample::CreateExampleView(View* container) { message_box_view_ = new MessageBoxView( - 0, + views::MessageBoxView::NO_OPTIONS, ASCIIToUTF16("Message Box Message"), ASCIIToUTF16("Default Prompt")); status_ = new TextButton(this, ASCIIToUTF16("Show Status")); |