1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_Crypto_h
8 #define mozilla_dom_Crypto_h
10 #include "mozilla/dom/SubtleCrypto.h"
11 #include "nsIGlobalObject.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/TypedArray.h"
22 class Crypto final
: public nsISupports
, public nsWrapperCache
{
27 explicit Crypto(nsIGlobalObject
* aParent
);
29 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
30 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(Crypto
)
32 void GetRandomValues(JSContext
* aCx
, const ArrayBufferView
& aArray
,
33 JS::MutableHandle
<JSObject
*> aRetval
, ErrorResult
& aRv
);
35 void RandomUUID(nsACString
& aRetVal
);
37 SubtleCrypto
* Subtle();
39 nsIGlobalObject
* GetParentObject() const { return mParent
; }
41 virtual JSObject
* WrapObject(JSContext
* aCx
,
42 JS::Handle
<JSObject
*> aGivenProto
) override
;
45 nsCOMPtr
<nsIGlobalObject
> mParent
;
46 RefPtr
<SubtleCrypto
> mSubtle
;
50 } // namespace mozilla
52 #endif // mozilla_dom_Crypto_h