michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "base/basictypes.h" michael@0: #include "GetUserMediaRequest.h" michael@0: #include "mozilla/dom/MediaStreamBinding.h" michael@0: #include "mozilla/dom/GetUserMediaRequestBinding.h" michael@0: #include "nsIScriptGlobalObject.h" michael@0: #include "nsPIDOMWindow.h" michael@0: #include "nsCxPusher.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: GetUserMediaRequest::GetUserMediaRequest( michael@0: nsPIDOMWindow* aInnerWindow, michael@0: const nsAString& aCallID, michael@0: const MediaStreamConstraints& aConstraints, michael@0: bool aIsSecure) michael@0: : mInnerWindowID(aInnerWindow->WindowID()) michael@0: , mOuterWindowID(aInnerWindow->GetOuterWindow()->WindowID()) michael@0: , mCallID(aCallID) michael@0: , mConstraints(new MediaStreamConstraints(aConstraints)) michael@0: , mIsSecure(aIsSecure) michael@0: { michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(GetUserMediaRequest) michael@0: NS_IMPL_CYCLE_COLLECTING_ADDREF(GetUserMediaRequest) michael@0: NS_IMPL_CYCLE_COLLECTING_RELEASE(GetUserMediaRequest) michael@0: NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GetUserMediaRequest) michael@0: NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY michael@0: NS_INTERFACE_MAP_ENTRY(nsISupports) michael@0: NS_INTERFACE_MAP_END michael@0: michael@0: JSObject* michael@0: GetUserMediaRequest::WrapObject(JSContext* aCx) michael@0: { michael@0: return GetUserMediaRequestBinding::Wrap(aCx, this); michael@0: } michael@0: michael@0: nsISupports* GetUserMediaRequest::GetParentObject() michael@0: { michael@0: return nullptr; michael@0: } michael@0: michael@0: void GetUserMediaRequest::GetCallID(nsString& retval) michael@0: { michael@0: retval = mCallID; michael@0: } michael@0: michael@0: uint64_t GetUserMediaRequest::WindowID() michael@0: { michael@0: return mOuterWindowID; michael@0: } michael@0: michael@0: uint64_t GetUserMediaRequest::InnerWindowID() michael@0: { michael@0: return mInnerWindowID; michael@0: } michael@0: michael@0: bool GetUserMediaRequest::IsSecure() michael@0: { michael@0: return mIsSecure; michael@0: } michael@0: michael@0: void michael@0: GetUserMediaRequest::GetConstraints(MediaStreamConstraints &result) michael@0: { michael@0: result = *mConstraints; michael@0: } michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla