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