| 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 20 matching lines...) Expand all Loading... |
| 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/v8/Dictionary.h" | 36 #include "bindings/v8/Dictionary.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/dom/ExceptionCode.h" | 38 #include "core/dom/ExceptionCode.h" |
| 39 #include "core/dom/SpaceSplitString.h" | 39 #include "core/dom/SpaceSplitString.h" |
| 40 #include "core/platform/mediastream/MediaStreamCenter.h" | 40 #include "core/platform/mediastream/MediaStreamCenter.h" |
| 41 #include "core/platform/mediastream/MediaStreamDescriptor.h" |
| 41 #include "modules/mediastream/MediaConstraintsImpl.h" | 42 #include "modules/mediastream/MediaConstraintsImpl.h" |
| 42 #include "modules/mediastream/MediaStream.h" | 43 #include "modules/mediastream/MediaStream.h" |
| 43 #include "modules/mediastream/UserMediaController.h" | 44 #include "modules/mediastream/UserMediaController.h" |
| 44 #include "public/platform/WebMediaStream.h" | |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 static PassRefPtr<MediaConstraintsImpl> parseOptions(const Dictionary& options,
const String& mediaType, ExceptionCode& ec) | 48 static PassRefPtr<MediaConstraintsImpl> parseOptions(const Dictionary& options,
const String& mediaType, ExceptionCode& ec) |
| 49 { | 49 { |
| 50 RefPtr<MediaConstraintsImpl> constraints; | 50 RefPtr<MediaConstraintsImpl> constraints; |
| 51 | 51 |
| 52 Dictionary constraintsDictionary; | 52 Dictionary constraintsDictionary; |
| 53 bool ok = options.get(mediaType, constraintsDictionary); | 53 bool ok = options.get(mediaType, constraintsDictionary); |
| 54 if (ok && !constraintsDictionary.isUndefinedOrNull()) | 54 if (ok && !constraintsDictionary.isUndefinedOrNull()) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 { | 126 { |
| 127 MediaStreamCenter::instance().queryMediaStreamSources(this); | 127 MediaStreamCenter::instance().queryMediaStreamSources(this); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSour
ces, const MediaStreamSourceVector& videoSources) | 130 void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSour
ces, const MediaStreamSourceVector& videoSources) |
| 131 { | 131 { |
| 132 if (m_controller) | 132 if (m_controller) |
| 133 m_controller->requestUserMedia(this, audioSources, videoSources); | 133 m_controller->requestUserMedia(this, audioSources, videoSources); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void UserMediaRequest::succeed(WebKit::WebMediaStream webStream) | 136 void UserMediaRequest::succeed(PassRefPtr<MediaStreamDescriptor> streamDescripto
r) |
| 137 { | 137 { |
| 138 if (!m_scriptExecutionContext) | 138 if (!m_scriptExecutionContext) |
| 139 return; | 139 return; |
| 140 | 140 |
| 141 RefPtr<MediaStream> stream = MediaStream::create(m_scriptExecutionContext, w
ebStream); | 141 RefPtr<MediaStream> stream = MediaStream::create(m_scriptExecutionContext, s
treamDescriptor); |
| 142 m_successCallback->handleEvent(stream.get()); | 142 m_successCallback->handleEvent(stream.get()); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void UserMediaRequest::fail(const String& description) | 145 void UserMediaRequest::fail(const String& description) |
| 146 { | 146 { |
| 147 if (!m_scriptExecutionContext) | 147 if (!m_scriptExecutionContext) |
| 148 return; | 148 return; |
| 149 | 149 |
| 150 if (m_errorCallback) { | 150 if (m_errorCallback) { |
| 151 RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(
ASCIILiteral("PERMISSION_DENIED"), description, String()); | 151 RefPtr<NavigatorUserMediaError> error = NavigatorUserMediaError::create(
ASCIILiteral("PERMISSION_DENIED"), description, String()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 171 | 171 |
| 172 if (m_controller) { | 172 if (m_controller) { |
| 173 m_controller->cancelUserMediaRequest(this); | 173 m_controller->cancelUserMediaRequest(this); |
| 174 m_controller = 0; | 174 m_controller = 0; |
| 175 } | 175 } |
| 176 | 176 |
| 177 ContextDestructionObserver::contextDestroyed(); | 177 ContextDestructionObserver::contextDestroyed(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace WebCore | 180 } // namespace WebCore |
| OLD | NEW |