Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp

Issue 1571303003: Add JSON serializer to MediaDeviceInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp b/third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp
index e2ce78d28eea5614018bcd2d14d72c6c4d52b0e7..e13f974ff2cd4b75f0b0d1a6811193b086ca49ed 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaDeviceInfo.cpp
@@ -26,6 +26,9 @@
#include "config.h"
#include "modules/mediastream/MediaDeviceInfo.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "wtf/text/WTFString.h"
namespace blink {
@@ -71,4 +74,14 @@ String MediaDeviceInfo::groupId() const
return m_webMediaDeviceInfo.groupId();
}
+ScriptValue MediaDeviceInfo::toJSONForBinding(ScriptState* scriptState)
+{
+ V8ObjectBuilder result(scriptState);
+ result.addString("deviceId", deviceId());
+ result.addString("kind", kind());
+ result.addString("label", label());
+ result.addString("groupId", groupId());
+ return result.scriptValue();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698