1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/media/GetUserMediaRequest.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "base/basictypes.h" 1.9 +#include "GetUserMediaRequest.h" 1.10 +#include "mozilla/dom/MediaStreamBinding.h" 1.11 +#include "mozilla/dom/GetUserMediaRequestBinding.h" 1.12 +#include "nsIScriptGlobalObject.h" 1.13 +#include "nsPIDOMWindow.h" 1.14 +#include "nsCxPusher.h" 1.15 + 1.16 +namespace mozilla { 1.17 +namespace dom { 1.18 + 1.19 +GetUserMediaRequest::GetUserMediaRequest( 1.20 + nsPIDOMWindow* aInnerWindow, 1.21 + const nsAString& aCallID, 1.22 + const MediaStreamConstraints& aConstraints, 1.23 + bool aIsSecure) 1.24 + : mInnerWindowID(aInnerWindow->WindowID()) 1.25 + , mOuterWindowID(aInnerWindow->GetOuterWindow()->WindowID()) 1.26 + , mCallID(aCallID) 1.27 + , mConstraints(new MediaStreamConstraints(aConstraints)) 1.28 + , mIsSecure(aIsSecure) 1.29 +{ 1.30 + SetIsDOMBinding(); 1.31 +} 1.32 + 1.33 +NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(GetUserMediaRequest) 1.34 +NS_IMPL_CYCLE_COLLECTING_ADDREF(GetUserMediaRequest) 1.35 +NS_IMPL_CYCLE_COLLECTING_RELEASE(GetUserMediaRequest) 1.36 +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GetUserMediaRequest) 1.37 + NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY 1.38 + NS_INTERFACE_MAP_ENTRY(nsISupports) 1.39 +NS_INTERFACE_MAP_END 1.40 + 1.41 +JSObject* 1.42 +GetUserMediaRequest::WrapObject(JSContext* aCx) 1.43 +{ 1.44 + return GetUserMediaRequestBinding::Wrap(aCx, this); 1.45 +} 1.46 + 1.47 +nsISupports* GetUserMediaRequest::GetParentObject() 1.48 +{ 1.49 + return nullptr; 1.50 +} 1.51 + 1.52 +void GetUserMediaRequest::GetCallID(nsString& retval) 1.53 +{ 1.54 + retval = mCallID; 1.55 +} 1.56 + 1.57 +uint64_t GetUserMediaRequest::WindowID() 1.58 +{ 1.59 + return mOuterWindowID; 1.60 +} 1.61 + 1.62 +uint64_t GetUserMediaRequest::InnerWindowID() 1.63 +{ 1.64 + return mInnerWindowID; 1.65 +} 1.66 + 1.67 +bool GetUserMediaRequest::IsSecure() 1.68 +{ 1.69 + return mIsSecure; 1.70 +} 1.71 + 1.72 +void 1.73 +GetUserMediaRequest::GetConstraints(MediaStreamConstraints &result) 1.74 +{ 1.75 + result = *mConstraints; 1.76 +} 1.77 + 1.78 +} // namespace dom 1.79 +} // namespace mozilla