| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/js_modal_dialog_views.h" | 5 #include "chrome/browser/ui/views/js_modal_dialog_views.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 8 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
| 9 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
| 10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
| 11 #include "ui/base/l10n/l10n_util.h" | 11 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "ui/views/controls/message_box_view.h" | 12 #include "ui/views/controls/message_box_view.h" |
| 13 #include "ui/views/controls/textfield/textfield.h" | 13 #include "ui/views/controls/textfield/textfield.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 | 15 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
| 17 // JSModalDialogViews, public: | 17 // JSModalDialogViews, public: |
| 18 | 18 |
| 19 JSModalDialogViews::JSModalDialogViews(JavaScriptAppModalDialog* parent) | 19 JSModalDialogViews::JSModalDialogViews(JavaScriptAppModalDialog* parent) |
| 20 : parent_(parent) { | 20 : parent_(parent) { |
| 21 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; | 21 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; |
| 22 if (parent->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) | 22 if (parent->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) |
| 23 options |= views::MessageBoxView::HAS_PROMPT_FIELD; | 23 options |= views::MessageBoxView::HAS_PROMPT_FIELD; |
| 24 | 24 |
| 25 message_box_view_ = new views::MessageBoxView(options, | 25 views::MessageBoxView::InitParams params(parent->message_text()); |
| 26 parent->message_text(), | 26 params.options = options; |
| 27 parent->default_prompt_text()); | 27 params.default_prompt = parent->default_prompt_text(); |
| 28 message_box_view_ = new views::MessageBoxView(params); |
| 28 DCHECK(message_box_view_); | 29 DCHECK(message_box_view_); |
| 29 | 30 |
| 30 message_box_view_->AddAccelerator( | 31 message_box_view_->AddAccelerator( |
| 31 ui::Accelerator(ui::VKEY_C, false, true, false)); | 32 ui::Accelerator(ui::VKEY_C, false, true, false)); |
| 32 if (parent->display_suppress_checkbox()) { | 33 if (parent->display_suppress_checkbox()) { |
| 33 message_box_view_->SetCheckBoxLabel( | 34 message_box_view_->SetCheckBoxLabel( |
| 34 l10n_util::GetStringUTF16(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); | 35 l10n_util::GetStringUTF16(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); |
| 35 } | 36 } |
| 36 } | 37 } |
| 37 | 38 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // NativeAppModalDialog, public: | 154 // NativeAppModalDialog, public: |
| 154 | 155 |
| 155 // static | 156 // static |
| 156 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( | 157 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( |
| 157 JavaScriptAppModalDialog* dialog, | 158 JavaScriptAppModalDialog* dialog, |
| 158 gfx::NativeWindow parent_window) { | 159 gfx::NativeWindow parent_window) { |
| 159 JSModalDialogViews* d = new JSModalDialogViews(dialog); | 160 JSModalDialogViews* d = new JSModalDialogViews(dialog); |
| 160 views::Widget::CreateWindowWithParent(d, parent_window); | 161 views::Widget::CreateWindowWithParent(d, parent_window); |
| 161 return d; | 162 return d; |
| 162 } | 163 } |
| OLD | NEW |