1/* 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 */ 22 23#include "config.h" 24#include "NavigatorMediaStream.h" 25 26#if ENABLE(MEDIA_STREAM) 27 28#include "Dictionary.h" 29#include "Document.h" 30#include "ExceptionCode.h" 31#include "Frame.h" 32#include "Navigator.h" 33#include "NavigatorUserMediaErrorCallback.h" 34#include "NavigatorUserMediaSuccessCallback.h" 35#include "Page.h" 36#include "UserMediaController.h" 37#include "UserMediaRequest.h" 38 39namespace WebCore { 40 41NavigatorMediaStream::NavigatorMediaStream() 42{ 43} 44 45NavigatorMediaStream::~NavigatorMediaStream() 46{ 47} 48 49void NavigatorMediaStream::webkitGetUserMedia(Navigator* navigator, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCallback> successCallback, PassRefPtr<NavigatorUserMediaErrorCallback> errorCallback, ExceptionCode& ec) 50{ 51 if (!successCallback) 52 return; 53 54 UserMediaController* userMedia = UserMediaController::from(navigator->frame() ? navigator->frame()->page() : 0); 55 if (!userMedia) { 56 ec = NOT_SUPPORTED_ERR; 57 return; 58 } 59 60 RefPtr<UserMediaRequest> request = UserMediaRequest::create(navigator->frame()->document(), userMedia, options, successCallback, errorCallback, ec); 61 if (!request) { 62 ec = NOT_SUPPORTED_ERR; 63 return; 64 } 65 66 request->start(); 67} 68 69} // namespace WebCore 70 71#endif // ENABLE(MEDIA_STREAM) 72