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

Side by Side Diff: chrome/browser/ui/views/javascript_app_modal_dialog_views.cc

Issue 10451047: content: Move javascript_message_type.h into content/ from ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm CONTEXT_EXPORT Created 8 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/ui/views/javascript_app_modal_dialog_views.h" 5 #include "chrome/browser/ui/views/javascript_app_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/javascript_app_modal_dialog.h" 8 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_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 // JavaScriptAppModalDialogViews, public: 17 // JavaScriptAppModalDialogViews, public:
18 18
19 JavaScriptAppModalDialogViews::JavaScriptAppModalDialogViews( 19 JavaScriptAppModalDialogViews::JavaScriptAppModalDialogViews(
20 JavaScriptAppModalDialog* parent) 20 JavaScriptAppModalDialog* parent)
21 : parent_(parent) { 21 : parent_(parent) {
22 int options = views::MessageBoxView::DETECT_DIRECTIONALITY; 22 int options = views::MessageBoxView::DETECT_DIRECTIONALITY;
23 if (parent->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_PROMPT) 23 if (parent->javascript_message_type() ==
24 content::JAVASCRIPT_MESSAGE_TYPE_PROMPT)
24 options |= views::MessageBoxView::HAS_PROMPT_FIELD; 25 options |= views::MessageBoxView::HAS_PROMPT_FIELD;
25 26
26 views::MessageBoxView::InitParams params(parent->message_text()); 27 views::MessageBoxView::InitParams params(parent->message_text());
27 params.options = options; 28 params.options = options;
28 params.default_prompt = parent->default_prompt_text(); 29 params.default_prompt = parent->default_prompt_text();
29 message_box_view_ = new views::MessageBoxView(params); 30 message_box_view_ = new views::MessageBoxView(params);
30 DCHECK(message_box_view_); 31 DCHECK(message_box_view_);
31 32
32 message_box_view_->AddAccelerator( 33 message_box_view_->AddAccelerator(
33 ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN)); 34 ui::Accelerator(ui::VKEY_C, ui::EF_CONTROL_DOWN));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 70 }
70 71
71 ////////////////////////////////////////////////////////////////////////////// 72 //////////////////////////////////////////////////////////////////////////////
72 // JavaScriptAppModalDialogViews, views::DialogDelegate implementation: 73 // JavaScriptAppModalDialogViews, views::DialogDelegate implementation:
73 74
74 int JavaScriptAppModalDialogViews::GetDefaultDialogButton() const { 75 int JavaScriptAppModalDialogViews::GetDefaultDialogButton() const {
75 return ui::DIALOG_BUTTON_OK; 76 return ui::DIALOG_BUTTON_OK;
76 } 77 }
77 78
78 int JavaScriptAppModalDialogViews::GetDialogButtons() const { 79 int JavaScriptAppModalDialogViews::GetDialogButtons() const {
79 if (parent_->javascript_message_type() == ui::JAVASCRIPT_MESSAGE_TYPE_ALERT) 80 if (parent_->javascript_message_type() ==
81 content::JAVASCRIPT_MESSAGE_TYPE_ALERT)
80 return ui::DIALOG_BUTTON_OK; 82 return ui::DIALOG_BUTTON_OK;
81 83
82 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; 84 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
83 } 85 }
84 86
85 string16 JavaScriptAppModalDialogViews::GetWindowTitle() const { 87 string16 JavaScriptAppModalDialogViews::GetWindowTitle() const {
86 return parent_->title(); 88 return parent_->title();
87 } 89 }
88 90
89 void JavaScriptAppModalDialogViews::WindowClosing() { 91 void JavaScriptAppModalDialogViews::WindowClosing() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // NativeAppModalDialog, public: 157 // NativeAppModalDialog, public:
156 158
157 // static 159 // static
158 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt( 160 NativeAppModalDialog* NativeAppModalDialog::CreateNativeJavaScriptPrompt(
159 JavaScriptAppModalDialog* dialog, 161 JavaScriptAppModalDialog* dialog,
160 gfx::NativeWindow parent_window) { 162 gfx::NativeWindow parent_window) {
161 JavaScriptAppModalDialogViews* d = new JavaScriptAppModalDialogViews(dialog); 163 JavaScriptAppModalDialogViews* d = new JavaScriptAppModalDialogViews(dialog);
162 views::Widget::CreateWindowWithParent(d, parent_window); 164 views::Widget::CreateWindowWithParent(d, parent_window);
163 return d; 165 return d;
164 } 166 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/javascript_app_modal_dialog_gtk.cc ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698