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

Unified Diff: webkit/glue/webview_impl.cc

Issue 155954: Implement sending actions back to the render for media element context menus. (Closed)
Patch Set: remove uneeded bits. 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
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 29152bdc2baaaf7572590ffae6bcf58c0ee6828a..a4ceff087591f75358d413faf963375cbd8d9ef3 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -52,6 +52,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HTMLInputElement.h"
+#include "HTMLMediaElement.h"
#include "HitTestResult.h"
#include "Image.h"
#include "InspectorController.h"
@@ -1791,6 +1792,41 @@ bool WebViewImpl::GetIsTransparent() const {
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_;
« 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