| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/javascript_dialogs/javascript_dialog_views.h" | 5 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_views.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/constrained_window/constrained_window_views.h" | 8 #include "components/constrained_window/constrained_window_views.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/views/controls/message_box_view.h" | 10 #include "ui/views/controls/message_box_view.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 JavaScriptDialogViews::JavaScriptDialogViews( | 93 JavaScriptDialogViews::JavaScriptDialogViews( |
| 94 content::WebContents* parent_web_contents, | 94 content::WebContents* parent_web_contents, |
| 95 content::WebContents* alerting_web_contents, | 95 content::WebContents* alerting_web_contents, |
| 96 const base::string16& title, | 96 const base::string16& title, |
| 97 content::JavaScriptMessageType message_type, | 97 content::JavaScriptMessageType message_type, |
| 98 const base::string16& message_text, | 98 const base::string16& message_text, |
| 99 const base::string16& default_prompt_text, | 99 const base::string16& default_prompt_text, |
| 100 const content::JavaScriptDialogManager::DialogClosedCallback& | 100 const content::JavaScriptDialogManager::DialogClosedCallback& |
| 101 dialog_callback) | 101 dialog_callback) |
| 102 : title_(title), | 102 : JavaScriptDialog(parent_web_contents), |
| 103 title_(title), |
| 103 message_type_(message_type), | 104 message_type_(message_type), |
| 104 message_text_(message_text), | 105 message_text_(message_text), |
| 105 default_prompt_text_(default_prompt_text), | 106 default_prompt_text_(default_prompt_text), |
| 106 dialog_callback_(dialog_callback), | 107 dialog_callback_(dialog_callback), |
| 107 weak_factory_(this) { | 108 weak_factory_(this) { |
| 108 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; | 109 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; |
| 109 if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) | 110 if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) |
| 110 options |= views::MessageBoxView::HAS_PROMPT_FIELD; | 111 options |= views::MessageBoxView::HAS_PROMPT_FIELD; |
| 111 | 112 |
| 112 views::MessageBoxView::InitParams params(message_text); | 113 views::MessageBoxView::InitParams params(message_text); |
| 113 params.options = options; | 114 params.options = options; |
| 114 params.default_prompt = default_prompt_text; | 115 params.default_prompt = default_prompt_text; |
| 115 message_box_view_ = new views::MessageBoxView(params); | 116 message_box_view_ = new views::MessageBoxView(params); |
| 116 DCHECK(message_box_view_); | 117 DCHECK(message_box_view_); |
| 117 | 118 |
| 118 constrained_window::ShowWebModalDialogViews(this, parent_web_contents); | 119 constrained_window::ShowWebModalDialogViews(this, parent_web_contents); |
| 119 } | 120 } |
| OLD | NEW |