| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/ActiveDOMObject.h" | 34 #include "core/dom/ActiveDOMObject.h" |
| 35 #include "core/dom/ExceptionBase.h" | 35 #include "core/dom/ExceptionBase.h" |
| 36 #include "core/platform/mediastream/MediaStreamSource.h" | 36 #include "core/platform/mediastream/MediaStreamSource.h" |
| 37 #include "core/platform/mediastream/MediaStreamSourcesQueryClient.h" | 37 #include "core/platform/mediastream/MediaStreamSourcesQueryClient.h" |
| 38 #include "modules/mediastream/NavigatorUserMediaErrorCallback.h" | 38 #include "modules/mediastream/NavigatorUserMediaErrorCallback.h" |
| 39 #include "modules/mediastream/NavigatorUserMediaSuccessCallback.h" | 39 #include "modules/mediastream/NavigatorUserMediaSuccessCallback.h" |
| 40 #include "wtf/PassRefPtr.h" | 40 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/RefCounted.h" | 41 #include "wtf/RefCounted.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 | 43 |
| 44 namespace WebKit { | |
| 45 class WebMediaStream; | |
| 46 } | |
| 47 | |
| 48 namespace WebCore { | 44 namespace WebCore { |
| 49 | 45 |
| 50 class Dictionary; | 46 class Dictionary; |
| 51 class Document; | 47 class Document; |
| 52 class MediaConstraints; | 48 class MediaConstraints; |
| 53 class MediaConstraintsImpl; | 49 class MediaConstraintsImpl; |
| 50 class MediaStreamDescriptor; |
| 54 class UserMediaController; | 51 class UserMediaController; |
| 55 | 52 |
| 56 class UserMediaRequest : public MediaStreamSourcesQueryClient, public ContextDes
tructionObserver { | 53 class UserMediaRequest : public MediaStreamSourcesQueryClient, public ContextDes
tructionObserver { |
| 57 public: | 54 public: |
| 58 static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMedi
aController*, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCal
lback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&); | 55 static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMedi
aController*, const Dictionary& options, PassRefPtr<NavigatorUserMediaSuccessCal
lback>, PassRefPtr<NavigatorUserMediaErrorCallback>, ExceptionCode&); |
| 59 ~UserMediaRequest(); | 56 ~UserMediaRequest(); |
| 60 | 57 |
| 61 NavigatorUserMediaSuccessCallback* successCallback() const { return m_succes
sCallback.get(); } | 58 NavigatorUserMediaSuccessCallback* successCallback() const { return m_succes
sCallback.get(); } |
| 62 NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallb
ack.get(); } | 59 NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallb
ack.get(); } |
| 63 Document* ownerDocument(); | 60 Document* ownerDocument(); |
| 64 | 61 |
| 65 void start(); | 62 void start(); |
| 66 | 63 |
| 67 void succeed(WebKit::WebMediaStream); | 64 void succeed(PassRefPtr<MediaStreamDescriptor>); |
| 68 void fail(const String& description); | 65 void fail(const String& description); |
| 69 void failConstraint(const String& constraintName, const String& description)
; | 66 void failConstraint(const String& constraintName, const String& description)
; |
| 70 | 67 |
| 71 MediaConstraints* audioConstraints() const; | 68 MediaConstraints* audioConstraints() const; |
| 72 MediaConstraints* videoConstraints() const; | 69 MediaConstraints* videoConstraints() const; |
| 73 | 70 |
| 74 // MediaStreamSourcesQueryClient | 71 // MediaStreamSourcesQueryClient |
| 75 virtual bool audio() const; | 72 virtual bool audio() const; |
| 76 virtual bool video() const; | 73 virtual bool video() const; |
| 77 virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, c
onst MediaStreamSourceVector& videoSources); | 74 virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, c
onst MediaStreamSourceVector& videoSources); |
| 78 | 75 |
| 79 // ContextDestructionObserver | 76 // ContextDestructionObserver |
| 80 virtual void contextDestroyed(); | 77 virtual void contextDestroyed(); |
| 81 | 78 |
| 82 private: | 79 private: |
| 83 UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr<M
ediaConstraintsImpl> audio, PassRefPtr<MediaConstraintsImpl> video, PassRefPtr<N
avigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>); | 80 UserMediaRequest(ScriptExecutionContext*, UserMediaController*, PassRefPtr<M
ediaConstraintsImpl> audio, PassRefPtr<MediaConstraintsImpl> video, PassRefPtr<N
avigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>); |
| 84 | 81 |
| 85 RefPtr<MediaConstraintsImpl> m_audio; | 82 RefPtr<MediaConstraintsImpl> m_audio; |
| 86 RefPtr<MediaConstraintsImpl> m_video; | 83 RefPtr<MediaConstraintsImpl> m_video; |
| 87 | 84 |
| 88 UserMediaController* m_controller; | 85 UserMediaController* m_controller; |
| 89 | 86 |
| 90 RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback; | 87 RefPtr<NavigatorUserMediaSuccessCallback> m_successCallback; |
| 91 RefPtr<NavigatorUserMediaErrorCallback> m_errorCallback; | 88 RefPtr<NavigatorUserMediaErrorCallback> m_errorCallback; |
| 92 }; | 89 }; |
| 93 | 90 |
| 94 } // namespace WebCore | 91 } // namespace WebCore |
| 95 | 92 |
| 96 #endif // UserMediaRequest_h | 93 #endif // UserMediaRequest_h |
| OLD | NEW |