Bumping manifests a=b2g-bump
[gecko.git] / dom / tv / TVTuner.h
blob28a675a0319c82751ce6f80654a8321d098566df
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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_TVTuner_h
8 #define mozilla_dom_TVTuner_h
10 #include "mozilla/DOMEventTargetHelper.h"
11 // Include TVTunerBinding.h since enum TVSourceType can't be forward declared.
12 #include "mozilla/dom/TVTunerBinding.h"
14 class nsITVService;
15 class nsITVTunerData;
17 namespace mozilla {
19 class DOMMediaStream;
21 namespace dom {
23 class Promise;
24 class TVSource;
26 class TVTuner MOZ_FINAL : public DOMEventTargetHelper
28 public:
29 NS_DECL_ISUPPORTS_INHERITED
30 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TVTuner, DOMEventTargetHelper)
32 static already_AddRefed<TVTuner> Create(nsPIDOMWindow* aWindow,
33 nsITVTunerData* aData);
35 // WebIDL (internal functions)
37 virtual JSObject* WrapObject(JSContext *aCx) MOZ_OVERRIDE;
39 nsresult SetCurrentSource(TVSourceType aSourceType);
41 nsresult DispatchTVEvent(nsIDOMEvent* aEvent);
43 // WebIDL (public APIs)
45 void GetSupportedSourceTypes(nsTArray<TVSourceType>& aSourceTypes,
46 ErrorResult& aRv) const;
48 already_AddRefed<Promise> GetSources(ErrorResult& aRv);
50 already_AddRefed<Promise> SetCurrentSource(const TVSourceType aSourceType,
51 ErrorResult& aRv);
53 void GetId(nsAString& aId) const;
55 already_AddRefed<TVSource> GetCurrentSource() const;
57 already_AddRefed<DOMMediaStream> GetStream() const;
59 IMPL_EVENT_HANDLER(currentsourcechanged);
61 private:
62 explicit TVTuner(nsPIDOMWindow* aWindow);
64 ~TVTuner();
66 bool Init(nsITVTunerData* aData);
68 nsresult InitMediaStream();
70 nsresult DispatchCurrentSourceChangedEvent(TVSource* aSource);
72 nsCOMPtr<nsITVService> mTVService;
73 nsRefPtr<DOMMediaStream> mStream;
74 nsRefPtr<TVSource> mCurrentSource;
75 nsTArray<nsRefPtr<TVSource>> mSources;
76 nsString mId;
77 nsTArray<TVSourceType> mSupportedSourceTypes;
80 } // namespace dom
81 } // namespace mozilla
83 #endif // mozilla_dom_TVTuner_h