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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
« 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')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/webkit/glue/webview_impl.cc:r21466
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 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 } 1790 }
1790 1791
1791 // Future frames check this to know whether to be transparent. 1792 // Future frames check this to know whether to be transparent.
1792 is_transparent_ = is_transparent; 1793 is_transparent_ = is_transparent;
1793 } 1794 }
1794 1795
1795 bool WebViewImpl::GetIsTransparent() const { 1796 bool WebViewImpl::GetIsTransparent() const {
1796 return is_transparent_; 1797 return is_transparent_;
1797 } 1798 }
1798 1799
1800 void WebViewImpl::MediaPlayerActionAt(int x,
1801 int y,
1802 const MediaPlayerAction& action) {
1803 HitTestResult result = HitTestResultForWindowPos(IntPoint(x, y));
1804
1805 WTF::RefPtr<WebCore::Node> node = result.innerNonSharedNode();
1806 if (node->hasTagName(WebCore::HTMLNames::videoTag) ||
1807 node->hasTagName(WebCore::HTMLNames::audioTag)) {
1808 WTF::RefPtr<WebCore::HTMLMediaElement> media_element =
1809 static_pointer_cast<WebCore::HTMLMediaElement>(node);
1810 if (action.command & MediaPlayerAction::PLAY) {
1811 media_element->play();
1812 }
1813 if (action.command & MediaPlayerAction::PAUSE) {
1814 media_element->pause();
1815 }
1816 if (action.command & MediaPlayerAction::MUTE) {
1817 media_element->setMuted(true);
1818 }
1819 if (action.command & MediaPlayerAction::UNMUTE) {
1820 media_element->setMuted(false);
1821 }
1822 if (action.command & MediaPlayerAction::LOOP) {
1823 media_element->setLoop(true);
1824 }
1825 if (action.command & MediaPlayerAction::NO_LOOP) {
1826 media_element->setLoop(false);
1827 }
1828 if (action.command & MediaPlayerAction::SET_PLAYBACK_RATE) {
1829 // TODO(ajwong): We should test for overflow.
1830 media_element->setPlaybackRate(static_cast<float>(action.playback_rate));
1831 }
1832 }
1833 }
1834
1799 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) { 1835 void WebViewImpl::DidCommitLoad(bool* is_new_navigation) {
1800 if (is_new_navigation) 1836 if (is_new_navigation)
1801 *is_new_navigation = observed_new_navigation_; 1837 *is_new_navigation = observed_new_navigation_;
1802 1838
1803 #ifndef NDEBUG 1839 #ifndef NDEBUG
1804 DCHECK(!observed_new_navigation_ || 1840 DCHECK(!observed_new_navigation_ ||
1805 page_->mainFrame()->loader()->documentLoader() == new_navigation_loader_); 1841 page_->mainFrame()->loader()->documentLoader() == new_navigation_loader_);
1806 new_navigation_loader_ = NULL; 1842 new_navigation_loader_ = NULL;
1807 #endif 1843 #endif
1808 observed_new_navigation_ = false; 1844 observed_new_navigation_ = false;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 1938
1903 return document->focusedNode(); 1939 return document->focusedNode();
1904 } 1940 }
1905 1941
1906 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) { 1942 HitTestResult WebViewImpl::HitTestResultForWindowPos(const IntPoint& pos) {
1907 IntPoint doc_point( 1943 IntPoint doc_point(
1908 page_->mainFrame()->view()->windowToContents(pos)); 1944 page_->mainFrame()->view()->windowToContents(pos));
1909 return page_->mainFrame()->eventHandler()-> 1945 return page_->mainFrame()->eventHandler()->
1910 hitTestResultAtPoint(doc_point, false); 1946 hitTestResultAtPoint(doc_point, false);
1911 } 1947 }
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