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

Unified Diff: webkit/glue/webview_impl.cc

Issue 159471: Merge 21466 - Allow the browser to send actions back to the render for media ... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 5 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
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 21785)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -52,6 +52,7 @@
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HTMLInputElement.h"
+#include "HTMLMediaElement.h"
#include "HitTestResult.h"
#include "Image.h"
#include "InspectorController.h"
@@ -1796,6 +1797,41 @@
return is_transparent_;
}
+void WebViewImpl::MediaPlayerActionAt(int x,
+ int y,
+ const MediaPlayerAction& action) {
+ HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
+
+ WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode();
+ if (node->hasTagName(WebCore::HTMLNames::videoTag) ||
+ node->hasTagName(WebCore::HTMLNames::audioTag)) {
+ WTF::RefPtr<WebCore::HTMLMediaElement> media_element =
+ static_pointer_cast<WebCore::HTMLMediaElement>(node);
+ if (action.command & MediaPlayerAction::PLAY) {
+ media_element->play();
+ }
+ if (action.command & MediaPlayerAction::PAUSE) {
+ media_element->pause();
+ }
+ if (action.command & MediaPlayerAction::MUTE) {
+ media_element->setMuted(true);
+ }
+ if (action.command & MediaPlayerAction::UNMUTE) {
+ media_element->setMuted(false);
+ }
+ if (action.command & MediaPlayerAction::LOOP) {
+ media_element->setLoop(true);
+ }
+ if (action.command & MediaPlayerAction::NO_LOOP) {
+ media_element->setLoop(false);
+ }
+ if (action.command & MediaPlayerAction::SET_PLAYBACK_RATE) {
+ // TODO(ajwong): We should test for overflow.
+ media_element->setPlaybackRate(static_cast<float>(action.playback_rate));
+ }
+ }
+}
+
void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
if (is_new_navigation)
*is_new_navigation = observed_new_navigation_;
Property changes on: webkit\glue\webview_impl.cc
___________________________________________________________________
Modified: svn:mergeinfo
Merged /trunk/src/webkit/glue/webview_impl.cc:r21466
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698