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

Side by Side Diff: components/app_modal/views/javascript_app_modal_dialog_views.cc

Issue 2684093002: Rename JavaScript "messages" to "dialogs". (Closed)
Patch Set: win fox Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
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"
11 #include "ui/base/l10n/l10n_util.h" 11 #include "ui/base/l10n/l10n_util.h"
12 #include "ui/events/keycodes/keyboard_codes.h" 12 #include "ui/events/keycodes/keyboard_codes.h"
13 #include "ui/views/controls/message_box_view.h" 13 #include "ui/views/controls/message_box_view.h"
14 #include "ui/views/controls/textfield/textfield.h" 14 #include "ui/views/controls/textfield/textfield.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 #include "ui/views/window/dialog_client_view.h" 16 #include "ui/views/window/dialog_client_view.h"
17 17
18 namespace app_modal { 18 namespace app_modal {
19 19
20 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
21 // JavaScriptAppModalDialogViews, public: 21 // JavaScriptAppModalDialogViews, public:
22 22
23 JavaScriptAppModalDialogViews::JavaScriptAppModalDialogViews( 23 JavaScriptAppModalDialogViews::JavaScriptAppModalDialogViews(
24 JavaScriptAppModalDialog* parent) 24 JavaScriptAppModalDialog* parent)
25 : parent_(parent) { 25 : parent_(parent) {
26 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; 26 int options = views::MessageBoxView::DETECT_DIRECTIONALITY;
27 if (parent->javascript_message_type() == 27 if (parent->javascript_dialog_type() ==
28 content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) 28 content::JAVASCRIPT_DIALOG_TYPE_PROMPT)
29 options |= views::MessageBoxView::HAS_PROMPT_FIELD; 29 options |= views::MessageBoxView::HAS_PROMPT_FIELD;
30 30
31 views::MessageBoxView::InitParams params(parent->message_text()); 31 views::MessageBoxView::InitParams params(parent->message_text());
32 params.options = options; 32 params.options = options;
33 params.default_prompt = parent->default_prompt_text(); 33 params.default_prompt = parent->default_prompt_text();
34 message_box_view_ = new views::MessageBoxView(params); 34 message_box_view_ = new views::MessageBoxView(params);
35 DCHECK(message_box_view_); 35 DCHECK(message_box_view_);
36 36
37 message_box_view_->AddAccelerator( 37 message_box_view_->AddAccelerator(
38 ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN)); 38 ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 ////////////////////////////////////////////////////////////////////////////// 80 //////////////////////////////////////////////////////////////////////////////
81 // JavaScriptAppModalDialogViews, views::DialogDelegate implementation: 81 // JavaScriptAppModalDialogViews, views::DialogDelegate implementation:
82 82
83 int JavaScriptAppModalDialogViews::GetDefaultDialogButton() const { 83 int JavaScriptAppModalDialogViews::GetDefaultDialogButton() const {
84 return ui::DIALOG_BUTTON_OK; 84 return ui::DIALOG_BUTTON_OK;
85 } 85 }
86 86
87 int JavaScriptAppModalDialogViews::GetDialogButtons() const { 87 int JavaScriptAppModalDialogViews::GetDialogButtons() const {
88 if (parent_->javascript_message_type() == 88 if (parent_->javascript_dialog_type() ==
89 content::JAVASCRIPT_MESSAGE_TYPE_ALERT) 89 content::JAVASCRIPT_DIALOG_TYPE_ALERT)
90 return ui::DIALOG_BUTTON_OK; 90 return ui::DIALOG_BUTTON_OK;
91 91
92 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; 92 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
93 } 93 }
94 94
95 base::string16 JavaScriptAppModalDialogViews::GetWindowTitle() const { 95 base::string16 JavaScriptAppModalDialogViews::GetWindowTitle() const {
96 return parent_->title(); 96 return parent_->title();
97 } 97 }
98 98
99 void JavaScriptAppModalDialogViews::DeleteDelegate() { 99 void JavaScriptAppModalDialogViews::DeleteDelegate() {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 views::Widget* JavaScriptAppModalDialogViews::GetWidget() { 153 views::Widget* JavaScriptAppModalDialogViews::GetWidget() {
154 return message_box_view_->GetWidget(); 154 return message_box_view_->GetWidget();
155 } 155 }
156 156
157 const views::Widget* JavaScriptAppModalDialogViews::GetWidget() const { 157 const views::Widget* JavaScriptAppModalDialogViews::GetWidget() const {
158 return message_box_view_->GetWidget(); 158 return message_box_view_->GetWidget();
159 } 159 }
160 160
161 } // namespace app_modal 161 } // namespace app_modal
OLDNEW
« no previous file with comments | « components/app_modal/javascript_dialog_manager.cc ('k') | content/browser/devtools/protocol/devtools_protocol_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698