dom/base/Crypto.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     4 #ifndef mozilla_dom_Crypto_h
     5 #define mozilla_dom_Crypto_h
     7 #ifdef MOZ_DISABLE_CRYPTOLEGACY
     8 #include "nsIDOMCrypto.h"
     9 #else
    10 #include "nsIDOMCryptoLegacy.h"
    11 namespace mozilla {
    12 namespace dom {
    13 class CRMFObject;
    14 }
    15 }
    16 #endif
    18 #include "nsPIDOMWindow.h"
    20 #include "nsWrapperCache.h"
    21 #include "mozilla/dom/TypedArray.h"
    22 #define NS_DOMCRYPTO_CID \
    23   {0x929d9320, 0x251e, 0x11d4, { 0x8a, 0x7c, 0x00, 0x60, 0x08, 0xc8, 0x44, 0xc3} }
    25 namespace mozilla {
    27 class ErrorResult;
    29 namespace dom {
    31 class Crypto : public nsIDOMCrypto,
    32                public nsWrapperCache
    33 {
    34 public:
    35   Crypto();
    36   virtual ~Crypto();
    38   NS_DECL_NSIDOMCRYPTO
    40   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    41   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto)
    43   void
    44   GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray,
    45 		  JS::MutableHandle<JSObject*> aRetval,
    46 		  ErrorResult& aRv);
    48 #ifndef MOZ_DISABLE_CRYPTOLEGACY
    49   virtual bool EnableSmartCardEvents();
    50   virtual void SetEnableSmartCardEvents(bool aEnable, ErrorResult& aRv);
    52   virtual void GetVersion(nsString& aVersion);
    54   virtual mozilla::dom::CRMFObject*
    55   GenerateCRMFRequest(JSContext* aContext,
    56                       const nsCString& aReqDN,
    57                       const nsCString& aRegToken,
    58                       const nsCString& aAuthenticator,
    59                       const nsCString& aEaCert,
    60                       const nsCString& aJsCallback,
    61                       const Sequence<JS::Value>& aArgs,
    62                       ErrorResult& aRv);
    64   virtual void ImportUserCertificates(const nsAString& aNickname,
    65                                       const nsAString& aCmmfResponse,
    66                                       bool aDoForcedBackup,
    67                                       nsAString& aReturn,
    68                                       ErrorResult& aRv);
    70   virtual void SignText(JSContext* aContext,
    71                         const nsAString& aStringToSign,
    72                         const nsAString& aCaOption,
    73                         const Sequence<nsCString>& aArgs,
    74                         nsAString& aReturn);
    76   virtual void Logout(ErrorResult& aRv);
    78 #endif
    80   // WebIDL
    82   nsPIDOMWindow*
    83   GetParentObject() const
    84   {
    85     return mWindow;
    86   }
    88   virtual JSObject*
    89   WrapObject(JSContext* aCx) MOZ_OVERRIDE;
    91   static uint8_t*
    92   GetRandomValues(uint32_t aLength);
    94 private:
    95   nsCOMPtr<nsPIDOMWindow> mWindow;
    96 };
    98 } // namespace dom
    99 } // namespace mozilla
   101 #endif // mozilla_dom_Crypto_h

mercurial