OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 | 33 |
34 #include "modules/mediastream/UserMediaRequest.h" | 34 #include "modules/mediastream/UserMediaRequest.h" |
35 | 35 |
36 #include "bindings/core/v8/Dictionary.h" | 36 #include "bindings/core/v8/Dictionary.h" |
| 37 #include "bindings/core/v8/DictionaryHelper.h" |
37 #include "bindings/core/v8/ExceptionMessages.h" | 38 #include "bindings/core/v8/ExceptionMessages.h" |
38 #include "bindings/core/v8/ExceptionState.h" | 39 #include "bindings/core/v8/ExceptionState.h" |
39 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 41 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/SpaceSplitString.h" | 42 #include "core/dom/SpaceSplitString.h" |
42 #include "modules/mediastream/MediaConstraintsImpl.h" | 43 #include "modules/mediastream/MediaConstraintsImpl.h" |
43 #include "modules/mediastream/MediaStream.h" | 44 #include "modules/mediastream/MediaStream.h" |
44 #include "modules/mediastream/UserMediaController.h" | 45 #include "modules/mediastream/UserMediaController.h" |
45 #include "platform/mediastream/MediaStreamCenter.h" | 46 #include "platform/mediastream/MediaStreamCenter.h" |
46 #include "platform/mediastream/MediaStreamDescriptor.h" | 47 #include "platform/mediastream/MediaStreamDescriptor.h" |
47 | 48 |
48 namespace WebCore { | 49 namespace WebCore { |
49 | 50 |
50 static blink::WebMediaConstraints parseOptions(const Dictionary& options, const
String& mediaType, ExceptionState& exceptionState) | 51 static blink::WebMediaConstraints parseOptions(const Dictionary& options, const
String& mediaType, ExceptionState& exceptionState) |
51 { | 52 { |
52 blink::WebMediaConstraints constraints; | 53 blink::WebMediaConstraints constraints; |
53 | 54 |
54 Dictionary constraintsDictionary; | 55 Dictionary constraintsDictionary; |
55 bool ok = options.get(mediaType, constraintsDictionary); | 56 bool ok = options.get(mediaType, constraintsDictionary); |
56 if (ok && !constraintsDictionary.isUndefinedOrNull()) | 57 if (ok && !constraintsDictionary.isUndefinedOrNull()) |
57 constraints = MediaConstraintsImpl::create(constraintsDictionary, except
ionState); | 58 constraints = MediaConstraintsImpl::create(constraintsDictionary, except
ionState); |
58 else { | 59 else { |
59 bool mediaRequested = false; | 60 bool mediaRequested = false; |
60 options.get(mediaType, mediaRequested); | 61 DictionaryHelper::get(options, mediaType, mediaRequested); |
61 if (mediaRequested) | 62 if (mediaRequested) |
62 constraints = MediaConstraintsImpl::create(); | 63 constraints = MediaConstraintsImpl::create(); |
63 } | 64 } |
64 | 65 |
65 return constraints; | 66 return constraints; |
66 } | 67 } |
67 | 68 |
68 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC
ontroller* controller, const Dictionary& options, PassOwnPtr<NavigatorUserMediaS
uccessCallback> successCallback, PassOwnPtr<NavigatorUserMediaErrorCallback> err
orCallback, ExceptionState& exceptionState) | 69 UserMediaRequest* UserMediaRequest::create(ExecutionContext* context, UserMediaC
ontroller* controller, const Dictionary& options, PassOwnPtr<NavigatorUserMediaS
uccessCallback> successCallback, PassOwnPtr<NavigatorUserMediaErrorCallback> err
orCallback, ExceptionState& exceptionState) |
69 { | 70 { |
70 blink::WebMediaConstraints audio = parseOptions(options, "audio", exceptionS
tate); | 71 blink::WebMediaConstraints audio = parseOptions(options, "audio", exceptionS
tate); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 { | 180 { |
180 if (m_controller) { | 181 if (m_controller) { |
181 m_controller->cancelUserMediaRequest(this); | 182 m_controller->cancelUserMediaRequest(this); |
182 m_controller = 0; | 183 m_controller = 0; |
183 } | 184 } |
184 | 185 |
185 ContextLifecycleObserver::contextDestroyed(); | 186 ContextLifecycleObserver::contextDestroyed(); |
186 } | 187 } |
187 | 188 |
188 } // namespace WebCore | 189 } // namespace WebCore |
OLD | NEW |