Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef RTCIDENTITYPROVIDER_H_
7 : #define RTCIDENTITYPROVIDER_H_
8 :
9 : #include "mozilla/RefPtr.h"
10 : #include "nsCOMPtr.h"
11 : #include "nsISupportsImpl.h"
12 : #include "nsIGlobalObject.h"
13 : #include "nsWrapperCache.h"
14 : #include "mozilla/Attributes.h"
15 : #include "mozilla/dom/Promise.h"
16 : #include "mozilla/dom/BindingDeclarations.h"
17 : #include "mozilla/dom/RTCIdentityProviderBinding.h"
18 :
19 : namespace mozilla {
20 : namespace dom {
21 :
22 : struct RTCIdentityProvider;
23 :
24 : class RTCIdentityProviderRegistrar final : public nsISupports,
25 : public nsWrapperCache
26 : {
27 : public:
28 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(RTCIdentityProviderRegistrar)
30 :
31 : explicit RTCIdentityProviderRegistrar(nsIGlobalObject* aGlobal);
32 :
33 : // As required
34 : nsIGlobalObject* GetParentObject() const;
35 : virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
36 :
37 : // setter and checker
38 : void Register(const RTCIdentityProvider& aIdp);
39 : bool HasIdp() const;
40 :
41 : already_AddRefed<Promise>
42 : GenerateAssertion(const nsAString& aContents, const nsAString& aOrigin,
43 : const Optional<nsAString>& aUsernameHint, ErrorResult& aRv);
44 : already_AddRefed<Promise>
45 : ValidateAssertion(const nsAString& assertion, const nsAString& origin,
46 : ErrorResult& aRv);
47 :
48 : private:
49 : ~RTCIdentityProviderRegistrar();
50 :
51 : nsCOMPtr<nsIGlobalObject> mGlobal;
52 : RefPtr<GenerateAssertionCallback> mGenerateAssertionCallback;
53 : RefPtr<ValidateAssertionCallback> mValidateAssertionCallback;
54 : };
55 :
56 : } // namespace dom
57 : } // namespace mozilla
58 :
59 : #endif /* RTCIDENTITYPROVIDER_H_ */
|