michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef mozilla_dom_Crypto_h michael@0: #define mozilla_dom_Crypto_h michael@0: michael@0: #ifdef MOZ_DISABLE_CRYPTOLEGACY michael@0: #include "nsIDOMCrypto.h" michael@0: #else michael@0: #include "nsIDOMCryptoLegacy.h" michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class CRMFObject; michael@0: } michael@0: } michael@0: #endif michael@0: michael@0: #include "nsPIDOMWindow.h" michael@0: michael@0: #include "nsWrapperCache.h" michael@0: #include "mozilla/dom/TypedArray.h" michael@0: #define NS_DOMCRYPTO_CID \ michael@0: {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} } michael@0: michael@0: namespace mozilla { michael@0: michael@0: class ErrorResult; michael@0: michael@0: namespace dom { michael@0: michael@0: class Crypto : public nsIDOMCrypto, michael@0: public nsWrapperCache michael@0: { michael@0: public: michael@0: Crypto(); michael@0: virtual ~Crypto(); michael@0: michael@0: NS_DECL_NSIDOMCRYPTO michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto) michael@0: michael@0: void michael@0: GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray, michael@0: JS::MutableHandle aRetval, michael@0: ErrorResult& aRv); michael@0: michael@0: #ifndef MOZ_DISABLE_CRYPTOLEGACY michael@0: virtual bool EnableSmartCardEvents(); michael@0: virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv); michael@0: michael@0: virtual void GetVersion(nsString& aVersion); michael@0: michael@0: virtual mozilla::dom::CRMFObject* michael@0: GenerateCRMFRequest(JSContext* aContext, michael@0: const nsCString& aReqDN, michael@0: const nsCString& aRegToken, michael@0: const nsCString& aAuthenticator, michael@0: const nsCString& aEaCert, michael@0: const nsCString& aJsCallback, michael@0: const Sequence& aArgs, michael@0: ErrorResult& aRv); michael@0: michael@0: virtual void ImportUserCertificates(const nsAString& aNickname, michael@0: const nsAString& aCmmfResponse, michael@0: bool aDoForcedBackup, michael@0: nsAString& aReturn, michael@0: ErrorResult& aRv); michael@0: michael@0: virtual void SignText(JSContext* aContext, michael@0: const nsAString& aStringToSign, michael@0: const nsAString& aCaOption, michael@0: const Sequence& aArgs, michael@0: nsAString& aReturn); michael@0: michael@0: virtual void Logout(ErrorResult& aRv); michael@0: michael@0: #endif michael@0: michael@0: // WebIDL michael@0: michael@0: nsPIDOMWindow* michael@0: GetParentObject() const michael@0: { michael@0: return mWindow; michael@0: } michael@0: michael@0: virtual JSObject* michael@0: WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: static uint8_t* michael@0: GetRandomValues(uint32_t aLength); michael@0: michael@0: private: michael@0: nsCOMPtr mWindow; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_Crypto_h