/src/mozilla-central/dom/base/Crypto.h
Line | Count | Source (jump to first uncovered line) |
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 |
8 | | |
9 | | #include "mozilla/dom/SubtleCrypto.h" |
10 | | #include "nsIGlobalObject.h" |
11 | | |
12 | | #include "nsWrapperCache.h" |
13 | | #include "mozilla/dom/TypedArray.h" |
14 | | |
15 | | namespace mozilla { |
16 | | |
17 | | class ErrorResult; |
18 | | |
19 | | namespace dom { |
20 | | |
21 | | class Crypto final : public nsISupports, |
22 | | public nsWrapperCache |
23 | | { |
24 | | protected: |
25 | | virtual ~Crypto(); |
26 | | |
27 | | public: |
28 | | explicit Crypto(nsIGlobalObject* aParent); |
29 | | |
30 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
31 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Crypto) |
32 | | |
33 | | void |
34 | | GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray, |
35 | | JS::MutableHandle<JSObject*> aRetval, |
36 | | ErrorResult& aRv); |
37 | | |
38 | | SubtleCrypto* |
39 | | Subtle(); |
40 | | |
41 | | nsIGlobalObject* |
42 | | GetParentObject() const |
43 | 0 | { |
44 | 0 | return mParent; |
45 | 0 | } |
46 | | |
47 | | virtual JSObject* |
48 | | WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
49 | | |
50 | | private: |
51 | | nsCOMPtr<nsIGlobalObject> mParent; |
52 | | RefPtr<SubtleCrypto> mSubtle; |
53 | | }; |
54 | | |
55 | | } // namespace dom |
56 | | } // namespace mozilla |
57 | | |
58 | | #endif // mozilla_dom_Crypto_h |