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

Unified Diff: Source/bindings/core/v8/custom/V8HTMLMediaElementCustom.cpp

Issue 545933002: Implement HTMLMediaElement::srcObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed sofs easy comments. Created 6 years, 3 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/bindings/core/v8/custom/V8HTMLMediaElementCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8HTMLMediaElementCustom.cpp b/Source/bindings/core/v8/custom/V8HTMLMediaElementCustom.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..85c2a27f5ceac5cc64e625516e3f1ed1af27f804
--- /dev/null
+++ b/Source/bindings/core/v8/custom/V8HTMLMediaElementCustom.cpp
@@ -0,0 +1,35 @@
+// Copyright 2014 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 "bindings/core/v8/V8HTMLMediaElement.h"
+
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "core/html/MediaProvider.h"
+
+namespace blink {
+
+static v8::Handle<v8::Value> toV8Object(MediaProvider* provider, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (provider && provider->eventTarget())
+ return toV8(provider->eventTarget(), creationContext, isolate);
+
+ return v8Undefined();
+}
+
+void blink::V8HTMLMediaElement::srcObjectAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ HTMLMediaElement* impl = V8HTMLMediaElement::toImpl(info.Holder());
+ v8SetReturnValue(info, toV8Object(impl->srcObject(), info.Holder(), info.GetIsolate()));
+}
+
+void blink::V8HTMLMediaElement::srcObjectAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
+{
+ HTMLMediaElement* impl = V8HTMLMediaElement::toImpl(info.Holder());
+ ScriptValue scriptValue(ScriptState::current(info.GetIsolate()), value);
haraken 2014/09/20 08:52:20 I'm sorry for the back & forth, but I begin to thi
perkj_chrome 2014/09/24 11:39:38 But that would require this to include bindings/mo
+ impl->setSrcObject(MediaProvider::convert(scriptValue));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698