<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[165570] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/165570">165570</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2014-03-13 15:04:07 -0700 (Thu, 13 Mar 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add remote control command support to MediaSession.
https://bugs.webkit.org/show_bug.cgi?id=129903
Reviewed by Eric Carlson.
Add the capability to receive remote control commands (currently iOS only) and to
pass those commands through the MediaSessionManager.
Add a new platform class which can listen for remote control commands:
* platform/RemoteCommandListener.cpp: Added.
(WebCore::RemoteCommandListener::create):
* platform/RemoteCommandListener.h: Added.
(WebCore::RemoteCommandListenerClient::~RemoteCommandListenerClient):
(WebCore::RemoteCommandListener::~RemoteCommandListener):
(WebCore::RemoteCommandListener::RemoteCommandListener):
* platform/ios/RemoteCommandListenerIOS.h: Added.
* platform/ios/RemoteCommandListenerIOS.mm: Added.
(WebCore::RemoteCommandListener::create):
(WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
(WebCore::RemoteCommandListenerIOS::~RemoteCommandListenerIOS):
Handle remote control command events in HTMLMediaElement and AudioDestinationMac:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* platform/audio/mac/AudioDestinationMac.h:
(WebCore::AudioDestinationMac::canReceiveRemoteControlCommands):
(WebCore::AudioDestinationMac::didReceiveRemoteControlCommand):
Pipe command events through MediaSessionManager:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::canReceiveRemoteControlCommands):
(WebCore::MediaSession::didReceivRemoteControlCommand):
* platform/audio/MediaSession.h:
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::addSession):
(WebCore::MediaSessionManager::removeSession):
(WebCore::MediaSessionManager::sessionWillBeginPlayback):
(WebCore::MediaSessionManager::didReceiveRemoteControlCommand):
(WebCore::MediaSessionManager::addClient):
(WebCore::MediaSessionManager::removeClient):
* platform/audio/MediaSessionManager.h:
(WebCore::MediaSessionManagerClient::~MediaSessionManagerClient):
(WebCore::MediaSessionManagerClient::MediaSessionManagerClient):
Make sessionWillBegin/EndPlayback() methods take non-const parameters:
* platform/audio/MediaSessionManager.h:
(WebCore::MediaSessionManager::sessionWillEndPlayback):
* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManagerIOS::sessionWillBeginPlayaback):
(WebCore::MediaSessionManagerIOS::sessionWillEndPlayaback):
Add new files and export new symbols:
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessioncpp">trunk/Source/WebCore/platform/audio/MediaSession.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionh">trunk/Source/WebCore/platform/audio/MediaSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagercpp">trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioMediaSessionManagerh">trunk/Source/WebCore/platform/audio/MediaSessionManager.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm">trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacAudioDestinationMach">trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformRemoteCommandListenercpp">trunk/Source/WebCore/platform/RemoteCommandListener.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformRemoteCommandListenerh">trunk/Source/WebCore/platform/RemoteCommandListener.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosRemoteCommandListenerIOSh">trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosRemoteCommandListenerIOSmm">trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/ChangeLog        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2014-03-07 Jer Noble <jer.noble@apple.com>
+
+ Add remote control command support to MediaSession.
+ https://bugs.webkit.org/show_bug.cgi?id=129903
+
+ Reviewed by Eric Carlson.
+
+ Add the capability to receive remote control commands (currently iOS only) and to
+ pass those commands through the MediaSessionManager.
+
+ Add a new platform class which can listen for remote control commands:
+ * platform/RemoteCommandListener.cpp: Added.
+ (WebCore::RemoteCommandListener::create):
+ * platform/RemoteCommandListener.h: Added.
+ (WebCore::RemoteCommandListenerClient::~RemoteCommandListenerClient):
+ (WebCore::RemoteCommandListener::~RemoteCommandListener):
+ (WebCore::RemoteCommandListener::RemoteCommandListener):
+ * platform/ios/RemoteCommandListenerIOS.h: Added.
+ * platform/ios/RemoteCommandListenerIOS.mm: Added.
+ (WebCore::RemoteCommandListener::create):
+ (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
+ (WebCore::RemoteCommandListenerIOS::~RemoteCommandListenerIOS):
+
+ Handle remote control command events in HTMLMediaElement and AudioDestinationMac:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::parseAttribute):
+ * html/HTMLMediaElement.h:
+ * platform/audio/mac/AudioDestinationMac.h:
+ (WebCore::AudioDestinationMac::canReceiveRemoteControlCommands):
+ (WebCore::AudioDestinationMac::didReceiveRemoteControlCommand):
+
+ Pipe command events through MediaSessionManager:
+ * platform/audio/MediaSession.cpp:
+ (WebCore::MediaSession::canReceiveRemoteControlCommands):
+ (WebCore::MediaSession::didReceivRemoteControlCommand):
+ * platform/audio/MediaSession.h:
+ * platform/audio/MediaSessionManager.cpp:
+ (WebCore::MediaSessionManager::addSession):
+ (WebCore::MediaSessionManager::removeSession):
+ (WebCore::MediaSessionManager::sessionWillBeginPlayback):
+ (WebCore::MediaSessionManager::didReceiveRemoteControlCommand):
+ (WebCore::MediaSessionManager::addClient):
+ (WebCore::MediaSessionManager::removeClient):
+ * platform/audio/MediaSessionManager.h:
+ (WebCore::MediaSessionManagerClient::~MediaSessionManagerClient):
+ (WebCore::MediaSessionManagerClient::MediaSessionManagerClient):
+
+ Make sessionWillBegin/EndPlayback() methods take non-const parameters:
+ * platform/audio/MediaSessionManager.h:
+ (WebCore::MediaSessionManager::sessionWillEndPlayback):
+ * platform/audio/ios/MediaSessionManagerIOS.h:
+ * platform/audio/ios/MediaSessionManagerIOS.mm:
+ (WebCore::MediaSessionManagerIOS::sessionWillBeginPlayaback):
+ (WebCore::MediaSessionManagerIOS::sessionWillEndPlayaback):
+
+ Add new files and export new symbols:
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2014-03-13 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r165544 and r165560.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -778,12 +778,15 @@
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerC2EPNS_25LayerFlushSchedulerClientE
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerD1Ev
</span><span class="cx"> __ZN7WebCore19LayerFlushSchedulerD2Ev
</span><ins>+__ZN7WebCore19MediaSessionManager9addClientEPNS_25MediaSessionManagerClientE
+__ZN7WebCore19MediaSessionManager12removeClientEPNS_25MediaSessionManagerClientE
</ins><span class="cx"> __ZN7WebCore19MediaSessionManager12restrictionsENS_12MediaSession9MediaTypeE
</span><span class="cx"> __ZN7WebCore19MediaSessionManager13sharedManagerEv
</span><span class="cx"> __ZN7WebCore19MediaSessionManager14addRestrictionENS_12MediaSession9MediaTypeEj
</span><span class="cx"> __ZN7WebCore19MediaSessionManager15endInterruptionENS_12MediaSession20EndInterruptionFlagsE
</span><span class="cx"> __ZN7WebCore19MediaSessionManager17beginInterruptionEv
</span><span class="cx"> __ZN7WebCore19MediaSessionManager17removeRestrictionENS_12MediaSession9MediaTypeEj
</span><ins>+__ZN7WebCore19MediaSessionManager30didReceiveRemoteControlCommandENS_12MediaSession24RemoteControlCommandTypeE
</ins><span class="cx"> __ZN7WebCore19PlatformCAAnimation10setToValueERKNS_20TransformationMatrixE
</span><span class="cx"> __ZN7WebCore19PlatformCAAnimation6createEP19CAPropertyAnimation
</span><span class="cx"> __ZN7WebCore19PlatformCAAnimationD1Ev
</span><span class="lines">@@ -850,6 +853,7 @@
</span><span class="cx"> __ZN7WebCore21NetworkStorageSession25switchToNewTestingSessionEv
</span><span class="cx"> __ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
</span><ins>+__ZN7WebCore21RemoteCommandListener6createERNS_27RemoteCommandListenerClientE
</ins><span class="cx"> __ZN7WebCore21ResourceLoadScheduler20servePendingRequestsENS_20ResourceLoadPriorityE
</span><span class="cx"> __ZN7WebCore21ResourceLoadScheduler20servePendingRequestsEPNS0_15HostInformationENS_20ResourceLoadPriorityE
</span><span class="cx"> __ZN7WebCore21ResourceLoadScheduler21resumePendingRequestsEv
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -5610,6 +5610,9 @@
</span><span class="cx">                 CDF2B0191820540700F2B424 /* MockTracks.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF2B00F1820540600F2B424 /* MockTracks.h */; };
</span><span class="cx">                 CDF65CC8145B1E7500C4C7AA /* MediaController.h in Headers */ = {isa = PBXBuildFile; fileRef = CD27F6E4145767870078207D /* MediaController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CDF65CCA145B448800C4C7AA /* MediaControllerInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                CDFC360518CA61C20026E56F /* RemoteCommandListener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */; };
+                CDFC360618CA61C20026E56F /* RemoteCommandListener.h in Headers */ = {isa = PBXBuildFile; fileRef = CDFC360418CA61C20026E56F /* RemoteCommandListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                CDFC360718CA696C0026E56F /* RemoteCommandListenerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */; };
</ins><span class="cx">                 CE057FA51220731100A476D5 /* DocumentMarkerController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */; };
</span><span class="cx">                 CE057FA61220731100A476D5 /* DocumentMarkerController.h in Headers */ = {isa = PBXBuildFile; fileRef = CE057FA41220731100A476D5 /* DocumentMarkerController.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CE08C3D1152B599A0021B8C2 /* AlternativeTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */; };
</span><span class="lines">@@ -12930,6 +12933,10 @@
</span><span class="cx">                 CDF2B00F1820540600F2B424 /* MockTracks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockTracks.h; sourceTree = "<group>"; };
</span><span class="cx">                 CDF65CC9145B43A700C4C7AA /* MediaControllerInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControllerInterface.h; sourceTree = "<group>"; };
</span><span class="cx">                 CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLMediaElementCustom.cpp; sourceTree = "<group>"; };
</span><ins>+                CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteCommandListenerIOS.h; path = ios/RemoteCommandListenerIOS.h; sourceTree = "<group>"; };
+                CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RemoteCommandListenerIOS.mm; path = ios/RemoteCommandListenerIOS.mm; sourceTree = "<group>"; };
+                CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteCommandListener.cpp; sourceTree = "<group>"; };
+                CDFC360418CA61C20026E56F /* RemoteCommandListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCommandListener.h; sourceTree = "<group>"; };
</ins><span class="cx">                 CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarkerController.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 CE057FA41220731100A476D5 /* DocumentMarkerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarkerController.h; sourceTree = "<group>"; };
</span><span class="cx">                 CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlternativeTextController.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -18036,6 +18043,8 @@
</span><span class="cx">                                 C5278B0B17F212EA003A2998 /* PlatformPasteboardIOS.mm */,
</span><span class="cx">                                 E45390320EAFD637003695C8 /* PlatformScreenIOS.mm */,
</span><span class="cx">                                 AAE3755D17429BCC006200C2 /* PlatformSpeechSynthesizerIOS.mm */,
</span><ins>+                                CDFC360118CA61630026E56F /* RemoteCommandListenerIOS.h */,
+                                CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */,
</ins><span class="cx">                                 44C363EE0FAA7BB30097F8CC /* RuntimeApplicationChecksIOS.h */,
</span><span class="cx">                                 44C363EF0FAA7BB30097F8CC /* RuntimeApplicationChecksIOS.mm */,
</span><span class="cx">                                 0F17747E1378B771009DA76A /* ScrollAnimatorIOS.h */,
</span><span class="lines">@@ -20959,6 +20968,8 @@
</span><span class="cx">                                 9380F47109A11AB4001FDB34 /* Widget.cpp */,
</span><span class="cx">                                 9380F47209A11AB4001FDB34 /* Widget.h */,
</span><span class="cx">                                 E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */,
</span><ins>+                                CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */,
+                                CDFC360418CA61C20026E56F /* RemoteCommandListener.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = platform;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -25487,6 +25498,7 @@
</span><span class="cx">                                 E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,
</span><span class="cx">                                 E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */,
</span><span class="cx">                                 A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */,
</span><ins>+                                CDFC360618CA61C20026E56F /* RemoteCommandListener.h in Headers */,
</ins><span class="cx">                                 E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */,
</span><span class="cx">                                 A8EA800A0A19516E00A8EF5F /* StyleSheetList.h in Headers */,
</span><span class="cx">                                 BC5EB5E50E81BF6D00B25965 /* StyleSurroundData.h in Headers */,
</span><span class="lines">@@ -27577,6 +27589,7 @@
</span><span class="cx">                                 A9D248060D757E7D00FDF959 /* JSDOMMimeType.cpp in Sources */,
</span><span class="cx">                                 A9D248080D757E7D00FDF959 /* JSDOMMimeTypeArray.cpp in Sources */,
</span><span class="cx">                                 A9C6E6470D7465CA006442E9 /* JSDOMMimeTypeArrayCustom.cpp in Sources */,
</span><ins>+                                CDFC360718CA696C0026E56F /* RemoteCommandListenerIOS.mm in Sources */,
</ins><span class="cx">                                 52CCA9E215E3F62C0053C77F /* JSDOMNamedFlowCollection.cpp in Sources */,
</span><span class="cx">                                 1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */,
</span><span class="cx">                                 FB91392B16AE4FC0001FE682 /* JSDOMPath.cpp in Sources */,
</span><span class="lines">@@ -28180,6 +28193,7 @@
</span><span class="cx">                                 A516E8B8136E04DB0076C3C0 /* LocalizedDateCache.mm in Sources */,
</span><span class="cx">                                 C046E1AC1208A9FE00BA2CF7 /* LocalizedStrings.cpp in Sources */,
</span><span class="cx">                                 BC25B52A131C6D3900180E10 /* LocalizedStringsMac.cpp in Sources */,
</span><ins>+                                CDFC360518CA61C20026E56F /* RemoteCommandListener.cpp in Sources */,
</ins><span class="cx">                                 BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */,
</span><span class="cx">                                 A8239E0009B3CF8A00B60641 /* Logging.cpp in Sources */,
</span><span class="cx">                                 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -5887,6 +5887,12 @@
</span><span class="cx"> return m_currentSrc;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void HTMLMediaElement::didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType command)
+{
+ // FIXME(129926): Add Remote Control support to HTMLMediaElement
+ UNUSED_PARAM(command);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+}
+
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -697,6 +697,8 @@
</span><span class="cx"> virtual String mediaSessionTitle() const override;
</span><span class="cx"> virtual double mediaSessionDuration() const override { return duration(); }
</span><span class="cx"> virtual double mediaSessionCurrentTime() const override { return currentTime(); }
</span><ins>+ virtual bool canReceiveRemoteControlCommands() const override { return true; }
+ virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) override;
</ins><span class="cx">
</span><span class="cx"> Timer<HTMLMediaElement> m_loadTimer;
</span><span class="cx"> Timer<HTMLMediaElement> m_progressEventTimer;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformRemoteCommandListenercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/RemoteCommandListener.cpp (0 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/RemoteCommandListener.cpp         (rev 0)
+++ trunk/Source/WebCore/platform/RemoteCommandListener.cpp        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteCommandListener.h"
+
+namespace WebCore {
+
+#if !PLATFORM(IOS)
+std::unique_ptr<RemoteCommandListener> RemoteCommandListener::create(RemoteCommandListenerClient& client)
+{
+ return std::move(std::unique_ptr<RemoteCommandListener>(new RemoteCommandListener(client)));
+}
+#endif
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformRemoteCommandListenerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/RemoteCommandListener.h (0 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/RemoteCommandListener.h         (rev 0)
+++ trunk/Source/WebCore/platform/RemoteCommandListener.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoteCommandListener_h
+#define RemoteCommandListener_h
+
+#include "MediaSession.h"
+
+namespace WebCore {
+
+class RemoteCommandListenerClient {
+public:
+ virtual ~RemoteCommandListenerClient() { }
+ virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) = 0;
+};
+
+class RemoteCommandListener {
+public:
+ static std::unique_ptr<RemoteCommandListener> create(RemoteCommandListenerClient&);
+ virtual ~RemoteCommandListener() { }
+
+protected:
+ RemoteCommandListener(RemoteCommandListenerClient& client) : m_client(client) { };
+
+ RemoteCommandListenerClient& m_client;
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSession.cpp (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSession.cpp        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/MediaSession.cpp        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -145,4 +145,14 @@
</span><span class="cx"> return m_client.mediaSessionCurrentTime();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool MediaSession::canReceiveRemoteControlCommands() const
+{
+ return m_client.canReceiveRemoteControlCommands();
</ins><span class="cx"> }
</span><ins>+
+void MediaSession::didReceiveRemoteControlCommand(RemoteControlCommandType command)
+{
+ m_client.didReceiveRemoteControlCommand(command);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSession.h (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSession.h        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/MediaSession.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -76,6 +76,20 @@
</span><span class="cx"> double duration() const;
</span><span class="cx"> double currentTime() const;
</span><span class="cx">
</span><ins>+ enum RemoteControlCommandType {
+ NoCommand,
+ PlayCommand,
+ PauseCommand,
+ StopCommand,
+ TogglePlayPauseCommand,
+ BeginSeekingBackwardCommand,
+ EndSeekingBackwardCommand,
+ BeginSeekingForwardCommand,
+ EndSeekingForwardCommand,
+ };
+ bool canReceiveRemoteControlCommands() const;
+ void didReceiveRemoteControlCommand(RemoteControlCommandType);
+
</ins><span class="cx"> protected:
</span><span class="cx"> MediaSessionClient& client() const { return m_client; }
</span><span class="cx">
</span><span class="lines">@@ -94,11 +108,14 @@
</span><span class="cx"> virtual MediaSession::MediaType mediaType() const = 0;
</span><span class="cx"> virtual void resumePlayback() = 0;
</span><span class="cx"> virtual void pausePlayback() = 0;
</span><del>-
</del><ins>+
</ins><span class="cx"> virtual String mediaSessionTitle() const { return String(); }
</span><span class="cx"> virtual double mediaSessionDuration() const { return MediaPlayer::invalidTime(); }
</span><span class="cx"> virtual double mediaSessionCurrentTime() const { return MediaPlayer::invalidTime(); }
</span><span class="cx">
</span><ins>+ virtual bool canReceiveRemoteControlCommands() const = 0;
+ virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) = 0;
+
</ins><span class="cx"> protected:
</span><span class="cx"> virtual ~MediaSessionClient() { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.cpp        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -102,6 +102,12 @@
</span><span class="cx"> if (m_interrupted)
</span><span class="cx"> session.setState(MediaSession::Interrupted);
</span><span class="cx"> updateSessionState();
</span><ins>+
+ if (m_clients.isEmpty() || !(session.mediaType() == MediaSession::Video || session.mediaType() == MediaSession::Audio))
+ return;
+
+ for (auto& client : m_clients)
+ client->startListeningForRemoteControlCommands();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaSessionManager::removeSession(MediaSession& session)
</span><span class="lines">@@ -116,6 +122,12 @@
</span><span class="cx">
</span><span class="cx"> m_sessions.remove(index);
</span><span class="cx"> updateSessionState();
</span><ins>+
+ if (m_clients.isEmpty() || !(session.mediaType() == MediaSession::Video || session.mediaType() == MediaSession::Audio))
+ return;
+
+ for (auto& client : m_clients)
+ client->startListeningForRemoteControlCommands();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MediaSessionManager::addRestriction(MediaSession::MediaType type, SessionRestrictions restriction)
</span><span class="lines">@@ -136,10 +148,15 @@
</span><span class="cx"> return m_restrictions[type];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MediaSessionManager::sessionWillBeginPlayback(const MediaSession& session)
</del><ins>+void MediaSessionManager::sessionWillBeginPlayback(MediaSession& session)
</ins><span class="cx"> {
</span><span class="cx"> setCurrentSession(&session);
</span><del>-
</del><ins>+
+ if (!m_clients.isEmpty() && (session.mediaType() == MediaSession::Video || session.mediaType() == MediaSession::Audio)) {
+ for (auto& client : m_clients)
+ client->didBeginPlayback();
+ }
+
</ins><span class="cx"> MediaSession::MediaType sessionType = session.mediaType();
</span><span class="cx"> SessionRestrictions restrictions = m_restrictions[sessionType];
</span><span class="cx"> if (!restrictions & ConcurrentPlaybackNotPermitted)
</span><span class="lines">@@ -188,4 +205,23 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+void MediaSessionManager::didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType command)
+{
+ if (!m_activeSession || !m_activeSession->canReceiveRemoteControlCommands())
+ return;
+ m_activeSession->didReceiveRemoteControlCommand(command);
</ins><span class="cx"> }
</span><ins>+
+void MediaSessionManager::addClient(MediaSessionManagerClient* client)
+{
+ ASSERT(!m_clients.contains(client));
+ m_clients.append(client);
+}
+
+void MediaSessionManager::removeClient(MediaSessionManagerClient* client)
+{
+ ASSERT(m_clients.contains(client));
+ m_clients.remove(m_clients.find(client));
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioMediaSessionManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/MediaSessionManager.h (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/MediaSessionManager.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -36,6 +36,19 @@
</span><span class="cx"> class HTMLMediaElement;
</span><span class="cx"> class MediaSession;
</span><span class="cx">
</span><ins>+class MediaSessionManagerClient {
+public:
+ virtual ~MediaSessionManagerClient() { }
+
+ virtual bool isListeningForRemoteControlCommands() = 0;
+ virtual void startListeningForRemoteControlCommands() = 0;
+ virtual void stopListeningForRemoteControlCommands() = 0;
+ virtual void didBeginPlayback() = 0;
+
+protected:
+ MediaSessionManagerClient() { }
+};
+
</ins><span class="cx"> class MediaSessionManager {
</span><span class="cx"> public:
</span><span class="cx"> static MediaSessionManager& sharedManager();
</span><span class="lines">@@ -65,8 +78,8 @@
</span><span class="cx"> SessionRestrictions restrictions(MediaSession::MediaType);
</span><span class="cx"> virtual void resetRestrictions();
</span><span class="cx">
</span><del>- virtual void sessionWillBeginPlayback(const MediaSession&);
- virtual void sessionWillEndPlayback(const MediaSession&) { }
</del><ins>+ virtual void sessionWillBeginPlayback(MediaSession&);
+ virtual void sessionWillEndPlayback(MediaSession&) { }
</ins><span class="cx">
</span><span class="cx"> bool sessionRestrictsInlineVideoPlayback(const MediaSession&) const;
</span><span class="cx">
</span><span class="lines">@@ -74,6 +87,11 @@
</span><span class="cx"> virtual void showPlaybackTargetPicker() { }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType);
+
+ void addClient(MediaSessionManagerClient*);
+ void removeClient(MediaSessionManagerClient*);
+
</ins><span class="cx"> protected:
</span><span class="cx"> friend class MediaSession;
</span><span class="cx"> explicit MediaSessionManager();
</span><span class="lines">@@ -81,8 +99,8 @@
</span><span class="cx"> void addSession(MediaSession&);
</span><span class="cx"> void removeSession(MediaSession&);
</span><span class="cx">
</span><del>- void setCurrentSession(const MediaSession* session) { m_activeSession = session; }
- const MediaSession* currentSession() { return m_activeSession; }
</del><ins>+ void setCurrentSession(MediaSession* session) { m_activeSession = session; }
+ MediaSession* currentSession() { return m_activeSession; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> void updateSessionState();
</span><span class="lines">@@ -90,7 +108,8 @@
</span><span class="cx"> SessionRestrictions m_restrictions[MediaSession::WebAudio + 1];
</span><span class="cx">
</span><span class="cx"> Vector<MediaSession*> m_sessions;
</span><del>- const MediaSession* m_activeSession;
</del><ins>+ Vector<MediaSessionManagerClient*> m_clients;
+ MediaSession* m_activeSession;
</ins><span class="cx"> bool m_interrupted;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -48,8 +48,8 @@
</span><span class="cx"> private:
</span><span class="cx"> friend class MediaSessionManager;
</span><span class="cx">
</span><del>- virtual void sessionWillBeginPlayback(const MediaSession&) override;
- virtual void sessionWillEndPlayback(const MediaSession&) override;
</del><ins>+ virtual void sessionWillBeginPlayback(MediaSession&) override;
+ virtual void sessionWillEndPlayback(MediaSession&) override;
</ins><span class="cx">
</span><span class="cx"> void updateNowPlayingInfo();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioiosMediaSessionManagerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -136,13 +136,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void MediaSessionManageriOS::sessionWillBeginPlayback(const MediaSession& session)
</del><ins>+void MediaSessionManageriOS::sessionWillBeginPlayback(MediaSession& session)
</ins><span class="cx"> {
</span><span class="cx"> MediaSessionManager::sessionWillBeginPlayback(session);
</span><span class="cx"> updateNowPlayingInfo();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void MediaSessionManageriOS::sessionWillEndPlayback(const MediaSession& session)
</del><ins>+void MediaSessionManageriOS::sessionWillEndPlayback(MediaSession& session)
</ins><span class="cx"> {
</span><span class="cx"> MediaSessionManager::sessionWillEndPlayback(session);
</span><span class="cx"> updateNowPlayingInfo();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacAudioDestinationMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h (165569 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h        2014-03-13 22:02:17 UTC (rev 165569)
+++ trunk/Source/WebCore/platform/audio/mac/AudioDestinationMac.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -62,6 +62,8 @@
</span><span class="cx"> OSStatus render(UInt32 numberOfFrames, AudioBufferList* ioData);
</span><span class="cx">
</span><span class="cx"> virtual MediaSession::MediaType mediaType() const { return MediaSession::WebAudio; }
</span><ins>+ virtual bool canReceiveRemoteControlCommands() const { return false; }
+ virtual void didReceiveRemoteControlCommand(MediaSession::RemoteControlCommandType) { }
</ins><span class="cx">
</span><span class="cx"> AudioUnit m_outputUnit;
</span><span class="cx"> AudioIOCallback& m_callback;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosRemoteCommandListenerIOSh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h (0 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h         (rev 0)
+++ trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.h        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RemoteCommandListenerIOS_h
+#define RemoteCommandListenerIOS_h
+
+#include "RemoteCommandListener.h"
+
+#if PLATFORM(IOS)
+
+#include <wtf/RetainPtr.h>
+
+#ifndef __OBJC__
+typedef void *id;
+#endif
+
+namespace WebCore {
+
+class RemoteCommandListenerIOS : public RemoteCommandListener {
+public:
+ RemoteCommandListenerIOS(RemoteCommandListenerClient&);
+ virtual ~RemoteCommandListenerIOS();
+
+protected:
+ RetainPtr<id> m_playTarget;
+ RetainPtr<id> m_pauseTarget;
+ RetainPtr<id> m_togglePlayPauseTarget;
+ RetainPtr<id> m_seekForwardTarget;
+ RetainPtr<id> m_seekBackwardTarget;
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosRemoteCommandListenerIOSmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm (0 => 165570)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm         (rev 0)
+++ trunk/Source/WebCore/platform/ios/RemoteCommandListenerIOS.mm        2014-03-13 22:04:07 UTC (rev 165570)
</span><span class="lines">@@ -0,0 +1,90 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "RemoteCommandListenerIOS.h"
+
+#if PLATFORM(IOS)
+
+#import <MediaPlayer/MPRemoteCommandCenter.h>
+#import <MediaPlayer/MPRemoteCommandEvent.h>
+#import <MediaPlayer/MPRemoteCommand.h>
+#import <WebCore/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK(MediaPlayer)
+SOFT_LINK_CLASS(MediaPlayer, MPRemoteCommandCenter)
+SOFT_LINK_CLASS(MediaPlayer, MPSeekCommandEvent)
+
+namespace WebCore {
+
+std::unique_ptr<RemoteCommandListener> RemoteCommandListener::create(RemoteCommandListenerClient& client)
+{
+ return std::move(std::unique_ptr<RemoteCommandListener>(new RemoteCommandListenerIOS(client)));
+}
+
+RemoteCommandListenerIOS::RemoteCommandListenerIOS(RemoteCommandListenerClient& client)
+ : RemoteCommandListener(client)
+{
+ MPRemoteCommandCenter *center = [getMPRemoteCommandCenterClass() sharedCommandCenter];
+
+ m_pauseTarget = [[center pauseCommand] addTargetWithHandler:^(MPRemoteCommandEvent *) {
+ m_client.didReceiveRemoteControlCommand(MediaSession::PauseCommand);
+ return MPRemoteCommandHandlerStatusSuccess;
+ }];
+ m_playTarget = [[center playCommand] addTargetWithHandler:^(MPRemoteCommandEvent *) {
+ m_client.didReceiveRemoteControlCommand(MediaSession::PlayCommand);
+ return MPRemoteCommandHandlerStatusSuccess;
+ }];
+ m_togglePlayPauseTarget = [[center togglePlayPauseCommand] addTargetWithHandler:^(MPRemoteCommandEvent *) {
+ m_client.didReceiveRemoteControlCommand(MediaSession::TogglePlayPauseCommand);
+ return MPRemoteCommandHandlerStatusSuccess;
+ }];
+ m_seekBackwardTarget = [[center seekBackwardCommand] addTargetWithHandler:^(MPRemoteCommandEvent *event) {
+ ASSERT([event isKindOfClass:getMPSeekCommandEventClass()]);
+ MPSeekCommandEvent* seekEvent = static_cast<MPSeekCommandEvent *>(event);
+ m_client.didReceiveRemoteControlCommand([seekEvent type] == MPSeekCommandEventTypeBeginSeeking ? MediaSession::BeginSeekingBackwardCommand : MediaSession::EndSeekingBackwardCommand);
+ return MPRemoteCommandHandlerStatusSuccess;
+ }];
+ m_seekForwardTarget = [[center seekForwardCommand] addTargetWithHandler:^(MPRemoteCommandEvent *event) {
+ ASSERT([event isKindOfClass:getMPSeekCommandEventClass()]);
+ MPSeekCommandEvent* seekEvent = static_cast<MPSeekCommandEvent *>(event);
+ m_client.didReceiveRemoteControlCommand([seekEvent type] == MPSeekCommandEventTypeBeginSeeking ? MediaSession::BeginSeekingForwardCommand : MediaSession::EndSeekingForwardCommand);
+ return MPRemoteCommandHandlerStatusSuccess;
+ }];
+}
+
+RemoteCommandListenerIOS::~RemoteCommandListenerIOS()
+{
+ MPRemoteCommandCenter *center = [getMPRemoteCommandCenterClass() sharedCommandCenter];
+ [[center pauseCommand] removeTarget:m_pauseTarget.get()];
+ [[center playCommand] removeTarget:m_playTarget.get()];
+ [[center togglePlayPauseCommand] removeTarget:m_togglePlayPauseTarget.get()];
+ [[center seekForwardCommand] removeTarget:m_seekForwardTarget.get()];
+ [[center seekBackwardCommand] removeTarget:m_seekBackwardTarget.get()];
+}
+
+}
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>