| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/jsmessage_box_dialog.h" | 5 #include "chrome/browser/views/jsmessage_box_dialog.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" |
| 7 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 8 #include "app/message_box_flags.h" | 9 #include "app/message_box_flags.h" |
| 9 #include "base/keyboard_codes.h" | |
| 10 #include "chrome/browser/app_modal_dialog.h" | 10 #include "chrome/browser/app_modal_dialog.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "views/controls/message_box_view.h" | 13 #include "views/controls/message_box_view.h" |
| 14 #include "views/window/window.h" | 14 #include "views/window/window.h" |
| 15 | 15 |
| 16 JavaScriptMessageBoxDialog::JavaScriptMessageBoxDialog( | 16 JavaScriptMessageBoxDialog::JavaScriptMessageBoxDialog( |
| 17 JavaScriptAppModalDialog* parent, | 17 JavaScriptAppModalDialog* parent, |
| 18 const std::wstring& message_text, | 18 const std::wstring& message_text, |
| 19 const std::wstring& default_prompt_text, | 19 const std::wstring& default_prompt_text, |
| 20 bool display_suppress_checkbox) | 20 bool display_suppress_checkbox) |
| 21 : parent_(parent), | 21 : parent_(parent), |
| 22 message_box_view_(new MessageBoxView( | 22 message_box_view_(new MessageBoxView( |
| 23 parent->dialog_flags() | MessageBoxFlags::kAutoDetectAlignment, | 23 parent->dialog_flags() | MessageBoxFlags::kAutoDetectAlignment, |
| 24 message_text, default_prompt_text)) { | 24 message_text, default_prompt_text)) { |
| 25 DCHECK(message_box_view_); | 25 DCHECK(message_box_view_); |
| 26 | 26 |
| 27 message_box_view_->AddAccelerator( | 27 message_box_view_->AddAccelerator( |
| 28 views::Accelerator(base::VKEY_C, false, true, false)); | 28 views::Accelerator(app::VKEY_C, false, true, false)); |
| 29 if (display_suppress_checkbox) { | 29 if (display_suppress_checkbox) { |
| 30 message_box_view_->SetCheckBoxLabel( | 30 message_box_view_->SetCheckBoxLabel( |
| 31 l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); | 31 l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 JavaScriptMessageBoxDialog::~JavaScriptMessageBoxDialog() { | 35 JavaScriptMessageBoxDialog::~JavaScriptMessageBoxDialog() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 gfx::NativeWindow JavaScriptMessageBoxDialog::GetDialogRootWindow() { | 38 gfx::NativeWindow JavaScriptMessageBoxDialog::GetDialogRootWindow() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 views::View* JavaScriptMessageBoxDialog::GetContentsView() { | 110 views::View* JavaScriptMessageBoxDialog::GetContentsView() { |
| 111 return message_box_view_; | 111 return message_box_view_; |
| 112 } | 112 } |
| 113 | 113 |
| 114 views::View* JavaScriptMessageBoxDialog::GetInitiallyFocusedView() { | 114 views::View* JavaScriptMessageBoxDialog::GetInitiallyFocusedView() { |
| 115 if (message_box_view_->text_box()) | 115 if (message_box_view_->text_box()) |
| 116 return message_box_view_->text_box(); | 116 return message_box_view_->text_box(); |
| 117 return views::DialogDelegate::GetInitiallyFocusedView(); | 117 return views::DialogDelegate::GetInitiallyFocusedView(); |
| 118 } | 118 } |
| OLD | NEW |