| 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 "chrome/browser/ui/views/crypto_module_password_dialog_view.h" | 5 #include "chrome/browser/ui/views/crypto_module_password_dialog_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return l10n_util::GetStringUTF16(IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE); | 47 return l10n_util::GetStringUTF16(IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE); |
| 48 } | 48 } |
| 49 | 49 |
| 50 string16 CryptoModulePasswordDialogView::GetDialogButtonLabel( | 50 string16 CryptoModulePasswordDialogView::GetDialogButtonLabel( |
| 51 ui::DialogButton button) const { | 51 ui::DialogButton button) const { |
| 52 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK ? | 52 return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK ? |
| 53 IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL : IDS_CANCEL); | 53 IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL : IDS_CANCEL); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool CryptoModulePasswordDialogView::Cancel() { | 56 bool CryptoModulePasswordDialogView::Cancel() { |
| 57 callback_.Run(static_cast<const char*>(NULL)); | 57 callback_.Run(std::string()); |
| 58 const base::string16 empty; | 58 const base::string16 empty; |
| 59 password_entry_->SetText(empty); | 59 password_entry_->SetText(empty); |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 bool CryptoModulePasswordDialogView::Accept() { | 63 bool CryptoModulePasswordDialogView::Accept() { |
| 64 callback_.Run(UTF16ToUTF8(password_entry_->text()).c_str()); | 64 callback_.Run(UTF16ToUTF8(password_entry_->text())); |
| 65 const base::string16 empty; | 65 const base::string16 empty; |
| 66 password_entry_->SetText(empty); | 66 password_entry_->SetText(empty); |
| 67 return true; | 67 return true; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void CryptoModulePasswordDialogView::ContentsChanged( | 70 void CryptoModulePasswordDialogView::ContentsChanged( |
| 71 views::Textfield* sender, | 71 views::Textfield* sender, |
| 72 const base::string16& new_contents) { | 72 const base::string16& new_contents) { |
| 73 } | 73 } |
| 74 | 74 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 CryptoModulePasswordReason reason, | 154 CryptoModulePasswordReason reason, |
| 155 const std::string& server, | 155 const std::string& server, |
| 156 gfx::NativeWindow parent, | 156 gfx::NativeWindow parent, |
| 157 const CryptoModulePasswordCallback& callback) { | 157 const CryptoModulePasswordCallback& callback) { |
| 158 CryptoModulePasswordDialogView* dialog = | 158 CryptoModulePasswordDialogView* dialog = |
| 159 new CryptoModulePasswordDialogView(slot_name, reason, server, callback); | 159 new CryptoModulePasswordDialogView(slot_name, reason, server, callback); |
| 160 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent)->Show(); | 160 views::DialogDelegate::CreateDialogWidget(dialog, NULL, parent)->Show(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace chrome | 163 } // namespace chrome |
| OLD | NEW |