Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1046)

Unified Diff: chrome/browser/ui/views/js_modal_dialog_views.cc

Issue 8553001: views: Add an Options enum to MessageBoxView control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding an IPC_MESSAGE_EXPORT to line 30 of param_traits_macro.h makes it link in shared build Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/js_modal_dialog_views.cc
diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc
index 6c236217f07c01cd4e8e77f0e8703e496690a230..dad8f9b6c674fb315945046fe32b8583727fc500 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() {
}
« no previous file with comments | « chrome/browser/ui/views/external_protocol_dialog.cc ('k') | chrome/browser/ui/views/repost_form_warning_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698