| Index: chrome/browser/ui/views/crypto_module_password_dialog_view.cc
|
| diff --git a/chrome/browser/ui/views/crypto_module_password_dialog_view.cc b/chrome/browser/ui/views/crypto_module_password_dialog_view.cc
|
| index fb436f9279d94000171f477882dd24b4406a78c2..12a51aefc951767f6b93257f5a1affcc6fc0d4d4 100644
|
| --- a/chrome/browser/ui/views/crypto_module_password_dialog_view.cc
|
| +++ b/chrome/browser/ui/views/crypto_module_password_dialog_view.cc
|
| @@ -4,11 +4,7 @@
|
|
|
| #include "chrome/browser/ui/views/crypto_module_password_dialog_view.h"
|
|
|
| -#include "base/basictypes.h"
|
| -#include "base/bind.h"
|
| #include "base/utf_string_conversions.h"
|
| -#include "chrome/browser/ui/views/window.h"
|
| -#include "googleurl/src/gurl.h"
|
| #include "grit/generated_resources.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/views/controls/button/text_button.h"
|
| @@ -20,13 +16,14 @@
|
|
|
| namespace browser {
|
|
|
| -// CryptoModulePasswordDialogView
|
| ////////////////////////////////////////////////////////////////////////////////
|
| +// CryptoModulePasswordDialogView, public:
|
| +
|
| CryptoModulePasswordDialogView::CryptoModulePasswordDialogView(
|
| const std::string& slot_name,
|
| - browser::CryptoModulePasswordReason reason,
|
| + CryptoModulePasswordReason reason,
|
| const std::string& server,
|
| - const base::Callback<void(const char*)>& callback)
|
| + const CryptoModulePasswordCallback& callback)
|
| : callback_(callback) {
|
| Init(server, slot_name, reason);
|
| }
|
| @@ -34,10 +31,60 @@ CryptoModulePasswordDialogView::CryptoModulePasswordDialogView(
|
| CryptoModulePasswordDialogView::~CryptoModulePasswordDialogView() {
|
| }
|
|
|
| -void CryptoModulePasswordDialogView::Init(
|
| - const std::string& server,
|
| - const std::string& slot_name,
|
| - browser::CryptoModulePasswordReason reason) {
|
| +////////////////////////////////////////////////////////////////////////////////
|
| +// CryptoModulePasswordDialogView, private:
|
| +
|
| +views::View* CryptoModulePasswordDialogView::GetInitiallyFocusedView() {
|
| + return password_entry_;
|
| +}
|
| +
|
| +ui::ModalType CryptoModulePasswordDialogView::GetModalType() const {
|
| + return ui::MODAL_TYPE_WINDOW;
|
| +}
|
| +
|
| +string16 CryptoModulePasswordDialogView::GetWindowTitle() const {
|
| + return l10n_util::GetStringUTF16(IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE);
|
| +}
|
| +
|
| +views::View* CryptoModulePasswordDialogView::GetContentsView() {
|
| + return this;
|
| +}
|
| +
|
| +string16 CryptoModulePasswordDialogView::GetDialogButtonLabel(
|
| + ui::DialogButton button) const {
|
| + return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK ?
|
| + IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL : IDS_CANCEL);
|
| +}
|
| +
|
| +bool CryptoModulePasswordDialogView::Cancel() {
|
| + callback_.Run(static_cast<const char*>(NULL));
|
| + const string16 empty;
|
| + password_entry_->SetText(empty);
|
| + return true;
|
| +}
|
| +
|
| +bool CryptoModulePasswordDialogView::Accept() {
|
| + callback_.Run(UTF16ToUTF8(password_entry_->text()).c_str());
|
| + const string16 empty;
|
| + password_entry_->SetText(empty);
|
| + return true;
|
| +}
|
| +
|
| +
|
| +void CryptoModulePasswordDialogView::ContentsChanged(
|
| + views::Textfield* sender,
|
| + const string16& new_contents) {
|
| +}
|
| +
|
| +bool CryptoModulePasswordDialogView::HandleKeyEvent(
|
| + views::Textfield* sender,
|
| + const views::KeyEvent& keystroke) {
|
| + return false;
|
| +}
|
| +
|
| +void CryptoModulePasswordDialogView::Init(const std::string& server,
|
| + const std::string& slot_name,
|
| + CryptoModulePasswordReason reason) {
|
| // Select an appropriate text for the reason.
|
| std::string text;
|
| const string16& server16 = UTF8ToUTF16(server);
|
| @@ -105,53 +152,6 @@ void CryptoModulePasswordDialogView::Init(
|
| layout->AddView(password_entry_);
|
| }
|
|
|
| -views::View* CryptoModulePasswordDialogView::GetInitiallyFocusedView() {
|
| - return password_entry_;
|
| -}
|
| -
|
| -ui::ModalType CryptoModulePasswordDialogView::GetModalType() const {
|
| - return ui::MODAL_TYPE_WINDOW;
|
| -}
|
| -
|
| -views::View* CryptoModulePasswordDialogView::GetContentsView() {
|
| - return this;
|
| -}
|
| -
|
| -string16 CryptoModulePasswordDialogView::GetDialogButtonLabel(
|
| - ui::DialogButton button) const {
|
| - return l10n_util::GetStringUTF16(button == ui::DIALOG_BUTTON_OK ?
|
| - IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL : IDS_CANCEL);
|
| -}
|
| -
|
| -bool CryptoModulePasswordDialogView::Accept() {
|
| - callback_.Run(UTF16ToUTF8(password_entry_->text()).c_str());
|
| - const string16 empty;
|
| - password_entry_->SetText(empty);
|
| - return true;
|
| -}
|
| -
|
| -bool CryptoModulePasswordDialogView::Cancel() {
|
| - callback_.Run(static_cast<const char*>(NULL));
|
| - const string16 empty;
|
| - password_entry_->SetText(empty);
|
| - return true;
|
| -}
|
| -
|
| -bool CryptoModulePasswordDialogView::HandleKeyEvent(
|
| - views::Textfield* sender,
|
| - const views::KeyEvent& keystroke) {
|
| - return false;
|
| -}
|
| -
|
| -void CryptoModulePasswordDialogView::ContentsChanged(
|
| - views::Textfield* sender,
|
| - const string16& new_contents) {
|
| -}
|
| -
|
| -string16 CryptoModulePasswordDialogView::GetWindowTitle() const {
|
| - return l10n_util::GetStringUTF16(IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE);
|
| -}
|
| -
|
| void ShowCryptoModulePasswordDialog(
|
| const std::string& slot_name,
|
| bool retry,
|
|
|