tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SpeechGrammarList.h (1978B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      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/. */
      6 
      7 #ifndef mozilla_dom_SpeechGrammarList_h
      8 #define mozilla_dom_SpeechGrammarList_h
      9 
     10 #include "nsCOMPtr.h"
     11 #include "nsCycleCollectionParticipant.h"
     12 #include "nsTArray.h"
     13 #include "nsWrapperCache.h"
     14 
     15 struct JSContext;
     16 
     17 namespace mozilla {
     18 
     19 class ErrorResult;
     20 
     21 namespace dom {
     22 
     23 class GlobalObject;
     24 class SpeechGrammar;
     25 template <typename>
     26 class Optional;
     27 
     28 class SpeechGrammarList final : public nsISupports, public nsWrapperCache {
     29 public:
     30  explicit SpeechGrammarList(nsISupports* aParent);
     31 
     32  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     33  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(SpeechGrammarList)
     34 
     35  static already_AddRefed<SpeechGrammarList> Constructor(
     36      const GlobalObject& aGlobal);
     37 
     38  static already_AddRefed<SpeechGrammarList> WebkitSpeechGrammarList(
     39      const GlobalObject& aGlobal, ErrorResult& aRv) {
     40    return Constructor(aGlobal);
     41  }
     42 
     43  nsISupports* GetParentObject() const;
     44 
     45  JSObject* WrapObject(JSContext* aCx,
     46                       JS::Handle<JSObject*> aGivenProto) override;
     47 
     48  uint32_t Length() const;
     49 
     50  already_AddRefed<SpeechGrammar> Item(uint32_t aIndex, ErrorResult& aRv);
     51 
     52  void AddFromURI(const nsAString& aSrc, const Optional<float>& aWeight,
     53                  ErrorResult& aRv);
     54 
     55  void AddFromString(const nsAString& aString, const Optional<float>& aWeight,
     56                     ErrorResult& aRv);
     57 
     58  already_AddRefed<SpeechGrammar> IndexedGetter(uint32_t aIndex, bool& aPresent,
     59                                                ErrorResult& aRv);
     60 
     61 private:
     62  ~SpeechGrammarList();
     63 
     64  nsCOMPtr<nsISupports> mParent;
     65 
     66  nsTArray<RefPtr<SpeechGrammar>> mItems;
     67 };
     68 
     69 }  // namespace dom
     70 }  // namespace mozilla
     71 
     72 #endif