Bug 1275841 - Rename nsSDR.(cpp|h) to SecretDecoderRing.(cpp|h). r=keeler

There are currently two ways of naming files containing the implementation of
interface nsIFoo:
1. nsFoo.(cpp|h) (previous convention)
2. Foo.(cpp|h) (new convention)

nsSDR.(cpp|h) matches neither of these. Renaming the files to follow convention
makes it easier to discover what the files implement, and increases codebase
consistency.

MozReview-Commit-ID: 3ThPxPouiie

--HG--
rename : security/manager/ssl/nsSDR.cpp => security/manager/ssl/SecretDecoderRing.cpp
rename : security/manager/ssl/nsSDR.h => security/manager/ssl/SecretDecoderRing.h
extra : transplant_source : %7D%FC%AD%9C%E8%AD%CFz%FE%F2%D6%1E%A0%0A%06sk%3D%AD%AC
This commit is contained in:
Cykesiopka 2016-08-19 09:36:53 +08:00
Родитель 819f6f556d
Коммит 986f32c262
5 изменённых файлов: 51 добавлений и 70 удалений

Просмотреть файл

@ -4,50 +4,41 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "stdlib.h"
#include "plstr.h"
#include "plbase64.h"
#include "SecretDecoderRing.h"
#include "ScopedNSSTypes.h"
#include "mozilla/Base64.h"
#include "mozilla/Casting.h"
#include "mozilla/Services.h"
#include "nsMemory.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsThreadUtils.h"
#include "nsCRT.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObserverService.h"
#include "nsIServiceManager.h"
#include "nsITokenPasswordDialogs.h"
#include "nsISecretDecoderRing.h"
#include "nsCRT.h"
#include "nsSDR.h"
#include "nsMemory.h"
#include "nsNSSComponent.h"
#include "nsNSSHelper.h"
#include "nsNSSShutDown.h"
#include "ScopedNSSTypes.h"
#include "nsString.h"
#include "nsThreadUtils.h"
#include "pk11func.h"
#include "pk11sdr.h" // For PK11SDR_Encrypt, PK11SDR_Decrypt
#include "plstr.h"
#include "ssl.h" // For SSL_ClearSessionCache
#include "stdlib.h"
using namespace mozilla;
// Standard ISupports implementation
// NOTE: Should these be the thread-safe versions?
NS_IMPL_ISUPPORTS(nsSecretDecoderRing, nsISecretDecoderRing, nsISecretDecoderRingConfig)
NS_IMPL_ISUPPORTS(SecretDecoderRing, nsISecretDecoderRing,
nsISecretDecoderRingConfig)
// nsSecretDecoderRing constructor
nsSecretDecoderRing::nsSecretDecoderRing()
SecretDecoderRing::SecretDecoderRing()
{
// initialize superclass
}
// nsSecretDecoderRing destructor
nsSecretDecoderRing::~nsSecretDecoderRing()
SecretDecoderRing::~SecretDecoderRing()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -58,8 +49,8 @@ nsSecretDecoderRing::~nsSecretDecoderRing()
}
NS_IMETHODIMP
nsSecretDecoderRing::Encrypt(unsigned char* data, uint32_t dataLen,
unsigned char** result, uint32_t* _retval)
SecretDecoderRing::Encrypt(unsigned char* data, uint32_t dataLen,
unsigned char** result, uint32_t* _retval)
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -105,8 +96,8 @@ nsSecretDecoderRing::Encrypt(unsigned char* data, uint32_t dataLen,
}
NS_IMETHODIMP
nsSecretDecoderRing::Decrypt(unsigned char* data, uint32_t dataLen,
unsigned char** result, uint32_t* _retval)
SecretDecoderRing::Decrypt(unsigned char* data, uint32_t dataLen,
unsigned char** result, uint32_t* _retval)
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -146,7 +137,7 @@ nsSecretDecoderRing::Decrypt(unsigned char* data, uint32_t dataLen,
}
NS_IMETHODIMP
nsSecretDecoderRing::EncryptString(const char* text, char** _retval)
SecretDecoderRing::EncryptString(const char* text, char** _retval)
{
nsresult rv = NS_OK;
unsigned char *encrypted = 0;
@ -169,7 +160,7 @@ loser:
}
NS_IMETHODIMP
nsSecretDecoderRing::DecryptString(const char* crypt, char** _retval)
SecretDecoderRing::DecryptString(const char* crypt, char** _retval)
{
nsresult rv = NS_OK;
char *r = 0;
@ -208,7 +199,7 @@ loser:
}
NS_IMETHODIMP
nsSecretDecoderRing::ChangePassword()
SecretDecoderRing::ChangePassword()
{
nsNSSShutDownPreventionLock locker;
if (isAlreadyShutDown()) {
@ -236,7 +227,7 @@ nsSecretDecoderRing::ChangePassword()
}
NS_IMETHODIMP
nsSecretDecoderRing::Logout()
SecretDecoderRing::Logout()
{
static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
@ -259,7 +250,7 @@ nsSecretDecoderRing::Logout()
}
NS_IMETHODIMP
nsSecretDecoderRing::LogoutAndTeardown()
SecretDecoderRing::LogoutAndTeardown()
{
static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
@ -291,7 +282,7 @@ nsSecretDecoderRing::LogoutAndTeardown()
}
NS_IMETHODIMP
nsSecretDecoderRing::SetWindow(nsISupports*)
SecretDecoderRing::SetWindow(nsISupports*)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -4,49 +4,38 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSSDR_H_
#define _NSSDR_H_
#ifndef SecretDecoderRing_h
#define SecretDecoderRing_h
#include "nsISecretDecoderRing.h"
#include "nsNSSShutDown.h"
/**
* NS_SDR_CONTRACTID - contract id for SDR services.
* Implements nsISecretDecoderRing.
* Should eventually implement an interface to set window
* context and other information. (nsISecretDecoderRingConfig)
*
* NOTE: This definition should move to base code. It
* is conditionally defined here until it is moved.
* Delete this after defining in the new location.
*/
#ifndef NS_SDR_CONTRACTID
#define NS_SDR_CONTRACTID "@mozilla.org/security/sdr;1"
#endif
#define NS_SECRETDECODERRING_CONTRACTID "@mozilla.org/security/sdr;1"
// ===============================================
// nsSecretDecoderRing - implementation of nsISecretDecoderRing
// ===============================================
#define NS_SDR_CID \
#define NS_SECRETDECODERRING_CID \
{ 0x0c4f1ddc, 0x1dd2, 0x11b2, { 0x9d, 0x95, 0xf2, 0xfd, 0xf1, 0x13, 0x04, 0x4b } }
class nsSecretDecoderRing : public nsISecretDecoderRing
, public nsISecretDecoderRingConfig
, public nsNSSShutDownObject
class SecretDecoderRing : public nsISecretDecoderRing
, public nsISecretDecoderRingConfig
, public nsNSSShutDownObject
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISECRETDECODERRING
NS_DECL_NSISECRETDECODERRINGCONFIG
nsSecretDecoderRing();
SecretDecoderRing();
// Nothing to release.
virtual void virtualDestroyNSSReference() override {}
protected:
virtual ~nsSecretDecoderRing();
virtual ~SecretDecoderRing();
};
#endif /* _NSSDR_H_ */
#endif // SecretDecoderRing_h

Просмотреть файл

@ -123,7 +123,6 @@ UNIFIED_SOURCES += [
'nsProtectedAuthThread.cpp',
'nsPSMBackgroundThread.cpp',
'nsRandomGenerator.cpp',
'nsSDR.cpp',
'nsSecureBrowserUIImpl.cpp',
'nsSecurityHeaderParser.cpp',
'NSSErrorsService.cpp',
@ -135,6 +134,7 @@ UNIFIED_SOURCES += [
'PSMRunnable.cpp',
'PublicKeyPinningService.cpp',
'RootCertificateTelemetryUtils.cpp',
'SecretDecoderRing.cpp',
'SharedSSLState.cpp',
'SSLServerCertVerification.cpp',
'TransportSecurityInfo.cpp',

Просмотреть файл

@ -15,12 +15,13 @@
#include "nsILineInputStream.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIOutputStream.h"
#include "nsISafeOutputStream.h"
#include "nsIX509Cert.h"
#include "nsNSSCertHelper.h"
#include "nsNSSCertificate.h"
#include "nsNSSComponent.h"
#include "nsNetUtil.h"
#include "nsISafeOutputStream.h"
#include "nsPromiseFlatString.h"
#include "nsStreamUtils.h"
#include "nsStringBuffer.h"

Просмотреть файл

@ -6,38 +6,38 @@
#include "CertBlocklist.h"
#include "ContentSignatureVerifier.h"
#include "NSSErrorsService.h"
#include "PSMContentListener.h"
#include "SecretDecoderRing.h"
#include "TransportSecurityInfo.h"
#include "WeakCryptoOverride.h"
#include "mozilla/ModuleUtils.h"
#include "nsCURILoader.h"
#include "nsCertOverrideService.h"
#include "nsCertPicker.h"
#include "nsCrypto.h"
#include "nsCryptoHash.h"
#include "nsCURILoader.h"
#include "nsDOMCID.h" // For the NS_CRYPTO_CONTRACTID define
#include "nsDataSignatureVerifier.h"
#include "nsDOMCID.h" //For the NS_CRYPTO_CONTRACTID define
#include "nsICategoryManager.h"
#include "nsKeygenHandler.h"
#include "nsKeyModule.h"
#include "mozilla/ModuleUtils.h"
#include "nsNetCID.h"
#include "nsKeygenHandler.h"
#include "nsNSSCertificate.h"
#include "nsNSSCertificateDB.h"
#include "nsNSSCertificateFakeTransport.h"
#include "nsNSSComponent.h"
#include "NSSErrorsService.h"
#include "nsNSSU2FToken.h"
#include "nsNSSVersion.h"
#include "nsNTLMAuthModule.h"
#include "nsNetCID.h"
#include "nsPK11TokenDB.h"
#include "nsPKCS11Slot.h"
#include "PSMContentListener.h"
#include "nsRandomGenerator.h"
#include "nsSDR.h"
#include "nsSecureBrowserUIImpl.h"
#include "nsSiteSecurityService.h"
#include "nsSSLSocketProvider.h"
#include "nsSSLStatus.h"
#include "nsSecureBrowserUIImpl.h"
#include "nsSiteSecurityService.h"
#include "nsTLSSocketProvider.h"
#include "TransportSecurityInfo.h"
#include "WeakCryptoOverride.h"
#include "nsXULAppAPI.h"
#ifdef MOZ_XUL
@ -186,7 +186,7 @@ namespace {
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsSSLSocketProvider)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsTLSSocketProvider)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsSecretDecoderRing)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, SecretDecoderRing)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPK11TokenDB)
NS_NSS_GENERIC_FACTORY_CONSTRUCTOR(nssEnsure, nsPKCS11ModuleDB)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(PSMContentListener, init)
@ -226,7 +226,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(WeakCryptoOverride)
NS_DEFINE_NAMED_CID(NS_NSSCOMPONENT_CID);
NS_DEFINE_NAMED_CID(NS_SSLSOCKETPROVIDER_CID);
NS_DEFINE_NAMED_CID(NS_STARTTLSSOCKETPROVIDER_CID);
NS_DEFINE_NAMED_CID(NS_SDR_CID);
NS_DEFINE_NAMED_CID(NS_SECRETDECODERRING_CID);
NS_DEFINE_NAMED_CID(NS_PK11TOKENDB_CID);
NS_DEFINE_NAMED_CID(NS_PKCS11MODULEDB_CID);
NS_DEFINE_NAMED_CID(NS_PSMCONTENTLISTEN_CID);
@ -262,7 +262,7 @@ static const mozilla::Module::CIDEntry kNSSCIDs[] = {
{ &kNS_NSSCOMPONENT_CID, false, nullptr, nsNSSComponentConstructor },
{ &kNS_SSLSOCKETPROVIDER_CID, false, nullptr, nsSSLSocketProviderConstructor },
{ &kNS_STARTTLSSOCKETPROVIDER_CID, false, nullptr, nsTLSSocketProviderConstructor },
{ &kNS_SDR_CID, false, nullptr, nsSecretDecoderRingConstructor },
{ &kNS_SECRETDECODERRING_CID, false, nullptr, SecretDecoderRingConstructor },
{ &kNS_PK11TOKENDB_CID, false, nullptr, nsPK11TokenDBConstructor },
{ &kNS_PKCS11MODULEDB_CID, false, nullptr, nsPKCS11ModuleDBConstructor },
{ &kNS_PSMCONTENTLISTEN_CID, false, nullptr, PSMContentListenerConstructor },
@ -302,7 +302,7 @@ static const mozilla::Module::ContractIDEntry kNSSContracts[] = {
{ NS_NSSVERSION_CONTRACTID, &kNS_NSSVERSION_CID },
{ NS_SSLSOCKETPROVIDER_CONTRACTID, &kNS_SSLSOCKETPROVIDER_CID },
{ NS_STARTTLSSOCKETPROVIDER_CONTRACTID, &kNS_STARTTLSSOCKETPROVIDER_CID },
{ NS_SDR_CONTRACTID, &kNS_SDR_CID },
{ NS_SECRETDECODERRING_CONTRACTID, &kNS_SECRETDECODERRING_CID },
{ NS_PK11TOKENDB_CONTRACTID, &kNS_PK11TOKENDB_CID },
{ NS_PKCS11MODULEDB_CONTRACTID, &kNS_PKCS11MODULEDB_CID },
{ NS_PSMCONTENTLISTEN_CONTRACTID, &kNS_PSMCONTENTLISTEN_CID },