diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 03:01:23 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 03:01:23 +0000 |
commit | 3f1f841392663dfb331150218908e3c159be1286 (patch) | |
tree | 3ebbe98ad663aa46d2a8b2dd7d443201d500efef | |
parent | 5ec9ce8d11e0c32406d31a3060d087305ef6abdc (diff) | |
download | chromium_src-3f1f841392663dfb331150218908e3c159be1286.zip chromium_src-3f1f841392663dfb331150218908e3c159be1286.tar.gz chromium_src-3f1f841392663dfb331150218908e3c159be1286.tar.bz2 |
Cleanup for r71281: replace usage of "pk11" with "pkcs11" or "crypto module", as appropriate.
BUG=42073
TEST=manual,trybotss
Review URL: http://codereview.chromium.org/6303004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71749 0039d316-1c4b-4281-b951-d872f2087c98
15 files changed, 157 insertions, 146 deletions
diff --git a/base/base.gypi b/base/base.gypi index e2c659a..b68ced8 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -556,6 +556,7 @@ 'sources': [ 'crypto/capi_util.cc', 'crypto/capi_util.h', + 'crypto/crypto_module_blocking_password_delegate.h', 'crypto/cssm_init.cc', 'crypto/cssm_init.h', 'crypto/encryptor.h', @@ -563,7 +564,6 @@ 'crypto/encryptor_nss.cc', 'crypto/encryptor_openssl.cc', 'crypto/encryptor_win.cc', - 'crypto/pk11_blocking_password_delegate.h', 'crypto/rsa_private_key.h', 'crypto/rsa_private_key.cc', 'crypto/rsa_private_key_mac.cc', diff --git a/base/crypto/pk11_blocking_password_delegate.h b/base/crypto/crypto_module_blocking_password_delegate.h index c9eb35c..ae962a8 100644 --- a/base/crypto/pk11_blocking_password_delegate.h +++ b/base/crypto/crypto_module_blocking_password_delegate.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ -#define BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ +#ifndef BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ +#define BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ #pragma once #include <string> @@ -11,12 +11,12 @@ namespace base { // PK11_SetPasswordFunc is a global setting. An implementation of -// PK11BlockingPasswordDelegate should be passed as the user data argument -// (|wincx|) to relevant NSS functions, which the global password handler will -// call to do the actual work. -class PK11BlockingPasswordDelegate { +// CryptoModuleBlockingPasswordDelegate should be passed as the user data +// argument (|wincx|) to relevant NSS functions, which the global password +// handler will call to do the actual work. +class CryptoModuleBlockingPasswordDelegate { public: - virtual ~PK11BlockingPasswordDelegate() {} + virtual ~CryptoModuleBlockingPasswordDelegate() {} // Requests a password to unlock |slot_name|. The interface is // synchronous because NSS cannot issue an asynchronous @@ -31,4 +31,4 @@ class PK11BlockingPasswordDelegate { } -#endif // BASE_CRYPTO_PK11_BLOCKING_PASSWORD_DELEGATE_H_ +#endif // BASE_CRYPTO_CRYPTO_MODULE_BLOCKING_PASSWORD_DELEGATE_H_ diff --git a/base/nss_util.cc b/base/nss_util.cc index da678f0..384cc0d 100644 --- a/base/nss_util.cc +++ b/base/nss_util.cc @@ -29,7 +29,7 @@ // use NSS for crypto or certificate verification, and we don't use the NSS // certificate and key databases. #if defined(USE_NSS) -#include "base/crypto/pk11_blocking_password_delegate.h" +#include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/environment.h" #include "base/lock.h" #include "base/scoped_ptr.h" @@ -71,10 +71,10 @@ FilePath GetInitialConfigDirectory() { } // This callback for NSS forwards all requests to a caller-specified -// PK11BlockingPasswordDelegate object. -char* PK11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { - base::PK11BlockingPasswordDelegate* delegate = - reinterpret_cast<base::PK11BlockingPasswordDelegate*>(arg); +// CryptoModuleBlockingPasswordDelegate object. +char* PKCS11PasswordFunc(PK11SlotInfo* slot, PRBool retry, void* arg) { + base::CryptoModuleBlockingPasswordDelegate* delegate = + reinterpret_cast<base::CryptoModuleBlockingPasswordDelegate*>(arg); if (delegate) { bool cancelled = false; std::string password = delegate->RequestPassword(PK11_GetTokenName(slot), @@ -274,7 +274,7 @@ class NSSInitSingleton { } } - PK11_SetPasswordFunc(PK11PasswordFunc); + PK11_SetPasswordFunc(PKCS11PasswordFunc); // If we haven't initialized the password for the NSS databases, // initialize an empty-string password so that we don't need to diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5f94492..43620de 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -6523,29 +6523,29 @@ Keep your key file in a safe place. You will need it to create new versions of y Select a certificate to authenticate yourself to <ph name="HOST_NAME">$1<ex>www.google.com</ex></ph> </message> - <!-- NSS PK11 password dialog --> - <message name="IDS_PK11_AUTH_DIALOG_TITLE" desc="The title in the dialog that prompts for security device password."> + <!-- NSS PKCS #11 password dialog --> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE" desc="The title in the dialog that prompts for security device password."> Sign in to Security Device </message> - <message name="IDS_PK11_AUTH_DIALOG_TEXT_KEYGEN" desc="The text in the dialog that prompts for security device password for key generation."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_KEYGEN" desc="The text in the dialog that prompts for security device password for key generation."> Please sign in to <ph name="TOKEN_NAME">$1<ex>Software Security Device</ex></ph> to generate a key for <ph name="HOST_NAME">$2<ex>www.google.com</ex></ph>. </message> - <message name="IDS_PK11_AUTH_DIALOG_TEXT_CERT_ENROLLMENT" desc="The text in the dialog that prompts for security device password for cert enrollment."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_ENROLLMENT" desc="The text in the dialog that prompts for security device password for cert enrollment."> Please sign in to <ph name="TOKEN_NAME">$1<ex>Software Security Device</ex></ph> to import client certificate from <ph name="HOST_NAME">$2<ex>www.google.com</ex></ph>. </message> - <message name="IDS_PK11_AUTH_DIALOG_TEXT_CLIENT_AUTH" desc="The text in the dialog that prompts for security device password when doing key generation."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CLIENT_AUTH" desc="The text in the dialog that prompts for security device password when doing key generation."> Please sign in to <ph name="TOKEN_NAME">$1<ex>Software Security Device</ex></ph> to authenticate to <ph name="HOST_NAME">$2<ex>www.google.com</ex></ph> with your certificate. </message> - <message name="IDS_PK11_AUTH_DIALOG_TEXT_CERT_IMPORT" desc="The text in the dialog that prompts for security device password when using the certificate manager to import a client certificate."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_IMPORT" desc="The text in the dialog that prompts for security device password when using the certificate manager to import a client certificate."> Please sign in to <ph name="TOKEN_NAME">$1<ex>Software Security Device</ex></ph> to import the client certificate. </message> - <message name="IDS_PK11_AUTH_DIALOG_TEXT_CERT_EXPORT" desc="The text in the dialog that prompts for security device password when using the certificate manager to export a client certificate."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_EXPORT" desc="The text in the dialog that prompts for security device password when using the certificate manager to export a client certificate."> Please sign in to <ph name="TOKEN_NAME">$1<ex>Software Security Device</ex></ph> to export the client certificate. </message> - <message name="IDS_PK11_AUTH_DIALOG_PASSWORD_FIELD" desc="Label for password entry in the dialog that prompts for security device password."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_PASSWORD_FIELD" desc="Label for password entry in the dialog that prompts for security device password."> Password: </message> - <message name="IDS_PK11_AUTH_DIALOG_OK_BUTTON_LABEL" desc="Label for OK button in the dialog that prompts for security device password."> + <message name="IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL" desc="Label for OK button in the dialog that prompts for security device password."> Unlock </message> diff --git a/chrome/browser/dom_ui/options/certificate_manager_handler.cc b/chrome/browser/dom_ui/options/certificate_manager_handler.cc index e14d684..c337f77 100644 --- a/chrome/browser/dom_ui/options/certificate_manager_handler.cc +++ b/chrome/browser/dom_ui/options/certificate_manager_handler.cc @@ -18,7 +18,7 @@ #include "chrome/browser/gtk/certificate_dialogs.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #include "grit/generated_resources.h" #include "net/base/crypto_module.h" #include "net/base/x509_certificate.h" @@ -538,7 +538,7 @@ void CertificateManagerHandler::ExportPersonalPasswordSelected( // TODO(mattm): do something smarter about non-extractable keys browser::UnlockCertSlotIfNecessary( selected_cert_list_[0].get(), - browser::kPK11PasswordCertExport, + browser::kCryptoModulePasswordCertExport, "", // unused. NewCallback(this, &CertificateManagerHandler::ExportPersonalSlotsUnlocked)); @@ -631,7 +631,7 @@ void CertificateManagerHandler::ImportPersonalFileRead( browser::UnlockSlotIfNecessary( module_.get(), - browser::kPK11PasswordCertImport, + browser::kCryptoModulePasswordCertImport, "", // unused. NewCallback(this, &CertificateManagerHandler::ImportPersonalSlotUnlocked)); diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc index 00a97b0..9e506e9 100644 --- a/chrome/browser/renderer_host/render_message_filter.cc +++ b/chrome/browser/renderer_host/render_message_filter.cc @@ -85,7 +85,7 @@ #include "chrome/common/child_process_host.h" #endif #if defined(USE_NSS) -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #endif #if defined(USE_TCMALLOC) #include "chrome/browser/browser_about_handler.h" @@ -1389,9 +1389,9 @@ void RenderMessageFilter::OnKeygenOnWorkerThread( #if defined(USE_NSS) // Attach a password delegate so we can authenticate. - keygen_handler.set_pk11_password_delegate( - browser::NewPK11BlockingDialogDelegate(browser::kPK11PasswordKeygen, - url.host())); + keygen_handler.set_crypto_module_password_delegate( + browser::NewCryptoModuleBlockingDialogDelegate( + browser::kCryptoModulePasswordKeygen, url.host())); #endif // defined(USE_NSS) ViewHostMsg_Keygen::WriteReplyParams( diff --git a/chrome/browser/ui/pk11_password_dialog.h b/chrome/browser/ui/crypto_module_password_dialog.h index 4f0decc..a6d9052 100644 --- a/chrome/browser/ui/pk11_password_dialog.h +++ b/chrome/browser/ui/crypto_module_password_dialog.h @@ -1,9 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ -#define CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ +#ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ +#define CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ #pragma once #include <string> @@ -11,7 +11,7 @@ #include "base/callback.h" namespace base { -class PK11BlockingPasswordDelegate; +class CryptoModuleBlockingPasswordDelegate; } namespace net { @@ -22,37 +22,38 @@ class X509Certificate; namespace browser { // An enum to describe the reason for the password request. -enum PK11PasswordReason { - kPK11PasswordKeygen, - kPK11PasswordCertEnrollment, - kPK11PasswordClientAuth, - kPK11PasswordCertImport, - kPK11PasswordCertExport, +enum CryptoModulePasswordReason { + kCryptoModulePasswordKeygen, + kCryptoModulePasswordCertEnrollment, + kCryptoModulePasswordClientAuth, + kCryptoModulePasswordCertImport, + kCryptoModulePasswordCertExport, }; -typedef Callback1<const char*>::Type PK11PasswordCallback; +typedef Callback1<const char*>::Type CryptoModulePasswordCallback; // Display a dialog, prompting the user to authenticate to unlock // |module|. |reason| describes the purpose of the authentication and // affects the message displayed in the dialog. |server| is the name // of the server which requested the access. -void ShowPK11PasswordDialog(const std::string& module_name, +void ShowCryptoModulePasswordDialog(const std::string& module_name, bool retry, - PK11PasswordReason reason, + CryptoModulePasswordReason reason, const std::string& server, - PK11PasswordCallback* callback); + CryptoModulePasswordCallback* callback); -// Returns a PK11BlockingPasswordDelegate to open a dialog and block +// Returns a CryptoModuleBlockingPasswordDelegate to open a dialog and block // until returning. Should only be used on a worker thread. -base::PK11BlockingPasswordDelegate* NewPK11BlockingDialogDelegate( - PK11PasswordReason reason, - const std::string& server); +base::CryptoModuleBlockingPasswordDelegate* + NewCryptoModuleBlockingDialogDelegate( + CryptoModulePasswordReason reason, + const std::string& server); // Asynchronously unlock |module|, if necessary. |callback| is called when done // (regardless if module was successfully unlocked or not). Should only be // called on UI thread. void UnlockSlotIfNecessary(net::CryptoModule* module, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& server, Callback0::Type* callback); @@ -60,10 +61,10 @@ void UnlockSlotIfNecessary(net::CryptoModule* module, // called when done (regardless if module was successfully unlocked or not). // Should only be called on UI thread. void UnlockCertSlotIfNecessary(net::X509Certificate* cert, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& server, Callback0::Type* callback); } // namespace browser -#endif // CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ +#endif // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ diff --git a/chrome/browser/ui/pk11_password_dialog_nss.cc b/chrome/browser/ui/crypto_module_password_dialog_nss.cc index 1eeeff1..d0b1357 100644 --- a/chrome/browser/ui/pk11_password_dialog_nss.cc +++ b/chrome/browser/ui/crypto_module_password_dialog_nss.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #include <pk11pub.h> @@ -19,7 +19,7 @@ namespace { class SlotUnlocker { public: SlotUnlocker(net::CryptoModule* module, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback); @@ -30,14 +30,14 @@ class SlotUnlocker { void Done(); scoped_refptr<net::CryptoModule> module_; - browser::PK11PasswordReason reason_; + browser::CryptoModulePasswordReason reason_; std::string host_; Callback0::Type* callback_; PRBool retry_; }; SlotUnlocker::SlotUnlocker(net::CryptoModule* module, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback) : module_(module), @@ -51,7 +51,7 @@ SlotUnlocker::SlotUnlocker(net::CryptoModule* module, void SlotUnlocker::Start() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - ShowPK11PasswordDialog( + ShowCryptoModulePasswordDialog( module_->GetTokenName(), retry_, reason_, @@ -98,7 +98,7 @@ void SlotUnlocker::Done() { namespace browser { void UnlockSlotIfNecessary(net::CryptoModule* module, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -112,7 +112,7 @@ void UnlockSlotIfNecessary(net::CryptoModule* module, } void UnlockCertSlotIfNecessary(net::X509Certificate* cert, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback) { scoped_refptr<net::CryptoModule> module(net::CryptoModule::CreateFromHandle( diff --git a/chrome/browser/ui/pk11_password_dialog_openssl.cc b/chrome/browser/ui/crypto_module_password_dialog_openssl.cc index e3f6219..b5c40c5 100644 --- a/chrome/browser/ui/pk11_password_dialog_openssl.cc +++ b/chrome/browser/ui/crypto_module_password_dialog_openssl.cc @@ -1,15 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #include "base/logging.h" namespace browser { void UnlockSlotIfNecessary(net::CryptoModule* module, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback) { // TODO(bulach): implement me. @@ -17,7 +17,7 @@ void UnlockSlotIfNecessary(net::CryptoModule* module, } void UnlockCertSlotIfNecessary(net::X509Certificate* cert, - browser::PK11PasswordReason reason, + browser::CryptoModulePasswordReason reason, const std::string& host, Callback0::Type* callback) { // TODO(bulach): implement me. diff --git a/chrome/browser/ui/gtk/pk11_password_dialog.cc b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc index 92c2bb5..a6205e9 100644 --- a/chrome/browser/ui/gtk/pk11_password_dialog.cc +++ b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #include <gtk/gtk.h> #include "app/gtk_signal.h" #include "app/l10n_util.h" #include "base/basictypes.h" -#include "base/crypto/pk11_blocking_password_delegate.h" +#include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/synchronization/waitable_event.h" #include "base/task.h" #include "base/utf_string_conversions.h" @@ -20,10 +20,11 @@ namespace { -class PK11BlockingDialogDelegate : public base::PK11BlockingPasswordDelegate { +class CryptoModuleBlockingDialogDelegate + : public base::CryptoModuleBlockingPasswordDelegate { public: - PK11BlockingDialogDelegate(browser::PK11PasswordReason reason, - const std::string& server) + CryptoModuleBlockingDialogDelegate(browser::CryptoModulePasswordReason reason, + const std::string& server) : event_(false, false), reason_(reason), server_(server), @@ -31,11 +32,11 @@ class PK11BlockingDialogDelegate : public base::PK11BlockingPasswordDelegate { cancelled_(false) { } - ~PK11BlockingDialogDelegate() { + ~CryptoModuleBlockingDialogDelegate() { password_.replace(0, password_.size(), password_.size(), 0); } - // base::PK11BlockingDialogDelegate implementation. + // base::CryptoModuleBlockingDialogDelegate implementation. virtual std::string RequestPassword(const std::string& slot_name, bool retry, bool* cancelled) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -43,8 +44,10 @@ class PK11BlockingDialogDelegate : public base::PK11BlockingPasswordDelegate { event_.Reset(); if (BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - NewRunnableMethod(this, &PK11BlockingDialogDelegate::ShowDialog, - slot_name, retry))) { + NewRunnableMethod(this, + &CryptoModuleBlockingDialogDelegate::ShowDialog, + slot_name, + retry))) { event_.Wait(); } *cancelled = cancelled_; @@ -54,9 +57,9 @@ class PK11BlockingDialogDelegate : public base::PK11BlockingPasswordDelegate { private: void ShowDialog(const std::string& slot_name, bool retry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - ShowPK11PasswordDialog( + ShowCryptoModulePasswordDialog( slot_name, retry, reason_, server_, - NewCallback(this, &PK11BlockingDialogDelegate::GotPassword)); + NewCallback(this, &CryptoModuleBlockingDialogDelegate::GotPassword)); } void GotPassword(const char* password) { if (password) @@ -66,45 +69,46 @@ class PK11BlockingDialogDelegate : public base::PK11BlockingPasswordDelegate { event_.Signal(); } base::WaitableEvent event_; - browser::PK11PasswordReason reason_; + browser::CryptoModulePasswordReason reason_; std::string server_; std::string password_; bool cancelled_; - DISALLOW_COPY_AND_ASSIGN(PK11BlockingDialogDelegate); + DISALLOW_COPY_AND_ASSIGN(CryptoModuleBlockingDialogDelegate); }; // TODO(mattm): change into a constrained dialog. -class PK11PasswordDialog { +class CryptoModulePasswordDialog { public: - PK11PasswordDialog(const std::string& slot_name, - bool retry, - browser::PK11PasswordReason reason, - const std::string& server, - browser::PK11PasswordCallback* callback); + CryptoModulePasswordDialog(const std::string& slot_name, + bool retry, + browser::CryptoModulePasswordReason reason, + const std::string& server, + browser::CryptoModulePasswordCallback* callback); void Show(); private: - CHROMEGTK_CALLBACK_1(PK11PasswordDialog, void, OnResponse, int); - CHROMEGTK_CALLBACK_0(PK11PasswordDialog, void, OnWindowDestroy); + CHROMEGTK_CALLBACK_1(CryptoModulePasswordDialog, void, OnResponse, int); + CHROMEGTK_CALLBACK_0(CryptoModulePasswordDialog, void, OnWindowDestroy); - scoped_ptr<browser::PK11PasswordCallback> callback_; + scoped_ptr<browser::CryptoModulePasswordCallback> callback_; GtkWidget* dialog_; GtkWidget* password_entry_; - DISALLOW_COPY_AND_ASSIGN(PK11PasswordDialog); + DISALLOW_COPY_AND_ASSIGN(CryptoModulePasswordDialog); }; -PK11PasswordDialog::PK11PasswordDialog(const std::string& slot_name, - bool retry, - browser::PK11PasswordReason reason, - const std::string& server, - browser::PK11PasswordCallback* callback) +CryptoModulePasswordDialog::CryptoModulePasswordDialog( + const std::string& slot_name, + bool retry, + browser::CryptoModulePasswordReason reason, + const std::string& server, + browser::CryptoModulePasswordCallback* callback) : callback_(callback) { dialog_ = gtk_dialog_new_with_buttons( - l10n_util::GetStringUTF8(IDS_PK11_AUTH_DIALOG_TITLE).c_str(), + l10n_util::GetStringUTF8(IDS_CRYPTO_MODULE_AUTH_DIALOG_TITLE).c_str(), NULL, GTK_DIALOG_NO_SEPARATOR, NULL); // Populate the buttons later, for control over the OK button. @@ -112,7 +116,8 @@ PK11PasswordDialog::PK11PasswordDialog(const std::string& slot_name, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); GtkWidget* ok_button = gtk_util::AddButtonToDialog( dialog_, - l10n_util::GetStringUTF8(IDS_PK11_AUTH_DIALOG_OK_BUTTON_LABEL).c_str(), + l10n_util::GetStringUTF8( + IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL).c_str(), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); @@ -123,25 +128,25 @@ PK11PasswordDialog::PK11PasswordDialog(const std::string& slot_name, const string16& server16 = UTF8ToUTF16(server); const string16& slot16 = UTF8ToUTF16(slot_name); switch (reason) { - case browser::kPK11PasswordKeygen: - text = l10n_util::GetStringFUTF8(IDS_PK11_AUTH_DIALOG_TEXT_KEYGEN, - slot16, server16); + case browser::kCryptoModulePasswordKeygen: + text = l10n_util::GetStringFUTF8( + IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_KEYGEN, slot16, server16); break; - case browser::kPK11PasswordCertEnrollment: + case browser::kCryptoModulePasswordCertEnrollment: text = l10n_util::GetStringFUTF8( - IDS_PK11_AUTH_DIALOG_TEXT_CERT_ENROLLMENT, slot16, server16); + IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_ENROLLMENT, slot16, server16); break; - case browser::kPK11PasswordClientAuth: - text = l10n_util::GetStringFUTF8(IDS_PK11_AUTH_DIALOG_TEXT_CLIENT_AUTH, - slot16, server16); + case browser::kCryptoModulePasswordClientAuth: + text = l10n_util::GetStringFUTF8( + IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CLIENT_AUTH, slot16, server16); break; - case browser::kPK11PasswordCertImport: - text = l10n_util::GetStringFUTF8(IDS_PK11_AUTH_DIALOG_TEXT_CERT_IMPORT, - slot16); + case browser::kCryptoModulePasswordCertImport: + text = l10n_util::GetStringFUTF8( + IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_IMPORT, slot16); break; - case browser::kPK11PasswordCertExport: - text = l10n_util::GetStringFUTF8(IDS_PK11_AUTH_DIALOG_TEXT_CERT_EXPORT, - slot16); + case browser::kCryptoModulePasswordCertExport: + text = l10n_util::GetStringFUTF8( + IDS_CRYPTO_MODULE_AUTH_DIALOG_TEXT_CERT_EXPORT, slot16); break; default: NOTREACHED(); @@ -159,7 +164,7 @@ PK11PasswordDialog::PK11PasswordDialog(const std::string& slot_name, GtkWidget* password_box = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing); gtk_box_pack_start(GTK_BOX(password_box), gtk_label_new(l10n_util::GetStringUTF8( - IDS_PK11_AUTH_DIALOG_PASSWORD_FIELD).c_str()), + IDS_CRYPTO_MODULE_AUTH_DIALOG_PASSWORD_FIELD).c_str()), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(password_box), password_entry_, TRUE, TRUE, 0); @@ -173,11 +178,12 @@ PK11PasswordDialog::PK11PasswordDialog(const std::string& slot_name, G_CALLBACK(OnWindowDestroyThunk), this); } -void PK11PasswordDialog::Show() { +void CryptoModulePasswordDialog::Show() { gtk_util::ShowDialog(dialog_); } -void PK11PasswordDialog::OnResponse(GtkWidget* dialog, int response_id) { +void CryptoModulePasswordDialog::OnResponse(GtkWidget* dialog, + int response_id) { if (response_id == GTK_RESPONSE_ACCEPT) callback_->Run(gtk_entry_get_text(GTK_ENTRY(password_entry_))); else @@ -190,29 +196,31 @@ void PK11PasswordDialog::OnResponse(GtkWidget* dialog, int response_id) { gtk_widget_destroy(GTK_WIDGET(dialog_)); } -void PK11PasswordDialog::OnWindowDestroy(GtkWidget* widget) { +void CryptoModulePasswordDialog::OnWindowDestroy(GtkWidget* widget) { delete this; } } // namespace // Every post-task we do blocks, so there's no need to ref-count. -DISABLE_RUNNABLE_METHOD_REFCOUNT(PK11BlockingDialogDelegate); +DISABLE_RUNNABLE_METHOD_REFCOUNT(CryptoModuleBlockingDialogDelegate); namespace browser { -void ShowPK11PasswordDialog(const std::string& slot_name, - bool retry, - PK11PasswordReason reason, - const std::string& server, - PK11PasswordCallback* callback) { - (new PK11PasswordDialog(slot_name, retry, reason, server, callback))->Show(); +void ShowCryptoModulePasswordDialog(const std::string& slot_name, + bool retry, + CryptoModulePasswordReason reason, + const std::string& server, + CryptoModulePasswordCallback* callback) { + (new CryptoModulePasswordDialog(slot_name, retry, reason, server, + callback))->Show(); } -base::PK11BlockingPasswordDelegate* NewPK11BlockingDialogDelegate( - PK11PasswordReason reason, - const std::string& server) { - return new PK11BlockingDialogDelegate(reason, server); +base::CryptoModuleBlockingPasswordDelegate* + NewCryptoModuleBlockingDialogDelegate( + CryptoModulePasswordReason reason, + const std::string& server) { + return new CryptoModuleBlockingDialogDelegate(reason, server); } } // namespace browser diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc index 635c5a99..6657795 100644 --- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc @@ -21,7 +21,7 @@ #include "chrome/browser/gtk/owned_widget_gtk.h" #include "chrome/browser/ssl/ssl_client_auth_handler.h" #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/ui/pk11_password_dialog.h" +#include "chrome/browser/ui/crypto_module_password_dialog.h" #include "chrome/common/net/x509_certificate_model.h" #include "gfx/native_widget_types.h" #include "grit/generated_resources.h" @@ -344,7 +344,7 @@ void SSLClientCertificateSelector::OnOkClicked(GtkWidget* button) { browser::UnlockCertSlotIfNecessary( cert, - browser::kPK11PasswordClientAuth, + browser::kCryptoModulePasswordClientAuth, cert_request_info_->host_and_port, NewCallback(this, &SSLClientCertificateSelector::Unlocked)); } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 7ec6394..1c6e037 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1401,6 +1401,7 @@ 'browser/ui/gtk/custom_button.h', 'browser/ui/gtk/custom_drag.cc', 'browser/ui/gtk/custom_drag.h', + 'browser/ui/gtk/crypto_module_password_dialog.cc', 'browser/ui/gtk/dialogs_gtk.cc', 'browser/ui/gtk/download_in_progress_dialog_gtk.cc', 'browser/ui/gtk/download_in_progress_dialog_gtk.h', @@ -1537,7 +1538,6 @@ 'browser/ui/gtk/owned_widget_gtk.cc', 'browser/ui/gtk/owned_widget_gtk.h', 'browser/ui/gtk/page_info_bubble_gtk.cc', - 'browser/ui/gtk/pk11_password_dialog.cc', 'browser/ui/gtk/process_singleton_dialog.cc', 'browser/ui/gtk/process_singleton_dialog.h', 'browser/ui/gtk/reload_button_gtk.cc', @@ -3088,6 +3088,9 @@ 'browser/ui/cocoa/wrench_menu/wrench_menu_button_cell.mm', 'browser/ui/cocoa/wrench_menu/wrench_menu_controller.h', 'browser/ui/cocoa/wrench_menu/wrench_menu_controller.mm', + 'browser/ui/crypto_module_password_dialog.h', + 'browser/ui/crypto_module_password_dialog_nss.cc', + 'browser/ui/crypto_module_password_dialog_openssl.cc', 'browser/ui/find_bar/find_bar.h', 'browser/ui/find_bar/find_bar_controller.cc', 'browser/ui/find_bar/find_bar_controller.h', @@ -3114,9 +3117,6 @@ 'browser/ui/options/options_window.h', 'browser/ui/options/show_options_url.cc', 'browser/ui/options/show_options_url.h', - 'browser/ui/pk11_password_dialog.h', - 'browser/ui/pk11_password_dialog_nss.cc', - 'browser/ui/pk11_password_dialog_openssl.cc', 'browser/ui/status_bubble.h', 'browser/ui/tab_contents/tab_contents_wrapper.cc', 'browser/ui/tab_contents/tab_contents_wrapper.h', @@ -3747,7 +3747,7 @@ 'browser/renderer_host/gpu_view_host.h', 'browser/renderer_host/video_layer_proxy.cc', 'browser/renderer_host/video_layer_proxy.h', - 'browser/ui/pk11_password_dialog_nss.cc', + 'browser/ui/crypto_module_password_dialog_nss.cc', 'browser/ui/views/extensions/extension_view.cc', 'browser/ui/views/extensions/extension_view.h', ], @@ -3925,7 +3925,7 @@ 'browser/importer/nss_decryptor_system_nss.cc', 'browser/importer/nss_decryptor_system_nss.h', 'browser/power_save_blocker_stub.cc', - 'browser/ui/pk11_password_dialog_nss.cc', + 'browser/ui/crypto_module_password_dialog_nss.cc', 'browser/ui/views/keyboard_overlay_delegate.cc', 'browser/ui/views/select_file_dialog.cc', ], @@ -4217,6 +4217,7 @@ ['include', '^browser/ui/gtk/collected_cookies_gtk.h'], ['include', '^browser/ui/gtk/constrained_window_gtk.cc'], ['include', '^browser/ui/gtk/constrained_window_gtk.h'], + ['include', '^browser/ui/gtk/crypto_module_password_dialog.cc'], ['include', '^browser/ui/gtk/gtk_chrome_cookie_view.cc'], ['include', '^browser/ui/gtk/gtk_chrome_cookie_view.h'], ['include', '^browser/ui/gtk/download_started_animation_gtk.cc'], @@ -4253,7 +4254,6 @@ ['include', '^browser/ui/gtk/options/'], ['include', '^browser/ui/gtk/owned_widget_gtk.cc'], ['include', '^browser/ui/gtk/owned_widget_gtk.h'], - ['include', '^browser/ui/gtk/pk11_password_dialog.cc'], ['include', '^browser/ui/gtk/popup_blocked_animation_gtk.cc'], ['include', '^browser/ui/gtk/repost_form_warning_gtk.cc'], ['include', '^browser/ui/gtk/repost_form_warning_gtk.h'], @@ -4413,10 +4413,10 @@ 'browser/importer/nss_decryptor.cc', 'browser/importer/nss_decryptor_system_nss.cc', 'browser/importer/nss_decryptor_system_nss.h', - 'browser/ui/pk11_password_dialog_nss.cc', + 'browser/ui/crypto_module_password_dialog_nss.cc', ]}, { 'sources!': [ - 'browser/ui/pk11_password_dialog_openssl.cc', + 'browser/ui/crypto_module_password_dialog_openssl.cc', ]}, ], ], diff --git a/net/base/keygen_handler.cc b/net/base/keygen_handler.cc index 771ad73..8c88b4d 100644 --- a/net/base/keygen_handler.cc +++ b/net/base/keygen_handler.cc @@ -5,14 +5,14 @@ #include "net/base/keygen_handler.h" #if defined(USE_NSS) -#include "base/crypto/pk11_blocking_password_delegate.h" +#include "base/crypto/crypto_module_blocking_password_delegate.h" #endif namespace net { // The constructor and destructor must be defined in a .cc file so that -// PK11BlockingPasswordDelegate can be forward-declared on platforms which use -// NSS. +// CryptoModuleBlockingPasswordDelegate can be forward-declared on platforms +// which use NSS. KeygenHandler::KeygenHandler(int key_size_in_bits, const std::string& challenge, diff --git a/net/base/keygen_handler.h b/net/base/keygen_handler.h index d12d084..817720d 100644 --- a/net/base/keygen_handler.h +++ b/net/base/keygen_handler.h @@ -14,7 +14,7 @@ #if defined(USE_NSS) namespace base { -class PK11BlockingPasswordDelegate; +class CryptoModuleBlockingPasswordDelegate; }; #endif // defined(USE_NSS) @@ -47,7 +47,8 @@ class KeygenHandler { // GenKeyAndSignChallenge runs on a worker thread, so using the blocking // password callback is okay here. // Takes ownership of the delegate. - void set_pk11_password_delegate(base::PK11BlockingPasswordDelegate* delegate); + void set_crypto_module_password_delegate( + base::CryptoModuleBlockingPasswordDelegate* delegate); #endif // defined(USE_NSS) private: @@ -57,7 +58,8 @@ class KeygenHandler { bool stores_key_; // should the generated key-pair be stored persistently? #if defined(USE_NSS) // The callback for requesting a password to the PKCS#11 token. - scoped_ptr<base::PK11BlockingPasswordDelegate> pk11_password_delegate_; + scoped_ptr<base::CryptoModuleBlockingPasswordDelegate> + crypto_module_password_delegate_; #endif // defined(USE_NSS) }; diff --git a/net/base/keygen_handler_nss.cc b/net/base/keygen_handler_nss.cc index a3505c4..74fb9a6 100644 --- a/net/base/keygen_handler_nss.cc +++ b/net/base/keygen_handler_nss.cc @@ -4,7 +4,7 @@ #include "net/base/keygen_handler.h" -#include "base/crypto/pk11_blocking_password_delegate.h" +#include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/crypto/scoped_nss_types.h" #include "base/logging.h" #include "base/nss_util.h" @@ -29,7 +29,7 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { // Authenticate to the token. if (SECSuccess != PK11_Authenticate(slot.get(), PR_TRUE, - pk11_password_delegate_.get())) { + crypto_module_password_delegate_.get())) { LOG(ERROR) << "Couldn't authenticate to internal key slot!"; return std::string(); } @@ -38,9 +38,9 @@ std::string KeygenHandler::GenKeyAndSignChallenge() { slot.get(), stores_key_); } -void KeygenHandler::set_pk11_password_delegate( - base::PK11BlockingPasswordDelegate* delegate) { - pk11_password_delegate_.reset(delegate); +void KeygenHandler::set_crypto_module_password_delegate( + base::CryptoModuleBlockingPasswordDelegate* delegate) { + crypto_module_password_delegate_.reset(delegate); } } // namespace net |