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/. */
6 #ifndef mozilla_dom_Crypto_h
7 #define mozilla_dom_Crypto_h
9 #include "mozilla/dom/SubtleCrypto.h"
10 #include "nsIGlobalObject.h"
12 #include "nsWrapperCache.h"
13 #include "mozilla/dom/TypedArray.h"
21 class Crypto final
: public nsISupports
, public nsWrapperCache
{
26 explicit Crypto(nsIGlobalObject
* aParent
);
28 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto
)
31 void GetRandomValues(JSContext
* aCx
, const ArrayBufferView
& aArray
,
32 JS::MutableHandle
<JSObject
*> aRetval
, ErrorResult
& aRv
);
34 SubtleCrypto
* Subtle();
36 nsIGlobalObject
* GetParentObject() const { return mParent
; }
38 virtual JSObject
* WrapObject(JSContext
* aCx
,
39 JS::Handle
<JSObject
*> aGivenProto
) override
;
42 nsCOMPtr
<nsIGlobalObject
> mParent
;
43 RefPtr
<SubtleCrypto
> mSubtle
;
47 } // namespace mozilla
49 #endif // mozilla_dom_Crypto_h