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

Unified Diff: Source/core/html/shadow/MediaControls.cpp

Issue 456323002: [WIP] Re-implement MediaControls in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/core/html/shadow/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 4b5c0f0974c34dd72db49b3ba8c386cc633339fc..acfbcc3d2f551cb8b54dba5824c9351bad957ee5 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -28,6 +28,8 @@
#include "core/html/shadow/MediaControls.h"
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "bindings/core/v8/V8MediaControls.h"
+#include "bindings/core/v8/PrivateScriptRunner.h"
#include "core/events/MouseEvent.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLMediaElement.h"
@@ -65,16 +67,23 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
, m_isMouseOverControls(false)
, m_isPausedForScrubbing(false)
{
+ ScriptWrappable::init(this);
+ v8::Handle<v8::Value> classObject = PrivateScriptRunner::installClassIfNeeded(document().frame(), "MediaControls");
+ RELEASE_ASSERT(!classObject.IsEmpty());
}
PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& mediaElement)
{
RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaControls(mediaElement));
- if (controls->initializeControls())
- return controls.release();
+ if (!controls->initializeControls())
+ return nullptr;
- return nullptr;
+ PassRefPtrWillBeRawPtr<HTMLMediaElement> media(&mediaElement);
+ if (!V8MediaControls::createdCallbackMethodImplementedInPrivateScript(controls->document().frame(), controls.get(), media))
+ return nullptr;
+
+ return controls.release();
}
bool MediaControls::initializeControls()
@@ -183,12 +192,14 @@ void MediaControls::reset()
refreshClosedCaptionsButtonVisibility();
- if (mediaElement().hasVideo() && fullscreenIsSupported(document()))
+ if (mediaElement().hasVideo() && fullscreenIsSupported())
m_fullScreenButton->show();
else
m_fullScreenButton->hide();
makeOpaque();
+
+ V8MediaControls::resetMethodImplementedInPrivateScript(document().frame(), this);
}
void MediaControls::show()
@@ -362,6 +373,8 @@ void MediaControls::exitedFullscreen()
void MediaControls::defaultEventHandler(Event* event)
{
+ return;
+
HTMLDivElement::defaultEventHandler(event);
if (event->type() == EventTypeNames::mouseover) {
@@ -468,6 +481,11 @@ void MediaControls::updateTextTrackDisplay()
m_textDisplayContainer->updateDisplay();
}
+bool MediaControls::fullscreenIsSupported()
+{
+ return blink::fullscreenIsSupported(document());
+}
+
void MediaControls::trace(Visitor* visitor)
{
visitor->trace(m_mediaElement);

Powered by Google App Engine
This is Rietveld 408576698