Index: Source/modules/mediastream/MediaDevicesRequest.cpp |
diff --git a/Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp b/Source/modules/mediastream/MediaDevicesRequest.cpp |
similarity index 49% |
copy from Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp |
copy to Source/modules/mediastream/MediaDevicesRequest.cpp |
index 57e55a6dfc5b24b5eb19717233c92218f39301e0..0c90f7d6227e9485678b02a4862cc748d18c003a 100644 |
--- a/Source/modules/mediastream/RTCDTMFToneChangeEvent.cpp |
+++ b/Source/modules/mediastream/MediaDevicesRequest.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2013 Google Inc. All rights reserved. |
+ * Copyright (C) 2014 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -24,60 +24,60 @@ |
*/ |
#include "config.h" |
-#include "modules/mediastream/RTCDTMFToneChangeEvent.h" |
-#include "core/events/ThreadLocalEventNames.h" |
+#include "modules/mediastream/MediaDevicesRequest.h" |
+ |
+#include "bindings/v8/ExceptionState.h" |
+#include "core/dom/Document.h" |
+#include "modules/mediastream/UserMediaController.h" |
namespace WebCore { |
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create() |
+PassRefPtr<MediaDevicesRequest> MediaDevicesRequest::create(ExecutionContext* context, UserMediaController* controller, PassOwnPtr<MediaDeviceInfoCallback> callback, ExceptionState& exceptionState) |
{ |
- return adoptRef(new RTCDTMFToneChangeEvent); |
+ RefPtr<MediaDevicesRequest> request = adoptRef(new MediaDevicesRequest(context, controller, callback)); |
+ request->suspendIfNeeded(); |
+ return request.release(); |
} |
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create(const String& tone) |
+MediaDevicesRequest::MediaDevicesRequest(ExecutionContext* context, UserMediaController* controller, PassOwnPtr<MediaDeviceInfoCallback> callback) |
+ : ActiveDOMObject(context) |
+ , m_controller(controller) |
+ , m_callback(callback) |
{ |
- return adoptRef(new RTCDTMFToneChangeEvent(tone)); |
} |
-PassRefPtr<RTCDTMFToneChangeEvent> RTCDTMFToneChangeEvent::create(const AtomicString& type, const RTCDTMFToneChangeEventInit& initializer) |
+MediaDevicesRequest::~MediaDevicesRequest() |
{ |
- ASSERT(type == EventTypeNames::tonechange); |
- return adoptRef(new RTCDTMFToneChangeEvent(initializer)); |
} |
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent() |
+Document* MediaDevicesRequest::ownerDocument() |
{ |
- ScriptWrappable::init(this); |
-} |
+ if (ExecutionContext* context = executionContext()) { |
+ return toDocument(context); |
+ } |
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent(const String& tone) |
- : Event(EventTypeNames::tonechange, false, false) |
- , m_tone(tone) |
-{ |
- ScriptWrappable::init(this); |
+ return 0; |
} |
-RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent(const RTCDTMFToneChangeEventInit& initializer) |
- : Event(EventTypeNames::tonechange, initializer) |
- , m_tone(initializer.tone) |
+void MediaDevicesRequest::start() |
{ |
- ScriptWrappable::init(this); |
+ if (m_controller) |
+ m_controller->requestMediaDevices(this); |
} |
-RTCDTMFToneChangeEvent::~RTCDTMFToneChangeEvent() |
+void MediaDevicesRequest::succeed(const MediaDeviceInfoVector& mediaDevices) |
{ |
-} |
+ if (!executionContext() || !m_callback) |
+ return; |
-const String& RTCDTMFToneChangeEvent::tone() const |
-{ |
- return m_tone; |
+ m_callback->handleEvent(mediaDevices); |
} |
-const AtomicString& RTCDTMFToneChangeEvent::interfaceName() const |
+void MediaDevicesRequest::stop() |
{ |
- return EventNames::RTCDTMFToneChangeEvent; |
+ m_callback.clear(); |
+ m_controller = 0; |
} |
} // namespace WebCore |
- |