diff options
63 files changed, 256 insertions, 333 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 8823643..5605bd4 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -103,13 +103,13 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/chrome_view_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -#include "chrome/common/chrome_view_types.h" #include "content/browser/plugin_service.h" #include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" @@ -120,7 +120,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/base/events.h" #include "ui/base/keycodes/keyboard_codes.h" -#include "ui/base/message_box_flags.h" +#include "ui/base/ui_base_types.h" #include "webkit/glue/webdropdata.h" #include "webkit/plugins/webplugininfo.h" @@ -2077,7 +2077,7 @@ void TestingAutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, AppModalDialogQueue::GetInstance()->active_dialog(); if (!active_dialog) { *showing_dialog = false; - *dialog_button = ui::MessageBoxFlags::DIALOGBUTTON_NONE; + *dialog_button = ui::DIALOG_BUTTON_NONE; return; } NativeAppModalDialog* native_dialog = active_dialog->native_dialog(); @@ -2085,7 +2085,7 @@ void TestingAutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, if (*showing_dialog) *dialog_button = native_dialog->GetAppModalDialogButtons(); else - *dialog_button = ui::MessageBoxFlags::DIALOGBUTTON_NONE; + *dialog_button = ui::DIALOG_BUTTON_NONE; } void TestingAutomationProvider::ClickAppModalDialogButton(int button, @@ -2096,13 +2096,11 @@ void TestingAutomationProvider::ClickAppModalDialogButton(int button, AppModalDialogQueue::GetInstance()->active_dialog()->native_dialog(); if (native_dialog && (native_dialog->GetAppModalDialogButtons() & button) == button) { - if ((button & ui::MessageBoxFlags::DIALOGBUTTON_OK) == - ui::MessageBoxFlags::DIALOGBUTTON_OK) { + if ((button & ui::DIALOG_BUTTON_OK) == ui::DIALOG_BUTTON_OK) { native_dialog->AcceptAppModalDialog(); *success = true; } - if ((button & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) == - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) { + if ((button & ui::DIALOG_BUTTON_CANCEL) == ui::DIALOG_BUTTON_CANCEL) { DCHECK(!*success) << "invalid param, OK and CANCEL specified"; native_dialog->CancelAppModalDialog(); *success = true; diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc index 560e720..867f192 100644 --- a/chrome/browser/chromeos/external_protocol_dialog.cc +++ b/chrome/browser/chromeos/external_protocol_dialog.cc @@ -49,11 +49,11 @@ ExternalProtocolDialog::~ExternalProtocolDialog() { // ExternalProtocolDialog, views::DialogDelegate implementation: int ExternalProtocolDialog::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } string16 ExternalProtocolDialog::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT); } diff --git a/chrome/browser/chromeos/external_protocol_dialog.h b/chrome/browser/chromeos/external_protocol_dialog.h index ab75c71..7d240a4 100644 --- a/chrome/browser/chromeos/external_protocol_dialog.h +++ b/chrome/browser/chromeos/external_protocol_dialog.h @@ -31,8 +31,7 @@ class ExternalProtocolDialog : public views::DialogDelegate { // views::DialogDelegate Methods: virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; virtual bool Accept() OVERRIDE; diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc index 54ee771..a31c34a 100644 --- a/chrome/browser/chromeos/login/eula_view.cc +++ b/chrome/browser/chromeos/login/eula_view.cc @@ -98,7 +98,7 @@ class TpmInfoView : public views::DialogDelegateView { virtual bool IsModal() const OVERRIDE { return true; } virtual views::View* GetContentsView() OVERRIDE { return this; } virtual int GetDialogButtons() const OVERRIDE { - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } // views::View overrides: diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc index 791d628..fdb6300 100644 --- a/chrome/browser/chromeos/login/password_changed_view.cc +++ b/chrome/browser/chromeos/login/password_changed_view.cc @@ -50,7 +50,7 @@ bool PasswordChangedView::Accept() { } int PasswordChangedView::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } views::View* PasswordChangedView::GetInitiallyFocusedView() { diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc index 6cfc0b2..2ede7c2 100644 --- a/chrome/browser/chromeos/options/network_config_view.cc +++ b/chrome/browser/chromeos/options/network_config_view.cc @@ -62,16 +62,15 @@ gfx::NativeWindow NetworkConfigView::GetNativeWindow() const { } string16 NetworkConfigView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT); return string16(); } -bool NetworkConfigView::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { +bool NetworkConfigView::IsDialogButtonEnabled(ui::DialogButton button) const { // Disable connect button if cannot login. - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + if (button == ui::DIALOG_BUTTON_OK) return child_config_view_->CanLogin(); return true; } diff --git a/chrome/browser/chromeos/options/network_config_view.h b/chrome/browser/chromeos/options/network_config_view.h index 42c5e26a..c702a7e 100644 --- a/chrome/browser/chromeos/options/network_config_view.h +++ b/chrome/browser/chromeos/options/network_config_view.h @@ -49,10 +49,8 @@ class NetworkConfigView : public views::DialogDelegateView, gfx::NativeWindow GetNativeWindow() const; // views::DialogDelegate methods. - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; virtual views::View* GetExtraView() OVERRIDE; diff --git a/chrome/browser/chromeos/options/take_photo_dialog.cc b/chrome/browser/chromeos/options/take_photo_dialog.cc index d8800c8..24d3919 100644 --- a/chrome/browser/chromeos/options/take_photo_dialog.cc +++ b/chrome/browser/chromeos/options/take_photo_dialog.cc @@ -41,11 +41,10 @@ TakePhotoDialog::TakePhotoDialog(Delegate* delegate) TakePhotoDialog::~TakePhotoDialog() { } -bool TakePhotoDialog::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) +bool TakePhotoDialog::IsDialogButtonEnabled(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_CANCEL) return true; - else if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + else if (button == ui::DIALOG_BUTTON_OK) return !take_photo_view_->is_capturing(); NOTREACHED(); return false; diff --git a/chrome/browser/chromeos/options/take_photo_dialog.h b/chrome/browser/chromeos/options/take_photo_dialog.h index 9feca62..9758cf6 100644 --- a/chrome/browser/chromeos/options/take_photo_dialog.h +++ b/chrome/browser/chromeos/options/take_photo_dialog.h @@ -38,8 +38,7 @@ class TakePhotoDialog : public views::DialogDelegateView, virtual ~TakePhotoDialog(); // views::DialogDelegateView overrides. - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; diff --git a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm index 3e1d783..0defd12 100644 --- a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm +++ b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm @@ -15,6 +15,7 @@ #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 // going away. Is responsible for cleaning itself up. @@ -166,10 +167,9 @@ int JSModalDialogCocoa::GetAppModalDialogButtons() const { int num_buttons = [[alert_ buttons] count]; switch (num_buttons) { case 1: - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; case 2: - return ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; default: NOTREACHED(); return 0; diff --git a/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc index c368740..2037b29 100644 --- a/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/js_modal_dialog_gtk.cc @@ -14,6 +14,7 @@ #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 { @@ -149,14 +150,13 @@ JSModalDialogGtk::~JSModalDialogGtk() { int JSModalDialogGtk::GetAppModalDialogButtons() const { switch (dialog_->dialog_flags()) { case ui::MessageBoxFlags::kIsJavascriptAlert: - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; case ui::MessageBoxFlags::kIsJavascriptConfirm: - return ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; case ui::MessageBoxFlags::kIsJavascriptPrompt: - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; default: NOTREACHED(); diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc index 1b800b2..5a10abb 100644 --- a/chrome/browser/ui/input_window_dialog_win.cc +++ b/chrome/browser/ui/input_window_dialog_win.cc @@ -71,10 +71,8 @@ class ContentView : public views::DialogDelegateView, explicit ContentView(InputWindowDialogWin* delegate); // views::DialogDelegateView: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool Accept() OVERRIDE; virtual bool Cancel() OVERRIDE; virtual void DeleteDelegate() OVERRIDE; @@ -125,9 +123,8 @@ ContentView::ContentView(InputWindowDialogWin* delegate) /////////////////////////////////////////////////////////////////////////////// // ContentView, views::DialogDelegate implementation: -string16 ContentView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) { +string16 ContentView::GetDialogButtonLabel(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) { return l10n_util::GetStringUTF16( delegate_->type() == InputWindowDialog::BUTTON_TYPE_ADD ? IDS_ADD : IDS_SAVE); @@ -135,9 +132,8 @@ string16 ContentView::GetDialogButtonLabel( return string16(); } -bool ContentView::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK && +bool ContentView::IsDialogButtonEnabled(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK && !delegate_->delegate()->IsValid(text_field_->text())) { return false; } diff --git a/chrome/browser/ui/login/login_prompt_win.cc b/chrome/browser/ui/login/login_prompt_win.cc index 8e1f971..3412a26 100644 --- a/chrome/browser/ui/login/login_prompt_win.cc +++ b/chrome/browser/ui/login/login_prompt_win.cc @@ -45,8 +45,8 @@ class LoginHandlerWin : public LoginHandler, // views::DialogDelegate methods: virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const OVERRIDE { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL); return DialogDelegate::GetDialogButtonLabel(button); } diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index 0227d4e..48201d9 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -529,11 +529,10 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add, //////////////////////////////////////////////////////////////////////////////// // AboutChromeView, views::DialogDelegate implementation: -string16 AboutChromeView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) { +string16 AboutChromeView::GetDialogButtonLabel(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) { return l10n_util::GetStringUTF16(IDS_RELAUNCH_AND_UPDATE); - } else if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) { + } else if (button == ui::DIALOG_BUTTON_CANCEL) { if (restart_button_visible_) return l10n_util::GetStringUTF16(IDS_NOT_NOW); // The OK button (which is the default button) has been re-purposed to be @@ -550,19 +549,15 @@ string16 AboutChromeView::GetWindowTitle() const { return l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE); } -bool AboutChromeView::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK && - !restart_button_visible_) +bool AboutChromeView::IsDialogButtonEnabled(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK && !restart_button_visible_) return false; return true; } -bool AboutChromeView::IsDialogButtonVisible( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK && - !restart_button_visible_) +bool AboutChromeView::IsDialogButtonVisible(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK && !restart_button_visible_) return false; return true; @@ -573,7 +568,7 @@ bool AboutChromeView::IsDialogButtonVisible( // OK button (which is the dialog cancel button, see GetDialogButtonLabel // above). int AboutChromeView::GetDefaultDialogButton() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } bool AboutChromeView::CanResize() const { diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h index e8ef825..09cb7b5 100644 --- a/chrome/browser/ui/views/about_chrome_view.h +++ b/chrome/browser/ui/views/about_chrome_view.h @@ -56,12 +56,9 @@ class AboutChromeView : public views::DialogDelegateView, views::View* child) OVERRIDE; // Overridden from views::DialogDelegate: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonVisible( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonVisible(ui::DialogButton button) const OVERRIDE; virtual int GetDefaultDialogButton() const OVERRIDE; virtual bool CanResize() const OVERRIDE; virtual bool CanMaximize() const OVERRIDE; diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc index 18cdc5e..580a63e 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc @@ -88,14 +88,13 @@ BookmarkEditorView::~BookmarkEditorView() { } string16 BookmarkEditorView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_SAVE); return string16(); } -bool BookmarkEditorView::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) { +bool BookmarkEditorView::IsDialogButtonEnabled(ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) { if (details_.type == EditDetails::NEW_FOLDER) return !title_tf_.text().empty(); @@ -118,7 +117,7 @@ string16 BookmarkEditorView::GetWindowTitle() const { } bool BookmarkEditorView::Accept() { - if (!IsDialogButtonEnabled(ui::MessageBoxFlags::DIALOGBUTTON_OK)) { + if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) { if (details_.type != EditDetails::NEW_FOLDER) { // The url is invalid, focus the url field. url_tf_->SelectAll(); @@ -131,8 +130,7 @@ bool BookmarkEditorView::Accept() { return true; } -bool BookmarkEditorView::AreAcceleratorsEnabled( - ui::MessageBoxFlags::DialogButton button) { +bool BookmarkEditorView::AreAcceleratorsEnabled(ui::DialogButton button) { return !show_tree_ || !tree_view_->GetEditingNode(); } diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h index cf807fc..5a35564 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h +++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.h @@ -81,16 +81,13 @@ class BookmarkEditorView : public BookmarkEditor, virtual ~BookmarkEditorView(); // views::DialogDelegateView: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool IsModal() const OVERRIDE; virtual bool CanResize() const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual bool Accept() OVERRIDE; - virtual bool AreAcceleratorsEnabled( - ui::MessageBoxFlags::DialogButton button) OVERRIDE; + virtual bool AreAcceleratorsEnabled(ui::DialogButton button) OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; // views::View: diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index 14f21c0..3e78b2d 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -360,11 +360,11 @@ string16 CollectedCookiesWin::GetWindowTitle() const { } int CollectedCookiesWin::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } string16 CollectedCookiesWin::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { return l10n_util::GetStringUTF16(IDS_CLOSE); } diff --git a/chrome/browser/ui/views/collected_cookies_win.h b/chrome/browser/ui/views/collected_cookies_win.h index a0ec632..28d8e58 100644 --- a/chrome/browser/ui/views/collected_cookies_win.h +++ b/chrome/browser/ui/views/collected_cookies_win.h @@ -46,8 +46,7 @@ class CollectedCookiesWin : public views::DialogDelegate, // views::DialogDelegate: virtual string16 GetWindowTitle() const OVERRIDE; virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; virtual bool Cancel() OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index b99d29d..86efb87 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -324,15 +324,15 @@ gfx::Size CreateApplicationShortcutView::GetPreferredSize() { } string16 CreateApplicationShortcutView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_COMMIT); return string16(); } bool CreateApplicationShortcutView::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return desktop_check_box_->checked() || ((menu_check_box_ != NULL) && menu_check_box_->checked()) || @@ -359,7 +359,7 @@ string16 CreateApplicationShortcutView::GetWindowTitle() const { } bool CreateApplicationShortcutView::Accept() { - if (!IsDialogButtonEnabled(ui::MessageBoxFlags::DIALOGBUTTON_OK)) + if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) return false; shortcut_info_.create_on_desktop = desktop_check_box_->checked(); diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h index 42fde8f..9dc23b5 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.h +++ b/chrome/browser/ui/views/create_application_shortcut_view.h @@ -43,10 +43,8 @@ class CreateApplicationShortcutView : public views::DialogDelegateView, virtual gfx::Size GetPreferredSize() OVERRIDE; // Overridden from views::DialogDelegate: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool CanResize() const OVERRIDE; virtual bool CanMaximize() const OVERRIDE; virtual bool IsModal() const OVERRIDE; diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc index c2187a6..f4fe436 100644 --- a/chrome/browser/ui/views/default_search_view.cc +++ b/chrome/browser/ui/views/default_search_view.cc @@ -20,7 +20,6 @@ #include "grit/locale_settings.h" #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/message_box_flags.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas.h" #include "views/controls/button/text_button.h" @@ -165,7 +164,7 @@ views::View* DefaultSearchView::GetContentsView() { } int DefaultSearchView::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_NONE; + return ui::DIALOG_BUTTON_NONE; } bool DefaultSearchView::Accept() { 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 e809de1..f785137 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 @@ -110,16 +110,16 @@ gfx::Size DownloadInProgressDialogView::GetPreferredSize() { } string16 DownloadInProgressDialogView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return ok_button_text_; - DCHECK_EQ(ui::MessageBoxFlags::DIALOGBUTTON_CANCEL, button); + DCHECK_EQ(ui::DIALOG_BUTTON_CANCEL, button); return cancel_button_text_; } int DownloadInProgressDialogView::GetDefaultDialogButton() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } bool DownloadInProgressDialogView::Cancel() { 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 b21593f..f61ae40 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 @@ -34,8 +34,7 @@ class DownloadInProgressDialogView : public views::DialogDelegateView { virtual gfx::Size GetPreferredSize() OVERRIDE; // views::DialogDelegateView: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual int GetDefaultDialogButton() const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc index 9bbe778..d5713ec 100644 --- a/chrome/browser/ui/views/edit_search_engine_dialog.cc +++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc @@ -84,8 +84,8 @@ string16 EditSearchEngineDialog::GetWindowTitle() const { } bool EditSearchEngineDialog::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) { + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) { return (controller_->IsKeywordValid(keyword_tf_->text()) && controller_->IsTitleValid(title_tf_->text()) && controller_->IsURLValid(UTF16ToUTF8(url_tf_->text()))); diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.h b/chrome/browser/ui/views/edit_search_engine_dialog.h index cde395e..f8fa7de 100644 --- a/chrome/browser/ui/views/edit_search_engine_dialog.h +++ b/chrome/browser/ui/views/edit_search_engine_dialog.h @@ -45,8 +45,7 @@ class EditSearchEngineDialog : public views::TextfieldController, // views::DialogDelegate: virtual bool IsModal() const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; diff --git a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc index 38842de..9d2d4f5 100644 --- a/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_install_dialog_view.cc @@ -71,8 +71,7 @@ class ExtensionInstallDialogView : public views::DialogDelegateView, private: // views::DialogDelegateView: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual int GetDefaultDialogButton() const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; @@ -256,11 +255,11 @@ ExtensionInstallDialogView::~ExtensionInstallDialogView() { } string16 ExtensionInstallDialogView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { switch (button) { - case ui::MessageBoxFlags::DIALOGBUTTON_OK: + case ui::DIALOG_BUTTON_OK: return prompt_.GetAcceptButtonLabel(); - case ui::MessageBoxFlags::DIALOGBUTTON_CANCEL: + case ui::DIALOG_BUTTON_CANCEL: return prompt_.HasAbortButtonLabel() ? prompt_.GetAbortButtonLabel() : l10n_util::GetStringUTF16(IDS_CANCEL); @@ -271,7 +270,7 @@ string16 ExtensionInstallDialogView::GetDialogButtonLabel( } int ExtensionInstallDialogView::GetDefaultDialogButton() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } bool ExtensionInstallDialogView::Cancel() { diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index 0b454ab..269ffe2 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -66,13 +66,10 @@ class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { private: // views::DialogDelegate: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; - + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual int GetDefaultDialogButton() const OVERRIDE { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } - virtual bool Accept() OVERRIDE; virtual bool Cancel() OVERRIDE; @@ -160,11 +157,11 @@ ExtensionUninstallDialogDelegateView::~ExtensionUninstallDialogDelegateView() { } string16 ExtensionUninstallDialogDelegateView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { switch (button) { - case ui::MessageBoxFlags::DIALOGBUTTON_OK: + case ui::DIALOG_BUTTON_OK: return l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_UNINSTALL_BUTTON); - case ui::MessageBoxFlags::DIALOGBUTTON_CANCEL: + case ui::DIALOG_BUTTON_CANCEL: return l10n_util::GetStringUTF16(IDS_CANCEL); default: NOTREACHED(); diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc index e2bae68..ff78453 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.cc +++ b/chrome/browser/ui/views/external_protocol_dialog.cc @@ -56,12 +56,12 @@ ExternalProtocolDialog::~ExternalProtocolDialog() { // ExternalProtocolDialog, views::DialogDelegate implementation: int ExternalProtocolDialog::GetDefaultDialogButton() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } string16 ExternalProtocolDialog::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT); else return l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT); diff --git a/chrome/browser/ui/views/external_protocol_dialog.h b/chrome/browser/ui/views/external_protocol_dialog.h index 5a17235..d6344cd9 100644 --- a/chrome/browser/ui/views/external_protocol_dialog.h +++ b/chrome/browser/ui/views/external_protocol_dialog.h @@ -33,8 +33,7 @@ class ExternalProtocolDialog : public views::DialogDelegate { // views::DialogDelegate methods: virtual int GetDefaultDialogButton() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; virtual bool Cancel() OVERRIDE; diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index abd6698..18120fd 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -238,8 +238,7 @@ class HungRendererDialogView : public views::DialogDelegateView, virtual string16 GetWindowTitle() const OVERRIDE; virtual void WindowClosing() OVERRIDE; virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual views::View* GetExtraView() OVERRIDE; virtual bool Accept(bool window_closing) OVERRIDE; virtual views::View* GetContentsView() OVERRIDE; @@ -383,12 +382,12 @@ int HungRendererDialogView::GetDialogButtons() const { // the OK button to wait for responsiveness (and close the dialog) and our // additional button (which we create) to kill the process (which will result // in the dialog being destroyed). - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } string16 HungRendererDialogView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT); return string16(); } diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc index 1bebc9a..404b26c 100644 --- a/chrome/browser/ui/views/importer/import_lock_dialog_view.cc +++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.cc @@ -66,10 +66,10 @@ void ImportLockDialogView::Layout() { } string16 ImportLockDialogView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_OK); - else if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) + else if (button == ui::DIALOG_BUTTON_CANCEL) return l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_CANCEL); return string16(); } diff --git a/chrome/browser/ui/views/importer/import_lock_dialog_view.h b/chrome/browser/ui/views/importer/import_lock_dialog_view.h index e35991b..d2e551c 100644 --- a/chrome/browser/ui/views/importer/import_lock_dialog_view.h +++ b/chrome/browser/ui/views/importer/import_lock_dialog_view.h @@ -33,8 +33,7 @@ class ImportLockDialogView : public views::DialogDelegateView { virtual void Layout() OVERRIDE; // views::DialogDelegate: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual bool IsModal() const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual bool Accept() OVERRIDE; diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc index 6ced146..9cb7dee 100644 --- a/chrome/browser/ui/views/importer/import_progress_dialog_view.cc +++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.cc @@ -111,12 +111,12 @@ void ImportProgressDialogView::ViewHierarchyChanged(bool is_add, } int ImportProgressDialogView::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; } string16 ImportProgressDialogView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - DCHECK_EQ(button, ui::MessageBoxFlags::DIALOGBUTTON_CANCEL); + ui::DialogButton button) const { + DCHECK_EQ(button, ui::DIALOG_BUTTON_CANCEL); return l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_CANCEL); } diff --git a/chrome/browser/ui/views/importer/import_progress_dialog_view.h b/chrome/browser/ui/views/importer/import_progress_dialog_view.h index 1afcd16..be40bea 100644 --- a/chrome/browser/ui/views/importer/import_progress_dialog_view.h +++ b/chrome/browser/ui/views/importer/import_progress_dialog_view.h @@ -46,8 +46,7 @@ class ImportProgressDialogView : public views::DialogDelegateView, // views::DialogDelegate: virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual bool IsModal() const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual bool Cancel() OVERRIDE; diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc index 24f7bd7..683b845 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.cc +++ b/chrome/browser/ui/views/js_modal_dialog_views.cc @@ -71,21 +71,21 @@ void JSModalDialogViews::CancelAppModalDialog() { int JSModalDialogViews::GetDefaultDialogButton() const { if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasOKButton) - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasCancelButton) - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_CANCEL; - return ui::MessageBoxFlags::DIALOGBUTTON_NONE; + return ui::DIALOG_BUTTON_NONE; } int JSModalDialogViews::GetDialogButtons() const { int dialog_buttons = 0; if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasOKButton) - dialog_buttons = ui::MessageBoxFlags::DIALOGBUTTON_OK; + dialog_buttons = ui::DIALOG_BUTTON_OK; if (parent_->dialog_flags() & ui::MessageBoxFlags::kFlagHasCancelButton) - dialog_buttons |= ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + dialog_buttons |= ui::DIALOG_BUTTON_CANCEL; return dialog_buttons; } @@ -127,12 +127,12 @@ const views::Widget* JSModalDialogViews::GetWidget() const { } string16 JSModalDialogViews::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { if (parent_->is_before_unload_dialog()) { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) { + if (button == ui::DIALOG_BUTTON_OK) { return l10n_util::GetStringUTF16( IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); - } else if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) { + } else if (button == ui::DIALOG_BUTTON_CANCEL) { return l10n_util::GetStringUTF16( IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL); } diff --git a/chrome/browser/ui/views/js_modal_dialog_views.h b/chrome/browser/ui/views/js_modal_dialog_views.h index 847ecbb..e77247b 100644 --- a/chrome/browser/ui/views/js_modal_dialog_views.h +++ b/chrome/browser/ui/views/js_modal_dialog_views.h @@ -6,12 +6,10 @@ #define CHROME_BROWSER_UI_VIEWS_JS_MODAL_DIALOG_VIEWS_H_ #pragma once -#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" - #include <string> +#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" -#include "ui/base/message_box_flags.h" #include "views/window/dialog_delegate.h" namespace views { @@ -40,8 +38,7 @@ class JSModalDialogViews : public NativeAppModalDialog, virtual void DeleteDelegate() OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; // Overridden from views::WidgetDelegate: virtual bool IsModal() const OVERRIDE; diff --git a/chrome/browser/ui/views/repost_form_warning_view.cc b/chrome/browser/ui/views/repost_form_warning_view.cc index 0dec119..c7ade24 100644 --- a/chrome/browser/ui/views/repost_form_warning_view.cc +++ b/chrome/browser/ui/views/repost_form_warning_view.cc @@ -55,10 +55,10 @@ string16 RepostFormWarningView::GetWindowTitle() const { } string16 RepostFormWarningView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND); - if (button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) + if (button == ui::DIALOG_BUTTON_CANCEL) return l10n_util::GetStringUTF16(IDS_CANCEL); return string16(); } diff --git a/chrome/browser/ui/views/repost_form_warning_view.h b/chrome/browser/ui/views/repost_form_warning_view.h index 82f1d21..b98bdc9 100644 --- a/chrome/browser/ui/views/repost_form_warning_view.h +++ b/chrome/browser/ui/views/repost_form_warning_view.h @@ -29,16 +29,14 @@ class RepostFormWarningView : public views::DialogDelegate { RepostFormWarningView(gfx::NativeWindow parent_window, TabContents* tab_contents); - // views::DialogDelegate Methods: + // views::DialogDelegate: virtual string16 GetWindowTitle() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; - virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; - // views::WidgetDelegate Methods: + // views::WidgetDelegate: virtual views::View* GetContentsView() OVERRIDE; virtual views::Widget* GetWidget() OVERRIDE; virtual const views::Widget* GetWidget() const OVERRIDE; diff --git a/chrome/browser/ui/views/restart_message_box.cc b/chrome/browser/ui/views/restart_message_box.cc index 807dec0..fd40269 100644 --- a/chrome/browser/ui/views/restart_message_box.cc +++ b/chrome/browser/ui/views/restart_message_box.cc @@ -22,12 +22,12 @@ void RestartMessageBox::ShowMessageBox(gfx::NativeWindow parent_window) { } int RestartMessageBox::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } string16 RestartMessageBox::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - DCHECK(button == ui::MessageBoxFlags::DIALOGBUTTON_OK); + ui::DialogButton button) const { + DCHECK_EQ(button, ui::DIALOG_BUTTON_OK); return l10n_util::GetStringUTF16(IDS_OK); } diff --git a/chrome/browser/ui/views/restart_message_box.h b/chrome/browser/ui/views/restart_message_box.h index 68dccce..47be2ab 100644 --- a/chrome/browser/ui/views/restart_message_box.h +++ b/chrome/browser/ui/views/restart_message_box.h @@ -24,8 +24,7 @@ class RestartMessageBox : public views::DialogDelegate { protected: // views::DialogDelegate: virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; // views::WidgetDelegate: diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc index 78cab40..6d9c100 100644 --- a/chrome/browser/ui/views/simple_message_box_views.cc +++ b/chrome/browser/ui/views/simple_message_box_views.cc @@ -10,6 +10,7 @@ #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 "views/controls/message_box_view.h" #include "views/widget/widget.h" @@ -86,16 +87,15 @@ 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. return (dialog_flags_ & ui::MessageBoxFlags::kFlagHasOKButton - ? ui::MessageBoxFlags::DIALOGBUTTON_OK : 0) | + ? ui::DIALOG_BUTTON_OK : 0) | (dialog_flags_ & ui::MessageBoxFlags::kFlagHasCancelButton - ? ui::MessageBoxFlags::DIALOGBUTTON_CANCEL : 0); + ? ui::DIALOG_BUTTON_CANCEL : 0); } string16 SimpleMessageBoxViews::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - return button == ui::MessageBoxFlags::DIALOGBUTTON_OK ? - l10n_util::GetStringUTF16(IDS_OK) : - l10n_util::GetStringUTF16(IDS_CLOSE); + ui::DialogButton button) const { + return button == ui::DIALOG_BUTTON_OK ? l10n_util::GetStringUTF16(IDS_OK) + : l10n_util::GetStringUTF16(IDS_CLOSE); } bool SimpleMessageBoxViews::ShouldShowWindowTitle() const { diff --git a/chrome/browser/ui/views/simple_message_box_views.h b/chrome/browser/ui/views/simple_message_box_views.h index fc17f61..f73475c 100644 --- a/chrome/browser/ui/views/simple_message_box_views.h +++ b/chrome/browser/ui/views/simple_message_box_views.h @@ -50,8 +50,7 @@ class SimpleMessageBoxViews : public views::DialogDelegate, protected: // Overridden from views::DialogDelegate: virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; // Overridden from views::WidgetDelegate: virtual bool ShouldShowWindowTitle() const OVERRIDE; diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc index ca11011..3d74cac 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc @@ -177,8 +177,8 @@ void SSLClientCertificateSelector::DeleteDelegate() { } bool SSLClientCertificateSelector::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + ui::DialogButton button) const { + if (button == ui::DIALOG_BUTTON_OK) return !!GetSelectedCert(); return true; } diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.h b/chrome/browser/ui/views/ssl_client_certificate_selector.h index 531c46e..85de297 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.h +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.h @@ -10,10 +10,9 @@ #include <vector> #include "base/basictypes.h" -#include "base/string16.h" #include "base/memory/ref_counted.h" +#include "base/string16.h" #include "content/browser/ssl/ssl_client_auth_handler.h" -#include "ui/base/message_box_flags.h" #include "views/controls/button/button.h" #include "views/controls/table/table_view_observer.h" #include "views/view.h" @@ -54,8 +53,7 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver, virtual bool CanResize() const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; virtual bool Cancel() OVERRIDE; virtual bool Accept() OVERRIDE; virtual views::View* GetInitiallyFocusedView() OVERRIDE; diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc index ea04877..766492b 100644 --- a/chrome/browser/ui/views/task_manager_view.cc +++ b/chrome/browser/ui/views/task_manager_view.cc @@ -661,7 +661,7 @@ std::string TaskManagerView::GetWindowName() const { } int TaskManagerView::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_NONE; + return ui::DIALOG_BUTTON_NONE; } void TaskManagerView::WindowClosing() { diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc index 3de2a97..1dd1341 100644 --- a/chrome/browser/ui/views/uninstall_view.cc +++ b/chrome/browser/ui/views/uninstall_view.cc @@ -116,17 +116,16 @@ bool UninstallView::Cancel() { return true; } -string16 UninstallView::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { +string16 UninstallView::GetDialogButtonLabel(ui::DialogButton button) const { // We only want to give custom name to OK button - 'Uninstall'. Cancel // button remains same. - if (button == ui::MessageBoxFlags::DIALOGBUTTON_OK) + if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT); return string16(); } -void UninstallView::ButtonPressed( - views::Button* sender, const views::Event& event) { +void UninstallView::ButtonPressed(views::Button* sender, + const views::Event& event) { if (change_default_browser_ == sender) { // Disable the browsers combobox if the user unchecks the checkbox. DCHECK(browsers_combo_); diff --git a/chrome/browser/ui/views/uninstall_view.h b/chrome/browser/ui/views/uninstall_view.h index d167dab..cdbbed2 100644 --- a/chrome/browser/ui/views/uninstall_view.h +++ b/chrome/browser/ui/views/uninstall_view.h @@ -35,8 +35,7 @@ class UninstallView : public views::ButtonListener, // Overridden from views::DialogDelegateView: virtual bool Accept() OVERRIDE; virtual bool Cancel() OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; // Overridden from views::WidgetDelegate: virtual string16 GetWindowTitle() const OVERRIDE; diff --git a/chrome/browser/ui/views/update_recommended_message_box.cc b/chrome/browser/ui/views/update_recommended_message_box.cc index 1d30247..af0d559 100644 --- a/chrome/browser/ui/views/update_recommended_message_box.cc +++ b/chrome/browser/ui/views/update_recommended_message_box.cc @@ -40,15 +40,13 @@ bool UpdateRecommendedMessageBox::Accept() { } int UpdateRecommendedMessageBox::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; } string16 UpdateRecommendedMessageBox::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { - DCHECK(button == ui::MessageBoxFlags::DIALOGBUTTON_OK || - button == ui::MessageBoxFlags::DIALOGBUTTON_CANCEL); - return button == ui::MessageBoxFlags::DIALOGBUTTON_OK ? + ui::DialogButton button) const { + DCHECK(button == ui::DIALOG_BUTTON_OK || button == ui::DIALOG_BUTTON_CANCEL); + return button == ui::DIALOG_BUTTON_OK ? l10n_util::GetStringUTF16(IDS_RELAUNCH_AND_UPDATE) : l10n_util::GetStringUTF16(IDS_NOT_NOW); } diff --git a/chrome/browser/ui/views/update_recommended_message_box.h b/chrome/browser/ui/views/update_recommended_message_box.h index d548a20..aeae44a 100644 --- a/chrome/browser/ui/views/update_recommended_message_box.h +++ b/chrome/browser/ui/views/update_recommended_message_box.h @@ -27,8 +27,7 @@ class UpdateRecommendedMessageBox : public views::DialogDelegate { protected: // Overridden from views::DialogDelegate: virtual int GetDialogButtons() const OVERRIDE; - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; // Overridden from views::WidgetDelegate: virtual bool ShouldShowWindowTitle() const OVERRIDE; diff --git a/chrome/browser/ui/views/user_data_dir_dialog.cc b/chrome/browser/ui/views/user_data_dir_dialog.cc index 6a1c54f..4167552 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog.cc +++ b/chrome/browser/ui/views/user_data_dir_dialog.cc @@ -43,12 +43,12 @@ UserDataDirDialog::~UserDataDirDialog() { } string16 UserDataDirDialog::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { + ui::DialogButton button) const { switch (button) { - case ui::MessageBoxFlags::DIALOGBUTTON_OK: + case ui::DIALOG_BUTTON_OK: return l10n_util::GetStringUTF16( IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON); - case ui::MessageBoxFlags::DIALOGBUTTON_CANCEL: + case ui::DIALOG_BUTTON_CANCEL: return l10n_util::GetStringUTF16( IDS_CANT_WRITE_USER_DIRECTORY_EXIT_BUTTON); default: diff --git a/chrome/browser/ui/views/user_data_dir_dialog.h b/chrome/browser/ui/views/user_data_dir_dialog.h index 87479be..8709747 100644 --- a/chrome/browser/ui/views/user_data_dir_dialog.h +++ b/chrome/browser/ui/views/user_data_dir_dialog.h @@ -34,8 +34,7 @@ class UserDataDirDialog : public views::DialogDelegate, FilePath user_data_dir() const { return user_data_dir_; } // views::DialogDelegate methods: - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const OVERRIDE; + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE; virtual string16 GetWindowTitle() const OVERRIDE; virtual void DeleteDelegate() OVERRIDE; virtual bool Accept() OVERRIDE; diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc index c0b6a39..6c1e0cf 100644 --- a/chrome/browser/unload_uitest.cc +++ b/chrome/browser/unload_uitest.cc @@ -14,7 +14,7 @@ #include "content/browser/net/url_request_mock_http_job.h" #include "net/url_request/url_request_test_util.h" #include "ui/base/events.h" -#include "ui/base/message_box_flags.h" +#include "ui/base/ui_base_types.h" const std::string NOLISTENERS_HTML = "<html><head><title>nolisteners</title></head><body></body></html>"; @@ -154,9 +154,9 @@ class UnloadTest : public UITest { EXPECT_TRUE(CloseBrowser(browser.get(), &application_closed)); } - void ClickModalDialogButton(ui::MessageBoxFlags::DialogButton button) { + void ClickModalDialogButton(ui::DialogButton button) { bool modal_dialog_showing = false; - ui::MessageBoxFlags::DialogButton available_buttons; + ui::DialogButton available_buttons; EXPECT_TRUE(automation()->WaitForAppModalDialog()); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); @@ -284,7 +284,7 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadOK) { NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); CloseBrowserAsync(browser.get()); - ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK); + ClickModalDialogButton(ui::DIALOG_BUTTON_OK); int exit_code = -1; ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit( @@ -300,14 +300,14 @@ TEST_F(UnloadTest, BrowserCloseBeforeUnloadCancel) { NavigateToDataURL(BEFORE_UNLOAD_HTML, L"beforeunload"); CloseBrowserAsync(browser.get()); - ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_CANCEL); + ClickModalDialogButton(ui::DIALOG_BUTTON_CANCEL); // There's no real graceful way to wait for something _not_ to happen, so // we just wait a short period. base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); CloseBrowserAsync(browser.get()); - ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK); + ClickModalDialogButton(ui::DIALOG_BUTTON_OK); int exit_code = -1; ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit( @@ -344,7 +344,7 @@ TEST_F(UnloadTest, MAYBE_BrowserCloseWithInnerFocusedFrame) { NavigateToDataURL(INNER_FRAME_WITH_FOCUS_HTML, L"innerframewithfocus"); CloseBrowserAsync(browser.get()); - ClickModalDialogButton(ui::MessageBoxFlags::DIALOGBUTTON_OK); + ClickModalDialogButton(ui::DIALOG_BUTTON_OK); int exit_code = -1; ASSERT_TRUE(launcher_->WaitForBrowserProcessToQuit( diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index e852629..24b35fe 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -12,9 +12,9 @@ #include "base/debug/trace_event.h" #include "base/logging.h" #include "base/memory/ref_counted.h" -#include "base/threading/platform_thread.h" #include "base/process_util.h" #include "base/synchronization/waitable_event.h" +#include "base/threading/platform_thread.h" #include "chrome/common/automation_constants.h" #include "chrome/common/automation_messages.h" #include "chrome/common/chrome_version_info.h" @@ -290,9 +290,8 @@ bool AutomationProxy::WaitForWindowCountToBecome(int count) { return wait_success; } -bool AutomationProxy::GetShowingAppModalDialog( - bool* showing_app_modal_dialog, - ui::MessageBoxFlags::DialogButton* button) { +bool AutomationProxy::GetShowingAppModalDialog(bool* showing_app_modal_dialog, + ui::DialogButton* button) { if (!showing_app_modal_dialog || !button) { NOTREACHED(); return false; @@ -305,12 +304,11 @@ bool AutomationProxy::GetShowingAppModalDialog( return false; } - *button = static_cast<ui::MessageBoxFlags::DialogButton>(button_int); + *button = static_cast<ui::DialogButton>(button_int); return true; } -bool AutomationProxy::ClickAppModalDialogButton( - ui::MessageBoxFlags::DialogButton button) { +bool AutomationProxy::ClickAppModalDialogButton(ui::DialogButton button) { bool succeeded = false; if (!Send(new AutomationMsg_ClickAppModalDialogButton( diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index 37f08ec..834023e 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -12,11 +12,11 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "base/threading/platform_thread.h" #include "base/process_util.h" -#include "base/time.h" -#include "base/threading/thread.h" #include "base/synchronization/waitable_event.h" +#include "base/threading/platform_thread.h" +#include "base/threading/thread.h" +#include "base/time.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/automation_constants.h" #include "chrome/test/automation/automation_handle_tracker.h" @@ -25,7 +25,7 @@ #include "ipc/ipc_channel_proxy.h" #include "ipc/ipc_message.h" #include "ipc/ipc_sync_channel.h" -#include "ui/base/message_box_flags.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/native_widget_types.h" class BrowserProxy; @@ -127,11 +127,10 @@ class AutomationProxy : public IPC::Channel::Listener, // Returns whether an app modal dialog window is showing right now (i.e., a // javascript alert), and what buttons it contains. bool GetShowingAppModalDialog(bool* showing_app_modal_dialog, - ui::MessageBoxFlags::DialogButton* button) WARN_UNUSED_RESULT; + ui::DialogButton* button) WARN_UNUSED_RESULT; // Simulates a click on a dialog button. Synchronous. - bool ClickAppModalDialogButton( - ui::MessageBoxFlags::DialogButton button) WARN_UNUSED_RESULT; + bool ClickAppModalDialogButton(ui::DialogButton button) WARN_UNUSED_RESULT; // Block the thread until a modal dialog is displayed. Returns true on // success. diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 9b2d4df..8a1158d6 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -39,8 +39,8 @@ #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING #include "testing/gmock_mutant.h" #include "third_party/skia/include/core/SkBitmap.h" -#include "ui/base/message_box_flags.h" #include "ui/base/ui_base_switches.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/rect.h" @@ -1401,12 +1401,11 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) { ASSERT_TRUE(tab.get()); bool modal_dialog_showing = false; - ui::MessageBoxFlags::DialogButton button = - ui::MessageBoxFlags::DIALOGBUTTON_NONE; + ui::DialogButton button = ui::DIALOG_BUTTON_NONE; EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_FALSE(modal_dialog_showing); - EXPECT_EQ(ui::MessageBoxFlags::DIALOGBUTTON_NONE, button); + EXPECT_EQ(ui::DIALOG_BUTTON_NONE, button); // Show a simple alert. std::string content = @@ -1419,19 +1418,19 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) { EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); - EXPECT_EQ(ui::MessageBoxFlags::DIALOGBUTTON_OK, button); + EXPECT_EQ(ui::DIALOG_BUTTON_OK, button); // Test that clicking missing button fails graciously and does not close the // dialog. EXPECT_FALSE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL)); + ui::DIALOG_BUTTON_CANCEL)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); // Now click OK, that should close the dialog. EXPECT_TRUE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_OK)); + ui::DIALOG_BUTTON_OK)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_FALSE(modal_dialog_showing); @@ -1447,12 +1446,10 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) { EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); - EXPECT_EQ(ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL, button); + EXPECT_EQ(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, button); // Click OK. - EXPECT_TRUE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_OK)); + EXPECT_TRUE(automation()->ClickAppModalDialogButton(ui::DIALOG_BUTTON_OK)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_FALSE(modal_dialog_showing); @@ -1469,12 +1466,11 @@ TEST_F(AutomationProxyTest, FLAKY_AppModalDialogTest) { EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_TRUE(modal_dialog_showing); - EXPECT_EQ(ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL, button); + EXPECT_EQ(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL, button); // Click Cancel this time. EXPECT_TRUE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL)); + ui::DIALOG_BUTTON_CANCEL)); EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &button)); EXPECT_FALSE(modal_dialog_showing); diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index d313a2c..7a86a22 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -210,23 +210,21 @@ TEST_F(NPAPIVisiblePluginTester, AlertInWindowMessage) { ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); bool modal_dialog_showing = false; - ui::MessageBoxFlags::DialogButton available_buttons; + ui::DialogButton available_buttons; ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); - ASSERT_NE((ui::MessageBoxFlags::DIALOGBUTTON_OK & available_buttons), 0); - ASSERT_TRUE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_OK)); + ASSERT_NE((ui::DIALOG_BUTTON_OK & available_buttons), 0); + ASSERT_TRUE(automation()->ClickAppModalDialogButton(ui::DIALOG_BUTTON_OK)); modal_dialog_showing = false; ASSERT_TRUE(automation()->WaitForAppModalDialog()); ASSERT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, &available_buttons)); ASSERT_TRUE(modal_dialog_showing); - ASSERT_NE((ui::MessageBoxFlags::DIALOGBUTTON_OK & available_buttons), 0); - ASSERT_TRUE(automation()->ClickAppModalDialogButton( - ui::MessageBoxFlags::DIALOGBUTTON_OK)); + ASSERT_NE((ui::DIALOG_BUTTON_OK & available_buttons), 0); + ASSERT_TRUE(automation()->ClickAppModalDialogButton(ui::DIALOG_BUTTON_OK)); } TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { diff --git a/ui/base/message_box_flags.h b/ui/base/message_box_flags.h index d3cd569..207a97c 100644 --- a/ui/base/message_box_flags.h +++ b/ui/base/message_box_flags.h @@ -45,16 +45,8 @@ class MessageBoxFlags { static const int kIsJavascriptPrompt = kIsJavascriptConfirm | kFlagHasPromptField; - // Dialog button identifiers used to specify which buttons to show the user. - enum DialogButton { - DIALOGBUTTON_NONE = 0, // No dialog buttons, for WindowType == WINDOW. - DIALOGBUTTON_OK = 1, // Has an OK button. - DIALOGBUTTON_CANCEL = 2, // Has a Cancel button (becomes a Close button if - }; // no OK button). - private: - MessageBoxFlags() {} - DISALLOW_COPY_AND_ASSIGN(MessageBoxFlags); + DISALLOW_IMPLICIT_CONSTRUCTORS(MessageBoxFlags); }; } // namespace ui diff --git a/ui/base/ui_base_types.h b/ui/base/ui_base_types.h index 3d2b927..c4ba28e 100644 --- a/ui/base/ui_base_types.h +++ b/ui/base/ui_base_types.h @@ -21,6 +21,13 @@ enum WindowShowState { SHOW_STATE_END = 6 // The end of show state enum. }; +// Dialog button identifiers used to specify which buttons to show the user. +enum DialogButton { + DIALOG_BUTTON_NONE = 0, + DIALOG_BUTTON_OK = 1, + DIALOG_BUTTON_CANCEL = 2, +}; + } // namespace ui #endif // UI_BASE_UI_BASE_TYPES_H_ diff --git a/views/view_unittest.cc b/views/view_unittest.cc index 9b949b5..03b7cfe 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -1253,7 +1253,7 @@ class TestDialog : public DialogDelegate, public ButtonListener { // DialogDelegate implementation: virtual int GetDefaultDialogButton() const OVERRIDE { - return ui::MessageBoxFlags::DIALOGBUTTON_OK; + return ui::DIALOG_BUTTON_OK; } virtual View* GetContentsView() OVERRIDE { diff --git a/views/window/dialog_client_view.cc b/views/window/dialog_client_view.cc index 4320308..4040085 100644 --- a/views/window/dialog_client_view.cc +++ b/views/window/dialog_client_view.cc @@ -36,15 +36,13 @@ #include "views/window/hit_test.h" #endif -using ui::MessageBoxFlags; - namespace views { namespace { // Updates any of the standard buttons according to the delegate. void UpdateButtonHelper(NativeTextButton* button_view, DialogDelegate* delegate, - MessageBoxFlags::DialogButton button) { + ui::DialogButton button) { string16 label = delegate->GetDialogButtonLabel(button); if (!label.empty()) button_view->SetText(label); @@ -69,7 +67,7 @@ class DialogButton : public NativeTextButton { public: DialogButton(ButtonListener* listener, Widget* owner, - MessageBoxFlags::DialogButton type, + ui::DialogButton type, const string16& title, bool is_default) : NativeTextButton(listener, title), @@ -89,7 +87,7 @@ class DialogButton : public NativeTextButton { private: Widget* owner_; - const MessageBoxFlags::DialogButton type_; + const ui::DialogButton type_; DISALLOW_COPY_AND_ASSIGN(DialogButton); }; @@ -129,41 +127,41 @@ DialogClientView::~DialogClientView() { void DialogClientView::ShowDialogButtons() { DialogDelegate* dd = GetDialogDelegate(); int buttons = dd->GetDialogButtons(); - if (buttons & MessageBoxFlags::DIALOGBUTTON_OK && !ok_button_) { - string16 label = dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_OK); + if (buttons & ui::DIALOG_BUTTON_OK && !ok_button_) { + string16 label = dd->GetDialogButtonLabel(ui::DIALOG_BUTTON_OK); if (label.empty()) label = l10n_util::GetStringUTF16(IDS_APP_OK); bool is_default_button = - (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0; + (dd->GetDefaultDialogButton() & ui::DIALOG_BUTTON_OK) != 0; ok_button_ = new DialogButton(this, GetWidget(), - MessageBoxFlags::DIALOGBUTTON_OK, + ui::DIALOG_BUTTON_OK, label, is_default_button); ok_button_->SetGroup(kButtonGroup); if (is_default_button) default_button_ = ok_button_; - if (!(buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL)) + if (!(buttons & ui::DIALOG_BUTTON_CANCEL)) ok_button_->AddAccelerator(Accelerator(ui::VKEY_ESCAPE, false, false, false)); AddChildView(ok_button_); } - if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL && !cancel_button_) { + if (buttons & ui::DIALOG_BUTTON_CANCEL && !cancel_button_) { string16 label = - dd->GetDialogButtonLabel(MessageBoxFlags::DIALOGBUTTON_CANCEL); + dd->GetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL); if (label.empty()) { - if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) { + if (buttons & ui::DIALOG_BUTTON_OK) { label = l10n_util::GetStringUTF16(IDS_APP_CANCEL); } else { label = l10n_util::GetStringUTF16(IDS_APP_CLOSE); } } bool is_default_button = - (dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_CANCEL) + (dd->GetDefaultDialogButton() & ui::DIALOG_BUTTON_CANCEL) != 0; cancel_button_ = new DialogButton(this, GetWidget(), - MessageBoxFlags::DIALOGBUTTON_CANCEL, + ui::DIALOG_BUTTON_CANCEL, label, is_default_button); cancel_button_->SetGroup(kButtonGroup); @@ -202,9 +200,9 @@ void DialogClientView::FocusWillChange(View* focused_before, // The focused view is not a button, get the default button from the // delegate. DialogDelegate* dd = GetDialogDelegate(); - if ((dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_OK) != 0) + if ((dd->GetDefaultDialogButton() & ui::DIALOG_BUTTON_OK) != 0) new_default_button = ok_button_; - if ((dd->GetDefaultDialogButton() & MessageBoxFlags::DIALOGBUTTON_CANCEL) + if ((dd->GetDefaultDialogButton() & ui::DIALOG_BUTTON_CANCEL) != 0) new_default_button = cancel_button_; } @@ -216,12 +214,11 @@ void DialogClientView::UpdateDialogButtons() { DialogDelegate* dd = GetDialogDelegate(); int buttons = dd->GetDialogButtons(); - if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) - UpdateButtonHelper(ok_button_, dd, MessageBoxFlags::DIALOGBUTTON_OK); + if (buttons & ui::DIALOG_BUTTON_OK) + UpdateButtonHelper(ok_button_, dd, ui::DIALOG_BUTTON_OK); - if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL) { - UpdateButtonHelper(cancel_button_, dd, - MessageBoxFlags::DIALOGBUTTON_CANCEL); + if (buttons & ui::DIALOG_BUTTON_CANCEL) { + UpdateButtonHelper(cancel_button_, dd, ui::DIALOG_BUTTON_CANCEL); } LayoutDialogButtons(); @@ -279,9 +276,9 @@ bool DialogClientView::CanClose() { DialogDelegate* dd = GetDialogDelegate(); int buttons = dd->GetDialogButtons(); bool close = true; - if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL) + if (buttons & ui::DIALOG_BUTTON_CANCEL) close = dd->Cancel(); - else if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) + else if (buttons & ui::DIALOG_BUTTON_OK) close = dd->Accept(true); notified_delegate_ = close; return close; @@ -381,9 +378,9 @@ gfx::Size DialogClientView::GetPreferredSize() { // the contents. int width = 0; if (cancel_button_) - width += GetButtonWidth(MessageBoxFlags::DIALOGBUTTON_CANCEL); + width += GetButtonWidth(ui::DIALOG_BUTTON_CANCEL); if (ok_button_) { - width += GetButtonWidth(MessageBoxFlags::DIALOGBUTTON_OK); + width += GetButtonWidth(ui::DIALOG_BUTTON_OK); if (cancel_button_) width += kRelatedButtonHSpacing; } @@ -466,7 +463,7 @@ void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { int DialogClientView::GetButtonWidth(int button) const { DialogDelegate* dd = GetDialogDelegate(); string16 button_label = dd->GetDialogButtonLabel( - static_cast<MessageBoxFlags::DialogButton>(button)); + static_cast<ui::DialogButton>(button)); int string_width = dialog_button_font_->GetStringWidth(button_label); return std::max(string_width + kDialogButtonLabelSpacing, kDialogMinButtonWidth); @@ -493,7 +490,7 @@ void DialogClientView::LayoutDialogButtons() { if (cancel_button_) { gfx::Size ps = cancel_button_->GetPreferredSize(); int button_width = std::max( - GetButtonWidth(MessageBoxFlags::DIALOGBUTTON_CANCEL), ps.width()); + GetButtonWidth(ui::DIALOG_BUTTON_CANCEL), ps.width()); int button_x = lb.right() - button_width - kButtonHEdgeMargin; int button_y = bottom_y - ps.height(); cancel_button_->SetBounds(button_x, button_y, button_width, ps.height()); @@ -505,7 +502,7 @@ void DialogClientView::LayoutDialogButtons() { if (ok_button_) { gfx::Size ps = ok_button_->GetPreferredSize(); int button_width = std::max( - GetButtonWidth(MessageBoxFlags::DIALOGBUTTON_OK), ps.width()); + GetButtonWidth(ui::DIALOG_BUTTON_OK), ps.width()); int ok_button_right = lb.right() - kButtonHEdgeMargin; if (cancel_button_) ok_button_right = cancel_button_->x() - kRelatedButtonHSpacing; diff --git a/views/window/dialog_delegate.cc b/views/window/dialog_delegate.cc index 895ba81..fc24f90 100644 --- a/views/window/dialog_delegate.cc +++ b/views/window/dialog_delegate.cc @@ -16,47 +16,41 @@ namespace views { DialogDelegate* DialogDelegate::AsDialogDelegate() { return this; } int DialogDelegate::GetDialogButtons() const { - return ui::MessageBoxFlags::DIALOGBUTTON_OK | - ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; } -bool DialogDelegate::AreAcceleratorsEnabled( - ui::MessageBoxFlags::DialogButton button) { - return true; +int DialogDelegate::GetDefaultDialogButton() const { + if (GetDialogButtons() & ui::DIALOG_BUTTON_OK) + return ui::DIALOG_BUTTON_OK; + if (GetDialogButtons() & ui::DIALOG_BUTTON_CANCEL) + return ui::DIALOG_BUTTON_CANCEL; + return ui::DIALOG_BUTTON_NONE; } -string16 DialogDelegate::GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const { +string16 DialogDelegate::GetDialogButtonLabel(ui::DialogButton button) const { // Empty string results in defaults for - // ui::MessageBoxFlags::DIALOGBUTTON_OK - // ui::MessageBoxFlags::DIALOGBUTTON_CANCEL. + // ui::DIALOG_BUTTON_OK or ui::DIALOG_BUTTON_CANCEL. return string16(); } -View* DialogDelegate::GetExtraView() { - return NULL; +bool DialogDelegate::IsDialogButtonEnabled(ui::DialogButton button) const { + return true; } -bool DialogDelegate::GetSizeExtraViewHeightToButtons() { - return false; +bool DialogDelegate::IsDialogButtonVisible(ui::DialogButton button) const { + return true; } -int DialogDelegate::GetDefaultDialogButton() const { - if (GetDialogButtons() & ui::MessageBoxFlags::DIALOGBUTTON_OK) - return ui::MessageBoxFlags::DIALOGBUTTON_OK; - if (GetDialogButtons() & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) - return ui::MessageBoxFlags::DIALOGBUTTON_CANCEL; - return ui::MessageBoxFlags::DIALOGBUTTON_NONE; +bool DialogDelegate::AreAcceleratorsEnabled(ui::DialogButton button) { + return true; } -bool DialogDelegate::IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const { - return true; +View* DialogDelegate::GetExtraView() { + return NULL; } -bool DialogDelegate::IsDialogButtonVisible( - ui::MessageBoxFlags::DialogButton button) const { - return true; +bool DialogDelegate::GetSizeExtraViewHeightToButtons() { + return false; } bool DialogDelegate::Cancel() { @@ -75,7 +69,7 @@ View* DialogDelegate::GetInitiallyFocusedView() { // Focus the default button if any. const DialogClientView* dcv = GetDialogClientView(); int default_button = GetDefaultDialogButton(); - if (default_button == ui::MessageBoxFlags::DIALOGBUTTON_NONE) + if (default_button == ui::DIALOG_BUTTON_NONE) return NULL; if ((default_button & GetDialogButtons()) == 0) { @@ -84,9 +78,9 @@ View* DialogDelegate::GetInitiallyFocusedView() { return NULL; } - if (default_button & ui::MessageBoxFlags::DIALOGBUTTON_OK) + if (default_button & ui::DIALOG_BUTTON_OK) return dcv->ok_button(); - if (default_button & ui::MessageBoxFlags::DIALOGBUTTON_CANCEL) + if (default_button & ui::DIALOG_BUTTON_CANCEL) return dcv->cancel_button(); return NULL; } diff --git a/views/window/dialog_delegate.h b/views/window/dialog_delegate.h index 7ce10d4..dc38c00 100644 --- a/views/window/dialog_delegate.h +++ b/views/window/dialog_delegate.h @@ -8,7 +8,7 @@ #include "base/string16.h" #include "ui/base/accessibility/accessibility_types.h" -#include "ui/base/message_box_flags.h" +#include "ui/base/ui_base_types.h" #include "views/widget/widget_delegate.h" #include "views/window/dialog_client_view.h" @@ -39,15 +39,27 @@ class VIEWS_EXPORT DialogDelegate : public WidgetDelegate { // To use the extra button you need to override GetDialogButtons() virtual int GetDialogButtons() const; + // Returns the default dialog button. This should not be a mask as only + // one button should ever be the default button. Return + // ui::DIALOG_BUTTON_NONE if there is no default. Default + // behavior is to return ui::DIALOG_BUTTON_OK or + // ui::DIALOG_BUTTON_CANCEL (in that order) if they are + // present, ui::DIALOG_BUTTON_NONE otherwise. + virtual int GetDefaultDialogButton() const; + + // Returns the label of the specified dialog button. + virtual string16 GetDialogButtonLabel(ui::DialogButton button) const; + + // Returns whether the specified dialog button is enabled. + virtual bool IsDialogButtonEnabled(ui::DialogButton button) const; + + // Returns whether the specified dialog button is visible. + virtual bool IsDialogButtonVisible(ui::DialogButton button) const; + // Returns whether accelerators are enabled on the button. This is invoked // when an accelerator is pressed, not at construction time. This // returns true. - virtual bool AreAcceleratorsEnabled( - ui::MessageBoxFlags::DialogButton button); - - // Returns the label of the specified DialogButton. - virtual string16 GetDialogButtonLabel( - ui::MessageBoxFlags::DialogButton button) const; + virtual bool AreAcceleratorsEnabled(ui::DialogButton button); // Override this function if with a view which will be shown in the same // row as the OK and CANCEL buttons but flush to the left and extending @@ -60,22 +72,6 @@ class VIEWS_EXPORT DialogDelegate : public WidgetDelegate { // max(extra_view preferred height, buttons preferred height). virtual bool GetSizeExtraViewHeightToButtons(); - // Returns the default dialog button. This should not be a mask as only - // one button should ever be the default button. Return - // ui::MessageBoxFlags::DIALOGBUTTON_NONE if there is no default. Default - // behavior is to return ui::MessageBoxFlags::DIALOGBUTTON_OK or - // ui::MessageBoxFlags::DIALOGBUTTON_CANCEL (in that order) if they are - // present, ui::MessageBoxFlags::DIALOGBUTTON_NONE otherwise. - virtual int GetDefaultDialogButton() const; - - // Returns whether the specified dialog button is enabled. - virtual bool IsDialogButtonEnabled( - ui::MessageBoxFlags::DialogButton button) const; - - // Returns whether the specified dialog button is visible. - virtual bool IsDialogButtonVisible( - ui::MessageBoxFlags::DialogButton button) const; - // For Dialog boxes, if there is a "Cancel" button, this is called when the // user presses the "Cancel" button or the Close button on the window or // in the system menu, or presses the Esc key. This function should return |