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

Unified Diff: Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp

Issue 1182243005: Add sinkId/setSinkId() extension to HTMLMediaElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update expected value for public interface/properties tests Created 5 years, 6 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: Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp
diff --git a/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp b/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5e7fd020a86f6056034fe76be2c43acdd12b5c62
--- /dev/null
+++ b/Source/modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.cpp
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/audio_output_devices/HTMLMediaElementAudioOutputDevice.h"
+
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "core/dom/ExecutionContext.h"
+#include "platform/Logging.h"
+
+namespace blink {
+
+HTMLMediaElementAudioOutputDevice::HTMLMediaElementAudioOutputDevice()
+ : m_sinkId("")
+{
+}
+
+String HTMLMediaElementAudioOutputDevice::sinkId(HTMLMediaElement& element)
+{
+ WTF_LOG(Media, __FUNCTION__);
Peter Beverloo 2015/06/18 14:21:20 Did you mean to land these WTF_LOG statements?
+ HTMLMediaElementAudioOutputDevice& aodElement = HTMLMediaElementAudioOutputDevice::from(element);
+ return aodElement.m_sinkId;
+}
+
+ScriptPromise HTMLMediaElementAudioOutputDevice::setSinkId(ScriptState* scriptState, HTMLMediaElement& element, const String& newSinkId)
+{
+ WTF_LOG(Media, __FUNCTION__);
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError, "Operation not supported"));
+}
+
+const char* HTMLMediaElementAudioOutputDevice::supplementName()
+{
+ return "HTMLMediaElementAudioOutputDevice";
+}
+
+HTMLMediaElementAudioOutputDevice& HTMLMediaElementAudioOutputDevice::from(HTMLMediaElement& element)
+{
+ HTMLMediaElementAudioOutputDevice* supplement = static_cast<HTMLMediaElementAudioOutputDevice*>(WillBeHeapSupplement<HTMLMediaElement>::from(element, supplementName()));
+ if (!supplement) {
+ supplement = new HTMLMediaElementAudioOutputDevice();
+ provideTo(element, supplementName(), adoptPtrWillBeNoop(supplement));
+ }
+ return *supplement;
+}
+
+DEFINE_TRACE(HTMLMediaElementAudioOutputDevice)
+{
+ WillBeHeapSupplement<HTMLMediaElement>::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698