Chromium Code Reviews| Index: Source/modules/mediastream/MediaStreamTrackSourcesRequest.cpp |
| diff --git a/Source/modules/mediastream/SourceInfo.h b/Source/modules/mediastream/MediaStreamTrackSourcesRequest.cpp |
| similarity index 54% |
| copy from Source/modules/mediastream/SourceInfo.h |
| copy to Source/modules/mediastream/MediaStreamTrackSourcesRequest.cpp |
| index 94bce294a41f8335cdf683c392388a576fcb6af8..3ad48781708f5f5901fd20532fdbc5dbb4c609d1 100644 |
| --- a/Source/modules/mediastream/SourceInfo.h |
| +++ b/Source/modules/mediastream/MediaStreamTrackSourcesRequest.cpp |
| @@ -23,34 +23,43 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef SourceInfo_h |
| -#define SourceInfo_h |
| +#include "config.h" |
| -#include "bindings/v8/ScriptWrappable.h" |
| +#include "modules/mediastream/MediaStreamTrackSourcesRequest.h" |
| + |
| +#include "core/dom/ScriptExecutionContext.h" |
| +#include "modules/mediastream/MediaStreamTrackSourcesCallback.h" |
| #include "public/platform/WebSourceInfo.h" |
| -#include "wtf/PassRefPtr.h" |
| -#include "wtf/RefCounted.h" |
| -#include "wtf/Vector.h" |
| +#include "weborigin/SecurityOrigin.h" |
| namespace WebCore { |
| -class SourceInfo : public RefCounted<SourceInfo>, public ScriptWrappable { |
| -public: |
| - static PassRefPtr<SourceInfo> create(const WebKit::WebSourceInfo&); |
| +PassRefPtr<MediaStreamTrackSourcesRequest> MediaStreamTrackSourcesRequest::create(ScriptExecutionContext* context, PassRefPtr<MediaStreamTrackSourcesCallback> callback) |
| +{ |
| + return adoptRef(new MediaStreamTrackSourcesRequest(context, callback)); |
| +} |
| - String id() const; |
| - String kind() const; |
| - String label() const; |
| - String facing() const; |
| +MediaStreamTrackSourcesRequest::MediaStreamTrackSourcesRequest(ScriptExecutionContext* context, PassRefPtr<MediaStreamTrackSourcesCallback> callback) |
| + : m_callback(callback) |
| +{ |
| + m_url = context->securityOrigin()->toString(); |
|
abarth-chromium
2013/06/14 14:17:48
I still don't understand why this field is called
|
| +} |
| -private: |
| - explicit SourceInfo(const WebKit::WebSourceInfo&); |
| +MediaStreamTrackSourcesRequest::~MediaStreamTrackSourcesRequest() |
| +{ |
| +} |
| - WebKit::WebSourceInfo m_webSourceInfo; |
| -}; |
| +void MediaStreamTrackSourcesRequest::requestSucceeded(const WebKit::WebVector<WebKit::WebSourceInfo>& webSourceInfos) |
| +{ |
| + if (m_callback) { |
| + SourceInfoVector sourceInfos; |
| + for (size_t i = 0; i < webSourceInfos.size(); ++i) |
| + sourceInfos.append(SourceInfo::create(webSourceInfos[i])); |
| -typedef Vector<RefPtr<SourceInfo> > SourceInfoVector; |
| + m_callback->handleEvent(sourceInfos); |
| + } |
| -} // namespace WebCore |
| + m_callback.clear(); |
| +} |
| -#endif // SourceInfo_h |
| +} // namespace WebCore |