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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2007 Google Inc. All Rights Reserved. 2 * Copyright 2007 Google Inc. All Rights Reserved.
3 * 3 *
4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved. 4 * Portions Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
5 * 5 *
6 * ***** BEGIN LICENSE BLOCK ***** 6 * ***** BEGIN LICENSE BLOCK *****
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "Editor.h" 45 #include "Editor.h"
46 #include "EventHandler.h" 46 #include "EventHandler.h"
47 #include "FocusController.h" 47 #include "FocusController.h"
48 #include "FontDescription.h" 48 #include "FontDescription.h"
49 #include "FrameLoader.h" 49 #include "FrameLoader.h"
50 #include "FrameTree.h" 50 #include "FrameTree.h"
51 #include "FrameView.h" 51 #include "FrameView.h"
52 #include "GraphicsContext.h" 52 #include "GraphicsContext.h"
53 #include "HTMLNames.h" 53 #include "HTMLNames.h"
54 #include "HTMLInputElement.h" 54 #include "HTMLInputElement.h"
55 #include "HTMLMediaElement.h"
55 #include "HitTestResult.h" 56 #include "HitTestResult.h"
56 #include "Image.h" 57 #include "Image.h"
57 #include "InspectorController.h" 58 #include "InspectorController.h"
58 #include "IntRect.h" 59 #include "IntRect.h"
59 #include "KeyboardCodes.h" 60 #include "KeyboardCodes.h"
60 #include "KeyboardEvent.h" 61 #include "KeyboardEvent.h"
61 #include "MIMETypeRegistry.h" 62 #include "MIMETypeRegistry.h"
62 #include "NodeRenderStyle.h" 63 #include "NodeRenderStyle.h"
63 #include "Page.h" 64 #include "Page.h"
64 #include "PageGroup.h" 65 #include "PageGroup.h"
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 } 1785 }
1785 1786
1786 // Future frames check this to know whether to be transparent. 1787 // Future frames check this to know whether to be transparent.
1787 is_transparent_ = is_transparent; 1788 is_transparent_ = is_transparent;
1788 } 1789 }
1789 1790
1790 bool WebViewImpl::GetIsTransparent() const { 1791 bool WebViewImpl::GetIsTransparent() const {
1791 return is_transparent_; 1792 return is_transparent_;
1792 } 1793 }
1793 1794
1795 void WebViewImpl::MediaPlayerActionAt(int x,
1796 int y,
1797 const MediaPlayerAction& action) {
1798 HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
1799
1800 WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode();
1801 if (node->hasTagName(WebCore::HTMLNames::videoTag) ||
1802 node->hasTagName(WebCore::HTMLNames::audioTag)) {
1803 WTF::RefPtr<WebCore::HTMLMediaElement> media_element =
1804 static_pointer_cast<WebCore::HTMLMediaElement>(node);
1805 if (action.command & MediaPlayerAction::PLAY) {
1806 media_element->play();
1807 }
1808 if (action.command & MediaPlayerAction::PAUSE) {
1809 media_element->pause();
1810 }
1811 if (action.command & MediaPlayerAction::MUTE) {
1812 media_element->setMuted(true);
1813 }
1814 if (action.command & MediaPlayerAction::UNMUTE) {
1815 media_element->setMuted(false);
1816 }
1817 if (action.command & MediaPlayerAction::LOOP) {
1818 media_element->setLoop(true);
1819 }
1820 if (action.command & MediaPlayerAction::NO_LOOP) {
1821 media_element->setLoop(false);
1822 }
1823 if (action.command & MediaPlayerAction::SET_PLAYBACK_RATE) {
1824 // TODO(ajwong): We should test for overflow.
1825 media_element->setPlaybackRate(static_cast<float>(action.playback_rate));
1826 }
1827 }
1828 }
1829
1794 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { 1830 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
1795 if (is_new_navigation) 1831 if (is_new_navigation)
1796 *is_new_navigation = observed_new_navigation_; 1832 *is_new_navigation = observed_new_navigation_;
1797 1833
1798 #ifndef NDEBUG 1834 #ifndef NDEBUG
1799 DCHECK(!observed_new_navigation_ || 1835 DCHECK(!observed_new_navigation_ ||
1800 page_->mainFrame()->loader()->documentLoader() == new_navigation_loader_); 1836 page_->mainFrame()->loader()->documentLoader() == new_navigation_loader_);
1801 new_navigation_loader_ = NULL; 1837 new_navigation_loader_ = NULL;
1802 #endif 1838 #endif
1803 observed_new_navigation_ = false; 1839 observed_new_navigation_ = false;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1897 1933
1898 return document->focusedNode(); 1934 return document->focusedNode();
1899 } 1935 }
1900 1936
1901 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { 1937 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) {
1902 IntPoint doc_point( 1938 IntPoint doc_point(
1903 page_->mainFrame()->view()->windowToContents(pos)); 1939 page_->mainFrame()->view()->windowToContents(pos));
1904 return page_->mainFrame()->eventHandler()-> 1940 return page_->mainFrame()->eventHandler()->
1905 hitTestResultAtPoint(doc_point, false); 1941 hitTestResultAtPoint(doc_point, false);
1906 } 1942 }
OLDNEW
« 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