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 "components/app_modal/views/javascript_app_modal_dialog_views.h" | 5 #include "components/app_modal/views/javascript_app_modal_dialog_views.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/app_modal/javascript_app_modal_dialog.h" | 8 #include "components/app_modal/javascript_app_modal_dialog.h" |
9 #include "components/constrained_window/constrained_window_views.h" | 9 #include "components/constrained_window/constrained_window_views.h" |
10 #include "grit/components_strings.h" | 10 #include "grit/components_strings.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 parent_->OnCancel(message_box_view_->IsCheckBoxSelected()); | 104 parent_->OnCancel(message_box_view_->IsCheckBoxSelected()); |
105 return true; | 105 return true; |
106 } | 106 } |
107 | 107 |
108 bool JavaScriptAppModalDialogViews::Accept() { | 108 bool JavaScriptAppModalDialogViews::Accept() { |
109 parent_->OnAccept(message_box_view_->GetInputText(), | 109 parent_->OnAccept(message_box_view_->GetInputText(), |
110 message_box_view_->IsCheckBoxSelected()); | 110 message_box_view_->IsCheckBoxSelected()); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 void JavaScriptAppModalDialogViews::OnClosed() { | |
115 parent_->OnClose(); | |
116 } | |
117 | |
118 views::Widget* JavaScriptAppModalDialogViews::GetWidget() { | |
119 return message_box_view_->GetWidget(); | |
120 } | |
121 | |
122 const views::Widget* JavaScriptAppModalDialogViews::GetWidget() const { | |
123 return message_box_view_->GetWidget(); | |
124 } | |
125 | |
126 base::string16 JavaScriptAppModalDialogViews::GetDialogButtonLabel( | 114 base::string16 JavaScriptAppModalDialogViews::GetDialogButtonLabel( |
127 ui::DialogButton button) const { | 115 ui::DialogButton button) const { |
128 if (parent_->is_before_unload_dialog()) { | 116 if (parent_->is_before_unload_dialog()) { |
129 if (button == ui::DIALOG_BUTTON_OK) { | 117 if (button == ui::DIALOG_BUTTON_OK) { |
130 return l10n_util::GetStringUTF16( | 118 return l10n_util::GetStringUTF16( |
131 parent_->is_reload() ? | 119 parent_->is_reload() ? |
132 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL : | 120 IDS_BEFORERELOAD_MESSAGEBOX_OK_BUTTON_LABEL : |
133 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); | 121 IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL); |
134 } else if (button == ui::DIALOG_BUTTON_CANCEL) { | 122 } else if (button == ui::DIALOG_BUTTON_CANCEL) { |
135 return l10n_util::GetStringUTF16( | 123 return l10n_util::GetStringUTF16( |
(...skipping 15 matching lines...) Expand all Loading... |
151 views::View* JavaScriptAppModalDialogViews::GetContentsView() { | 139 views::View* JavaScriptAppModalDialogViews::GetContentsView() { |
152 return message_box_view_; | 140 return message_box_view_; |
153 } | 141 } |
154 | 142 |
155 views::View* JavaScriptAppModalDialogViews::GetInitiallyFocusedView() { | 143 views::View* JavaScriptAppModalDialogViews::GetInitiallyFocusedView() { |
156 if (message_box_view_->text_box()) | 144 if (message_box_view_->text_box()) |
157 return message_box_view_->text_box(); | 145 return message_box_view_->text_box(); |
158 return views::DialogDelegate::GetInitiallyFocusedView(); | 146 return views::DialogDelegate::GetInitiallyFocusedView(); |
159 } | 147 } |
160 | 148 |
| 149 void JavaScriptAppModalDialogViews::WindowClosing() { |
| 150 parent_->OnClose(); |
| 151 } |
| 152 |
| 153 views::Widget* JavaScriptAppModalDialogViews::GetWidget() { |
| 154 return message_box_view_->GetWidget(); |
| 155 } |
| 156 |
| 157 const views::Widget* JavaScriptAppModalDialogViews::GetWidget() const { |
| 158 return message_box_view_->GetWidget(); |
| 159 } |
| 160 |
161 } // namespace app_modal | 161 } // namespace app_modal |
OLD | NEW |