content/media/webspeech/recognition/SpeechRecognitionResult.cpp

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "SpeechRecognitionResult.h"
michael@0 8 #include "mozilla/dom/SpeechRecognitionResultBinding.h"
michael@0 9
michael@0 10 #include "SpeechRecognition.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace dom {
michael@0 14
michael@0 15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechRecognitionResult, mParent)
michael@0 16 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechRecognitionResult)
michael@0 17 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechRecognitionResult)
michael@0 18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechRecognitionResult)
michael@0 19 NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
michael@0 20 NS_INTERFACE_MAP_ENTRY(nsISupports)
michael@0 21 NS_INTERFACE_MAP_END
michael@0 22
michael@0 23 SpeechRecognitionResult::SpeechRecognitionResult(SpeechRecognition* aParent)
michael@0 24 : mParent(aParent)
michael@0 25 {
michael@0 26 SetIsDOMBinding();
michael@0 27 }
michael@0 28
michael@0 29 SpeechRecognitionResult::~SpeechRecognitionResult()
michael@0 30 {
michael@0 31 }
michael@0 32
michael@0 33 JSObject*
michael@0 34 SpeechRecognitionResult::WrapObject(JSContext* aCx)
michael@0 35 {
michael@0 36 return SpeechRecognitionResultBinding::Wrap(aCx, this);
michael@0 37 }
michael@0 38
michael@0 39 nsISupports*
michael@0 40 SpeechRecognitionResult::GetParentObject() const
michael@0 41 {
michael@0 42 return static_cast<DOMEventTargetHelper*>(mParent.get());
michael@0 43 }
michael@0 44
michael@0 45 already_AddRefed<SpeechRecognitionAlternative>
michael@0 46 SpeechRecognitionResult::IndexedGetter(uint32_t aIndex, bool& aPresent)
michael@0 47 {
michael@0 48 if (aIndex >= Length()) {
michael@0 49 aPresent = false;
michael@0 50 return nullptr;
michael@0 51 }
michael@0 52
michael@0 53 aPresent = true;
michael@0 54 return Item(aIndex);
michael@0 55 }
michael@0 56
michael@0 57 uint32_t
michael@0 58 SpeechRecognitionResult::Length() const
michael@0 59 {
michael@0 60 return mItems.Length();
michael@0 61 }
michael@0 62
michael@0 63 already_AddRefed<SpeechRecognitionAlternative>
michael@0 64 SpeechRecognitionResult::Item(uint32_t aIndex)
michael@0 65 {
michael@0 66 nsRefPtr<SpeechRecognitionAlternative> alternative = mItems.ElementAt(aIndex);
michael@0 67 return alternative.forget();
michael@0 68 }
michael@0 69
michael@0 70 bool
michael@0 71 SpeechRecognitionResult::Final() const
michael@0 72 {
michael@0 73 return true; // TODO
michael@0 74 }
michael@0 75 } // namespace dom
michael@0 76 } // namespace mozilla

mercurial