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

Unified Diff: webkit/glue/webview_impl.cc

Issue 251103: Move MediaPlayerAction to WebMediaPlayerAction. Switch to an enum and a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/webkit.gyp » ('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 28235)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -63,6 +63,7 @@
#include "base/message_loop.h"
#include "webkit/api/public/WebDragData.h"
#include "webkit/api/public/WebInputEvent.h"
+#include "webkit/api/public/WebMediaPlayerAction.h"
#include "webkit/api/public/WebPoint.h"
#include "webkit/api/public/WebRect.h"
#include "webkit/api/public/WebString.h"
@@ -72,7 +73,6 @@
#include "webkit/glue/glue_serialize.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/image_resource_fetcher.h"
-#include "webkit/glue/media_player_action.h"
#include "webkit/glue/searchable_form_data.h"
#include "webkit/glue/webdevtoolsagent_impl.h"
#include "webkit/glue/webkit_glue.h"
@@ -104,6 +104,7 @@
using WebKit::WebFrameClient;
using WebKit::WebInputEvent;
using WebKit::WebKeyboardEvent;
+using WebKit::WebMediaPlayerAction;
using WebKit::WebMouseEvent;
using WebKit::WebMouseWheelEvent;
using WebKit::WebNavigationPolicy;
@@ -1417,6 +1418,36 @@
main_frame()->frame()->isZoomFactorTextOnly());
}
+void WebViewImpl::performMediaPlayerAction(const WebMediaPlayerAction& action,
+ const WebPoint& location) {
+ HitTestResult result =
+ HitTestResultForWindowPos(webkit_glue::WebPointToIntPoint(location));
+ WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode();
+ if (!node->hasTagName(WebCore::HTMLNames::videoTag) &&
+ !node->hasTagName(WebCore::HTMLNames::audioTag))
+ return;
+
+ WTF::RefPtr<WebCore::HTMLMediaElement> media_element =
+ static_pointer_cast<WebCore::HTMLMediaElement>(node);
+ switch (action.type) {
+ case WebMediaPlayerAction::Play:
+ if (action.enable) {
+ media_element->play();
+ } else {
+ media_element->pause();
+ }
+ break;
+ case WebMediaPlayerAction::Mute:
+ media_element->setMuted(action.enable);
+ break;
+ case WebMediaPlayerAction::Loop:
+ media_element->setLoop(action.enable);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
void WebViewImpl::copyImageAt(const WebPoint& point) {
if (!page_.get())
return;
@@ -1716,37 +1747,6 @@
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);
- }
- }
-}
-
void WebViewImpl::setIsActive(bool active) {
if (page() && page()->focusController())
page()->focusController()->setActive(active);
« no previous file with comments | « webkit/glue/webview_impl.h ('k') | webkit/webkit.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698