Adopt MediaRemote.
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2016 19:29:07 +0000 (19:29 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2016 19:29:07 +0000 (19:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=159250

Reviewed by Eric Carlson.

Source/WebCore:

Adopt MediaRemote and use the framework to implement MediaSessionManageMac
and RemoteCommandListenerMac.

* WebCore.xcodeproj/project.pbxproj:
* platform/RemoteCommandListener.cpp:
* platform/audio/PlatformMediaSessionManager.cpp:
* platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp.
(PlatformMediaSessionManager::updateSessionState):
* platform/audio/mac/MediaSessionManagerMac.h: Added.
* platform/audio/mac/MediaSessionManagerMac.mm: Added.
(WebCore::PlatformMediaSessionManager::sharedManager):
(WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
(WebCore::MediaSessionManagerMac::MediaSessionManagerMac):
(WebCore::MediaSessionManagerMac::~MediaSessionManagerMac):
(WebCore::MediaSessionManagerMac::sessionWillBeginPlayback):
(WebCore::MediaSessionManagerMac::removeSession):
(WebCore::MediaSessionManagerMac::sessionWillEndPlayback):
(WebCore::MediaSessionManagerMac::clientCharacteristicsChanged):
(WebCore::MediaSessionManagerMac::nowPlayingEligibleSession):
(WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
* platform/cocoa/SoftLinking.h:
* platform/mac/MediaRemoteSoftLink.cpp: Added.
* platform/mac/MediaRemoteSoftLink.h: Added.
* platform/mac/RemoteCommandListenerMac.h: Added.
(WebCore::RemoteCommandListenerMac::createWeakPtr):
* platform/mac/RemoteCommandListenerMac.mm: Added.
(WebCore::RemoteCommandListener::create):
(WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
(WebCore::RemoteCommandListenerMac::~RemoteCommandListenerMac):
* platform/spi/mac/MediaRemoteSPI.h: Added.

Source/WebKit2:

Add a sandbox exception allowing access to the mediaremoted XPC service.

* WebProcess/com.apple.WebProcess.sb.in:

Source/WTF:

Add USE_MEDIAREMOTE.

* wtf/Platform.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202642 268f45cc-cd09-0410-ab3c-d52691b4dbfc

17 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/RemoteCommandListener.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp [moved from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp with 98% similarity]
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h [new file with mode: 0644]
Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm [new file with mode: 0644]
Source/WebCore/platform/cocoa/SoftLinking.h
Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp [new file with mode: 0644]
Source/WebCore/platform/mac/MediaRemoteSoftLink.h [new file with mode: 0644]
Source/WebCore/platform/mac/RemoteCommandListenerMac.h [new file with mode: 0644]
Source/WebCore/platform/mac/RemoteCommandListenerMac.mm [new file with mode: 0644]
Source/WebCore/platform/spi/mac/MediaRemoteSPI.h [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/com.apple.WebProcess.sb.in

index ab239d80304c434ce5f553e7807e83d219516b16..6bd343f498415e321e65849da5026d2b4dbc4b7e 100644 (file)
@@ -1,3 +1,14 @@
+2016-06-29  Jer Noble  <jer.noble@apple.com>
+
+        Adopt MediaRemote.
+        https://bugs.webkit.org/show_bug.cgi?id=159250
+
+        Reviewed by Eric Carlson.
+
+        Add USE_MEDIAREMOTE.
+
+        * wtf/Platform.h:
+
 2016-06-28  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r202580.
index 727c7322ff17fe88f6f38a76cbd2d138bfb06383..f4c9f29270611caa5e3ee35adbd2eedcbb81c2af 100644 (file)
 #endif
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+#define USE_MEDIAREMOTE 1
+#endif
+
 #endif /* WTF_Platform_h */
index 97fa7884712f686b9677061c86d1cd8e441a852b..0b5946a3c0921871979bda69883cf45519e759d8 100644 (file)
@@ -1,3 +1,41 @@
+2016-06-29  Jer Noble  <jer.noble@apple.com>
+
+        Adopt MediaRemote.
+        https://bugs.webkit.org/show_bug.cgi?id=159250
+
+        Reviewed by Eric Carlson.
+
+        Adopt MediaRemote and use the framework to implement MediaSessionManageMac
+        and RemoteCommandListenerMac.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/RemoteCommandListener.cpp:
+        * platform/audio/PlatformMediaSessionManager.cpp:
+        * platform/audio/cocoa/MediaSessionManagerCocoa.cpp: Renamed from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp.
+        (PlatformMediaSessionManager::updateSessionState):
+        * platform/audio/mac/MediaSessionManagerMac.h: Added.
+        * platform/audio/mac/MediaSessionManagerMac.mm: Added.
+        (WebCore::PlatformMediaSessionManager::sharedManager):
+        (WebCore::PlatformMediaSessionManager::sharedManagerIfExists):
+        (WebCore::MediaSessionManagerMac::MediaSessionManagerMac):
+        (WebCore::MediaSessionManagerMac::~MediaSessionManagerMac):
+        (WebCore::MediaSessionManagerMac::sessionWillBeginPlayback):
+        (WebCore::MediaSessionManagerMac::removeSession):
+        (WebCore::MediaSessionManagerMac::sessionWillEndPlayback):
+        (WebCore::MediaSessionManagerMac::clientCharacteristicsChanged):
+        (WebCore::MediaSessionManagerMac::nowPlayingEligibleSession):
+        (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
+        * platform/cocoa/SoftLinking.h:
+        * platform/mac/MediaRemoteSoftLink.cpp: Added.
+        * platform/mac/MediaRemoteSoftLink.h: Added.
+        * platform/mac/RemoteCommandListenerMac.h: Added.
+        (WebCore::RemoteCommandListenerMac::createWeakPtr):
+        * platform/mac/RemoteCommandListenerMac.mm: Added.
+        (WebCore::RemoteCommandListener::create):
+        (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
+        (WebCore::RemoteCommandListenerMac::~RemoteCommandListenerMac):
+        * platform/spi/mac/MediaRemoteSPI.h: Added.
+
 2016-06-29  Jer Noble  <jer.noble@apple.com>
 
         Cannot clear a MediaSource SourceBuffer in Safari 9 and WebKit nightly
index 9deb61e3f0c71c1ddaec245eb7edcae625ce1a37..685d4332bbbe8d806833a2114a78f8952323b4ab 100644 (file)
                07E3DFD11A9E786500764CA8 /* MediaPlaybackTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
                07E9E12E18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h in Headers */ = {isa = PBXBuildFile; fileRef = 07E9E12D18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h */; };
                07E9E13018F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */; };
-               07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.cpp */; };
+               07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */; };
                07EE76EB1BE96DB000F89133 /* MockRealtimeVideoSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07EE76E91BE96DB000F89133 /* MockRealtimeVideoSource.cpp */; };
                07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */; };
                07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; };
                CD641EB41818F5ED00EE4C41 /* SourceBufferPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */; };
                CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */; };
                CD641EC01819B36000EE4C41 /* MediaTimeAVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EBE1819B35900EE4C41 /* MediaTimeAVFoundation.h */; };
+               CD669D681D23364B004D1866 /* MediaSessionManagerCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */; };
                CD7D33431C7A123F00041293 /* PixelBufferConformerCV.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD7D33411C7A123F00041293 /* PixelBufferConformerCV.cpp */; };
                CD7D33441C7A123F00041293 /* PixelBufferConformerCV.h in Headers */ = {isa = PBXBuildFile; fileRef = CD7D33421C7A123F00041293 /* PixelBufferConformerCV.h */; };
                CD7D33471C7A16BF00041293 /* CoreVideoSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD7D33451C7A16BF00041293 /* CoreVideoSoftLink.cpp */; };
                CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */; };
                CD8A7BBB197735FE00CBD643 /* AudioSourceProviderAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8A7BB9197735FE00CBD643 /* AudioSourceProviderAVFObjC.mm */; };
                CD8A7BBC197735FE00CBD643 /* AudioSourceProviderAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8A7BBA197735FE00CBD643 /* AudioSourceProviderAVFObjC.h */; };
+               CD8ACA881D237AA200ECC59E /* RemoteCommandListenerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8ACA861D237AA200ECC59E /* RemoteCommandListenerMac.mm */; };
+               CD8ACA891D237AA200ECC59E /* RemoteCommandListenerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8ACA871D237AA200ECC59E /* RemoteCommandListenerMac.h */; };
+               CD8ACA8B1D23946400ECC59E /* MediaRemoteSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8ACA8A1D23946400ECC59E /* MediaRemoteSPI.h */; };
+               CD8ACA8E1D23971900ECC59E /* MediaRemoteSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD8ACA8C1D23971900ECC59E /* MediaRemoteSoftLink.cpp */; };
+               CD8ACA8F1D23971900ECC59E /* MediaRemoteSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8ACA8D1D23971900ECC59E /* MediaRemoteSoftLink.h */; };
                CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm */; };
                CD8B5A43180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */; };
                CD8B5A46180DFF4E008B8E65 /* VideoTrackMediaSource.h in Headers */ = {isa = PBXBuildFile; fileRef = CD8B5A45180DFF4E008B8E65 /* VideoTrackMediaSource.h */; };
                07E3DFD01A9E786500764CA8 /* MediaPlaybackTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaPlaybackTarget.h; sourceTree = "<group>"; };
                07E9E12D18F5E2760011A3A4 /* InbandMetadataTextTrackPrivateAVF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InbandMetadataTextTrackPrivateAVF.h; sourceTree = "<group>"; };
                07E9E12F18F62B370011A3A4 /* InbandMetadataTextTrackPrivateAVF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InbandMetadataTextTrackPrivateAVF.cpp; sourceTree = "<group>"; };
-               07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaSessionManagerMac.cpp; sourceTree = "<group>"; };
+               07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSessionManagerMac.mm; sourceTree = "<group>"; };
                07EE76E91BE96DB000F89133 /* MockRealtimeVideoSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockRealtimeVideoSource.cpp; sourceTree = "<group>"; };
                07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeVideoSource.h; sourceTree = "<group>"; };
                07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeVideoSourceMac.h; sourceTree = "<group>"; };
                CD641EBD1819B35900EE4C41 /* MediaTimeAVFoundation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTimeAVFoundation.cpp; sourceTree = "<group>"; };
                CD641EBE1819B35900EE4C41 /* MediaTimeAVFoundation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaTimeAVFoundation.h; sourceTree = "<group>"; };
                CD641EC7181ED60100EE4C41 /* MediaSample.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaSample.h; sourceTree = "<group>"; };
+               CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MediaSessionManagerCocoa.cpp; path = cocoa/MediaSessionManagerCocoa.cpp; sourceTree = "<group>"; };
+               CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSessionManagerMac.h; sourceTree = "<group>"; };
                CD7D33411C7A123F00041293 /* PixelBufferConformerCV.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PixelBufferConformerCV.cpp; path = ../cv/PixelBufferConformerCV.cpp; sourceTree = "<group>"; };
                CD7D33421C7A123F00041293 /* PixelBufferConformerCV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PixelBufferConformerCV.h; path = ../cv/PixelBufferConformerCV.h; sourceTree = "<group>"; };
                CD7D33451C7A16BF00041293 /* CoreVideoSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CoreVideoSoftLink.cpp; sourceTree = "<group>"; };
                CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; };
                CD8A7BB9197735FE00CBD643 /* AudioSourceProviderAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AudioSourceProviderAVFObjC.mm; sourceTree = "<group>"; };
                CD8A7BBA197735FE00CBD643 /* AudioSourceProviderAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioSourceProviderAVFObjC.h; sourceTree = "<group>"; };
+               CD8ACA861D237AA200ECC59E /* RemoteCommandListenerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteCommandListenerMac.mm; sourceTree = "<group>"; };
+               CD8ACA871D237AA200ECC59E /* RemoteCommandListenerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCommandListenerMac.h; sourceTree = "<group>"; };
+               CD8ACA8A1D23946400ECC59E /* MediaRemoteSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRemoteSPI.h; sourceTree = "<group>"; };
+               CD8ACA8C1D23971900ECC59E /* MediaRemoteSoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaRemoteSoftLink.cpp; sourceTree = "<group>"; };
+               CD8ACA8D1D23971900ECC59E /* MediaRemoteSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaRemoteSoftLink.h; sourceTree = "<group>"; };
                CD8B5A40180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoTrackPrivateMediaSourceAVFObjC.mm; sourceTree = "<group>"; };
                CD8B5A41180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoTrackPrivateMediaSourceAVFObjC.h; sourceTree = "<group>"; };
                CD8B5A44180DD8D6008B8E65 /* VideoTrackMediaSource.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = VideoTrackMediaSource.idl; sourceTree = "<group>"; };
                                06E81ED60AB5D5E900C87837 /* LocalCurrentGraphicsContext.h */,
                                06E81EEB0AB5DA9700C87837 /* LocalCurrentGraphicsContext.mm */,
                                1402645D0AFDC19B005919E2 /* LoggingMac.mm */,
+                               CD8ACA8C1D23971900ECC59E /* MediaRemoteSoftLink.cpp */,
+                               CD8ACA8D1D23971900ECC59E /* MediaRemoteSoftLink.h */,
                                93500F3113FDE3BE0099EC24 /* NSScrollerImpDetails.h */,
                                52F52E1014A0134F00ACC397 /* NSScrollerImpDetails.mm */,
                                4B2709810AF2E5E00065127F /* PasteboardMac.mm */,
                                4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */,
                                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */,
                                0081FEFE16B0A2B6008AAA7A /* PublicSuffixMac.mm */,
+                               CD8ACA861D237AA200ECC59E /* RemoteCommandListenerMac.mm */,
+                               CD8ACA871D237AA200ECC59E /* RemoteCommandListenerMac.h */,
                                BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */,
                                BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */,
                                BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */,
                                07F0B97B1AC5DB4600E535D9 /* AVFoundationSPI.h */,
                                2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
                                2D413F601A187A3F0041A521 /* LookupSPI.h */,
+                               CD8ACA8A1D23946400ECC59E /* MediaRemoteSPI.h */,
                                2D77AC261BF2B9860072470A /* NSAccessibilitySPI.h */,
                                2D77AC271BF2B9860072470A /* NSApplicationSPI.h */,
                                2DB9C4A91B3231F40070F27F /* NSEventSPI.h */,
                        name = MediaSource;
                        sourceTree = "<group>";
                };
+               CD669D651D232DF4004D1866 /* cocoa */ = {
+                       isa = PBXGroup;
+                       children = (
+                               CD669D661D232DFF004D1866 /* MediaSessionManagerCocoa.cpp */,
+                       );
+                       name = cocoa;
+                       sourceTree = "<group>";
+               };
                CD9A37F517C7D93600C5FA7A /* mediacontrols */ = {
                        isa = PBXGroup;
                        children = (
                FD31604012B026A300C1A359 /* audio */ = {
                        isa = PBXGroup;
                        children = (
+                               CD669D651D232DF4004D1866 /* cocoa */,
                                CD0EEE0D14743E48003EAFA2 /* ios */,
                                FD3160B012B0270700C1A359 /* mac */,
                                FD31604412B026F700C1A359 /* AudioArray.h */,
                                CDC734121977896C0046BFC5 /* CARingBuffer.cpp */,
                                CDC734131977896C0046BFC5 /* CARingBuffer.h */,
                                FD3160BA12B0272A00C1A359 /* FFTFrameMac.cpp */,
-                               07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.cpp */,
+                               07EDC3ED1AACB75D00983EB5 /* MediaSessionManagerMac.mm */,
+                               CD669D671D232E10004D1866 /* MediaSessionManagerMac.h */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                93F199E508245E59001E9ABC /* HTMLCanvasElement.h in Headers */,
                                A8DF3FD0097FA0FC0052981B /* HTMLCollection.h in Headers */,
                                977B3865122883E900B81FF8 /* HTMLConstructionSite.h in Headers */,
+                               CD8ACA8F1D23971900ECC59E /* MediaRemoteSoftLink.h in Headers */,
                                7C3E510A18DF8F3500C112F7 /* HTMLConverter.h in Headers */,
                                83120C711C56F3FB001CB112 /* HTMLDataElement.h in Headers */,
                                F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */,
                                9BDA64D81B975CF2009C4387 /* JSShadowRoot.h in Headers */,
                                CD9DE17B17AAC75B00EA386D /* JSSourceBuffer.h in Headers */,
                                CD9DE17D17AAC75B00EA386D /* JSSourceBufferList.h in Headers */,
+                               CD8ACA8B1D23946400ECC59E /* MediaRemoteSPI.h in Headers */,
                                076306E117E16089005A7C4E /* JSSourceInfo.h in Headers */,
                                AA7FEEAD16A4E74B004C0C33 /* JSSpeechSynthesis.h in Headers */,
                                AA2A5AD216A4860A00976A25 /* JSSpeechSynthesisEvent.h in Headers */,
                                CDC979F51C498C0900DB50D4 /* WebCoreNSErrorExtras.h in Headers */,
                                934D9BA70B8C1175007B42A9 /* WebCoreNSStringExtras.h in Headers */,
                                C5B4C24D1509236C00A6EF37 /* WebCoreNSURLExtras.h in Headers */,
+                               CD8ACA891D237AA200ECC59E /* RemoteCommandListenerMac.h in Headers */,
                                CD225C0C1C46FBF400140761 /* WebCoreNSURLSession.h in Headers */,
                                DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */,
                                EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */,
                                BC772B3D0C4EA91E0083285F /* CSSParser.cpp in Sources */,
                                BC02A5400E099C5A004B6D2B /* CSSParserValues.cpp in Sources */,
                                977B3862122883E900B81FF8 /* CSSPreloadScanner.cpp in Sources */,
+                               CD669D681D23364B004D1866 /* MediaSessionManagerCocoa.cpp in Sources */,
                                A80E6D050A1989CA007FB8C5 /* CSSPrimitiveValue.cpp in Sources */,
                                A80E6CF70A1989CA007FB8C5 /* CSSProperty.cpp in Sources */,
                                78D02BC5154A18DF00B62D05 /* CSSPropertyAnimation.cpp in Sources */,
                                C96F5EC61B5872260091EA9D /* MediaSessionInterruptionProviderMac.mm in Sources */,
                                C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */,
                                07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
-                               07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.cpp in Sources */,
+                               07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.mm in Sources */,
                                CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,
                                CDC8B5A6180474F70016E685 /* MediaSourcePrivateAVFObjC.mm in Sources */,
                                CD61FE671794AADB004101EB /* MediaSourceRegistry.cpp in Sources */,
                                1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */,
                                1A569D160D7E2B82007C3983 /* objc_instance.mm in Sources */,
                                1A569D180D7E2B82007C3983 /* objc_runtime.mm in Sources */,
+                               CD8ACA881D237AA200ECC59E /* RemoteCommandListenerMac.mm in Sources */,
                                1A569D1A0D7E2B82007C3983 /* objc_utility.mm in Sources */,
                                1CF6BDFB0E9BB26A0025E1CD /* ObjCEventListener.mm in Sources */,
                                1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */,
                                7AA3A699194A64E7001CBD24 /* TileController.cpp in Sources */,
                                1F72BF0A187FD4490009BCB3 /* TileControllerMemoryHandlerIOS.cpp in Sources */,
                                7AA3A6A3194B5C22001CBD24 /* TileCoverageMap.cpp in Sources */,
+                               CD8ACA8E1D23971900ECC59E /* MediaRemoteSoftLink.cpp in Sources */,
                                7AA3A69B194A64E7001CBD24 /* TileGrid.cpp in Sources */,
                                498770F21242C535002226BA /* TilingData.cpp in Sources */,
                                F55B3DDB1251F12D003EF269 /* TimeInputType.cpp in Sources */,
index 7c5553f57c6195d5097f3d8a57827a6e5160839c..038d794de6474675d629d873b4e15c087f13b616 100644 (file)
@@ -28,7 +28,7 @@
 
 namespace WebCore {
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS) && !PLATFORM(MAC)
 std::unique_ptr<RemoteCommandListener> RemoteCommandListener::create(RemoteCommandListenerClient& client)
 {
     return std::make_unique<RemoteCommandListener>(client);
index c10e7d4c7e05400a4754024d297679fa7d9f35a5..9724bc5b7b77bf0a9abe9796641152bda5271188 100644 (file)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-#if !PLATFORM(IOS)
+#if !PLATFORM(IOS) && !PLATFORM(MAC)
 static PlatformMediaSessionManager* platformMediaSessionManager = nullptr;
 
 PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager()
similarity index 98%
rename from Source/WebCore/platform/audio/mac/MediaSessionManagerMac.cpp
rename to Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp
index 7731a622eb23149653800755bc304133b8ca8f11..3462f130e164913897db82868b57432a9163c27e 100644 (file)
@@ -65,8 +65,7 @@ void PlatformMediaSessionManager::updateSessionState()
             AudioSession::sharedSession().setCategory(AudioSession::MediaPlayback);
         else
             AudioSession::sharedSession().setCategory(AudioSession::AmbientSound);
-    }
-    else if (has(PlatformMediaSession::WebAudio))
+    } else if (has(PlatformMediaSession::WebAudio))
         AudioSession::sharedSession().setCategory(AudioSession::AmbientSound);
 #endif
 }
diff --git a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.h
new file mode 100644 (file)
index 0000000..795212b
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC)
+
+#include "PlatformMediaSessionManager.h"
+#include <wtf/RetainPtr.h>
+
+namespace WebCore {
+
+class MediaSessionManagerMac : public PlatformMediaSessionManager {
+public:
+    virtual ~MediaSessionManagerMac();
+
+private:
+    friend class PlatformMediaSessionManager;
+
+    MediaSessionManagerMac();
+
+    void removeSession(PlatformMediaSession&) override;
+
+    bool sessionWillBeginPlayback(PlatformMediaSession&) override;
+    void sessionWillEndPlayback(PlatformMediaSession&) override;
+    void clientCharacteristicsChanged(PlatformMediaSession&) override;
+
+    void updateNowPlayingInfo();
+
+    PlatformMediaSession* nowPlayingEligibleSession();
+
+    double m_reportedRate { 0 };
+    double m_reportedDuration { 0 };
+    String m_reportedTitle;
+    bool m_nowPlayingActive { false };
+    bool m_isInBackground { false };
+};
+
+} // namespace WebCore
+
+#endif // PLATFORM(MAC)
diff --git a/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm b/Source/WebCore/platform/audio/mac/MediaSessionManagerMac.mm
new file mode 100644 (file)
index 0000000..fbe2dc7
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "MediaSessionManagerMac.h"
+
+#if PLATFORM(MAC)
+
+#import "Logging.h"
+#import "MediaPlayer.h"
+#import "PlatformMediaSession.h"
+
+#import "MediaRemoteSoftLink.h"
+
+using namespace WebCore;
+
+namespace WebCore {
+
+static MediaSessionManagerMac* platformMediaSessionManager = nullptr;
+
+PlatformMediaSessionManager& PlatformMediaSessionManager::sharedManager()
+{
+    if (!platformMediaSessionManager)
+        platformMediaSessionManager = new MediaSessionManagerMac;
+    return *platformMediaSessionManager;
+}
+
+PlatformMediaSessionManager* PlatformMediaSessionManager::sharedManagerIfExists()
+{
+    return platformMediaSessionManager;
+}
+
+MediaSessionManagerMac::MediaSessionManagerMac()
+    : PlatformMediaSessionManager()
+{
+    resetRestrictions();
+}
+
+MediaSessionManagerMac::~MediaSessionManagerMac()
+{
+}
+
+bool MediaSessionManagerMac::sessionWillBeginPlayback(PlatformMediaSession& session)
+{
+    if (!PlatformMediaSessionManager::sessionWillBeginPlayback(session))
+        return false;
+
+    LOG(Media, "MediaSessionManagerMac::sessionWillBeginPlayback");
+    updateNowPlayingInfo();
+    return true;
+}
+
+void MediaSessionManagerMac::removeSession(PlatformMediaSession& session)
+{
+    PlatformMediaSessionManager::removeSession(session);
+    LOG(Media, "MediaSessionManagerMac::removeSession");
+    updateNowPlayingInfo();
+}
+
+void MediaSessionManagerMac::sessionWillEndPlayback(PlatformMediaSession& session)
+{
+    PlatformMediaSessionManager::sessionWillEndPlayback(session);
+    LOG(Media, "MediaSessionManagerMac::sessionWillEndPlayback");
+    updateNowPlayingInfo();
+}
+
+void MediaSessionManagerMac::clientCharacteristicsChanged(PlatformMediaSession&)
+{
+    LOG(Media, "MediaSessionManagerMac::clientCharacteristicsChanged");
+    updateNowPlayingInfo();
+}
+
+PlatformMediaSession* MediaSessionManagerMac::nowPlayingEligibleSession()
+{
+    for (auto session : sessions()) {
+        PlatformMediaSession::MediaType type = session->mediaType();
+        if (type != PlatformMediaSession::Video && type != PlatformMediaSession::Audio)
+            continue;
+
+        if (session->characteristics() & PlatformMediaSession::HasAudio)
+            return session;
+    }
+
+    return nullptr;
+}
+
+void MediaSessionManagerMac::updateNowPlayingInfo()
+{
+#if USE(MEDIAREMOTE)
+    if (!isMediaRemoteFrameworkAvailable())
+        return;
+
+    if (!MRMediaRemoteSetCanBeNowPlayingApplication(true)) {
+        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetCanBeNowPlayingApplication(true) failed");
+        return;
+    }
+
+    const PlatformMediaSession* currentSession = this->nowPlayingEligibleSession();
+
+    LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - currentSession = %p", currentSession);
+
+    if (!currentSession) {
+        if (m_nowPlayingActive) {
+            LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - clearing now playing info");
+            MRMediaRemoteSetNowPlayingInfo(nullptr);
+            m_nowPlayingActive = false;
+            MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), kMRPlaybackStateStopped, dispatch_get_main_queue(), ^(MRMediaRemoteError error) {
+                LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(stopped) failed with error %ud", error);
+            });
+        }
+
+        return;
+    }
+
+    String title = currentSession->title();
+    double duration = currentSession->duration();
+    double rate = currentSession->state() == PlatformMediaSession::Playing ? 1 : 0;
+    if (m_reportedTitle == title && m_reportedRate == rate && m_reportedDuration == duration) {
+        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - nothing new to show");
+        return;
+    }
+
+    m_reportedRate = rate;
+    m_reportedDuration = duration;
+    m_reportedTitle = title;
+
+    auto info = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 4, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+
+    if (!title.isEmpty())
+        CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoTitle, title.createCFString().get());
+
+    if (std::isfinite(duration) && duration != MediaPlayer::invalidTime()) {
+        auto cfDuration = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &duration));
+        CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoDuration, cfDuration.get());
+    }
+
+    auto cfRate = CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &rate);
+    CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoPlaybackRate, cfRate);
+
+    double currentTime = currentSession->currentTime();
+    if (std::isfinite(currentTime) && currentTime != MediaPlayer::invalidTime()) {
+        auto cfCurrentTime = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberDoubleType, &currentTime));
+        CFDictionarySetValue(info.get(), kMRMediaRemoteNowPlayingInfoElapsedTime, cfCurrentTime.get());
+    }
+
+    LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - title = \"%s\", rate = %f, duration = %f, now = %f",
+        title.utf8().data(), rate, duration, currentTime);
+
+    m_nowPlayingActive = true;
+    MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MRMediaRemoteGetLocalOrigin(), kMRPlaybackStatePlaying, dispatch_get_main_queue(), ^(MRMediaRemoteError error) {
+        LOG(Media, "MediaSessionManagerMac::updateNowPlayingInfo - MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(playing) failed with error %ud", error);
+    });
+    MRMediaRemoteSetNowPlayingInfo(info.get());
+#endif
+}
+
+} // namespace WebCore
+
+#endif // PLATFORM(MAC)
index 802fdd10d046fed62e17b4034a20d6d1bc0ee63c..b1a03c1ceeed1bf255fc1b37398432de514b70d7 100644 (file)
     } \
     }
 
+#define SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(functionNamespace, framework) \
+    namespace functionNamespace { \
+    void* framework##Library(bool isOptional = false); \
+    void* framework##Library(bool isOptional) \
+    { \
+        static void* frameworkLibrary; \
+        static dispatch_once_t once; \
+        dispatch_once(&once, ^{ \
+            frameworkLibrary = dlopen("/System/Library/PrivateFrameworks/" #framework ".framework/" #framework, RTLD_NOW); \
+            if (!isOptional) \
+                RELEASE_ASSERT_WITH_MESSAGE(frameworkLibrary, "%s", dlerror()); \
+        }); \
+        return frameworkLibrary; \
+    } \
+    }
+
 #define SOFT_LINK_CLASS_FOR_HEADER(functionNamespace, framework, className) \
     @class className; \
     namespace functionNamespace { \
diff --git a/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp b/Source/WebCore/platform/mac/MediaRemoteSoftLink.cpp
new file mode 100644 (file)
index 0000000..79aee13
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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"
+
+#if USE(MEDIAREMOTE)
+
+#include "MediaRemoteSPI.h"
+#include "SoftLinking.h"
+
+SOFT_LINK_PRIVATE_FRAMEWORK_FOR_SOURCE(WebCore, MediaRemote)
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteGetLocalOrigin, MROriginRef, (), ())
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteAddAsyncCommandHandlerBlock, void*, (MRMediaRemoteAsyncCommandHandlerBlock block), (block))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteRemoveCommandHandlerBlock, void, (void* observer), (observer))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetSupportedCommands, void, (CFArrayRef commands, MROriginRef origin, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError err)), (commands, origin, replyQ, completion))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteCommandInfoCreate, MRMediaRemoteCommandInfoRef, (CFAllocatorRef allocator), (allocator));
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetCommand, void, (MRMediaRemoteCommandInfoRef commandInfo, MRMediaRemoteCommand command), (commandInfo, command))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetEnabled, void, (MRMediaRemoteCommandInfoRef commandInfo, Boolean enabled), (commandInfo, enabled))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetOptions, void, (MRMediaRemoteCommandInfoRef commandInfo, CFDictionaryRef options), (commandInfo, options))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetCanBeNowPlayingApplication, Boolean, (Boolean flag), (flag))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingInfo, void, (CFDictionaryRef info), (info))
+SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoElapsedTime, CFStringRef);
+SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef);
+
+#endif // USE(MEDIAREMOTE)
diff --git a/Source/WebCore/platform/mac/MediaRemoteSoftLink.h b/Source/WebCore/platform/mac/MediaRemoteSoftLink.h
new file mode 100644 (file)
index 0000000..2160363
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if USE(MEDIAREMOTE)
+
+#include "MediaRemoteSPI.h"
+#include "SoftLinking.h"
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, MediaRemote)
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteGetLocalOrigin, MROriginRef, (), ())
+#define MRMediaRemoteGetLocalOrigin softLink_MediaRemote_MRMediaRemoteGetLocalOrigin
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteAddAsyncCommandHandlerBlock, void*, (MRMediaRemoteAsyncCommandHandlerBlock block), (block))
+#define MRMediaRemoteAddAsyncCommandHandlerBlock softLink_MediaRemote_MRMediaRemoteAddAsyncCommandHandlerBlock
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteRemoveCommandHandlerBlock, void, (void* observer), (observer))
+#define MRMediaRemoteRemoveCommandHandlerBlock softLink_MediaRemote_MRMediaRemoteRemoveCommandHandlerBlock
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetSupportedCommands, void, (CFArrayRef commands, MROriginRef origin, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError err)), (commands, origin, replyQ, completion))
+#define MRMediaRemoteSetSupportedCommands softLink_MediaRemote_MRMediaRemoteSetSupportedCommands
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteCommandInfoCreate, MRMediaRemoteCommandInfoRef, (CFAllocatorRef allocator), (allocator));
+#define MRMediaRemoteCommandInfoCreate softLink_MediaRemote_MRMediaRemoteCommandInfoCreate
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetCommand, void, (MRMediaRemoteCommandInfoRef commandInfo, MRMediaRemoteCommand command), (commandInfo, command))
+#define MRMediaRemoteCommandInfoSetCommand softLink_MediaRemote_MRMediaRemoteCommandInfoSetCommand
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetEnabled, void, (MRMediaRemoteCommandInfoRef commandInfo, Boolean enabled), (commandInfo, enabled))
+#define MRMediaRemoteCommandInfoSetEnabled softLink_MediaRemote_MRMediaRemoteCommandInfoSetEnabled
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteCommandInfoSetOptions, void, (MRMediaRemoteCommandInfoRef commandInfo, CFDictionaryRef options), (commandInfo, options))
+#define MRMediaRemoteCommandInfoSetOptions softLink_MediaRemote_MRMediaRemoteCommandInfoSetOptions
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetCanBeNowPlayingApplication, Boolean, (Boolean flag), (flag))
+#define MRMediaRemoteSetCanBeNowPlayingApplication softLink_MediaRemote_MRMediaRemoteSetCanBeNowPlayingApplication
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingInfo, void, (CFDictionaryRef info), (info))
+#define MRMediaRemoteSetNowPlayingInfo softLink_MediaRemote_MRMediaRemoteSetNowPlayingInfo
+SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, MediaRemote, MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin, void, (MROriginRef origin, MRPlaybackState playbackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError)), (origin, playbackState, replyQ, completion))
+#define MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin softLink_MediaRemote_MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin
+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoTitle, CFStringRef);
+#define kMRMediaRemoteNowPlayingInfoTitle get_MediaRemote_kMRMediaRemoteNowPlayingInfoTitle()
+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoDuration, CFStringRef);
+#define kMRMediaRemoteNowPlayingInfoDuration get_MediaRemote_kMRMediaRemoteNowPlayingInfoDuration()
+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoElapsedTime, CFStringRef);
+#define kMRMediaRemoteNowPlayingInfoElapsedTime get_MediaRemote_kMRMediaRemoteNowPlayingInfoElapsedTime()
+SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, MediaRemote, kMRMediaRemoteNowPlayingInfoPlaybackRate, CFStringRef);
+#define kMRMediaRemoteNowPlayingInfoPlaybackRate get_MediaRemote_kMRMediaRemoteNowPlayingInfoPlaybackRate()
+
+#endif // USE(MEDIAREMOTE)
diff --git a/Source/WebCore/platform/mac/RemoteCommandListenerMac.h b/Source/WebCore/platform/mac/RemoteCommandListenerMac.h
new file mode 100644 (file)
index 0000000..1e938fb
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#include "RemoteCommandListener.h"
+
+#if PLATFORM(MAC)
+
+#include <wtf/RetainPtr.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+class RemoteCommandListenerMac : public RemoteCommandListener {
+public:
+    RemoteCommandListenerMac(RemoteCommandListenerClient&);
+    virtual ~RemoteCommandListenerMac();
+
+protected:
+    WeakPtr<RemoteCommandListenerMac> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
+
+    WeakPtrFactory<RemoteCommandListenerMac> m_weakPtrFactory { this };
+    void* m_commandHandler { nullptr };
+};
+    
+}
+
+#endif // PLATFORM(MAC)
diff --git a/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm b/Source/WebCore/platform/mac/RemoteCommandListenerMac.mm
new file mode 100644 (file)
index 0000000..f6b2673
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "RemoteCommandListenerMac.h"
+
+#if PLATFORM(MAC)
+
+#import "Logging.h"
+#import <wtf/MainThread.h>
+
+#import "MediaRemoteSoftLink.h"
+
+namespace WebCore {
+
+std::unique_ptr<RemoteCommandListener> RemoteCommandListener::create(RemoteCommandListenerClient& client)
+{
+    return std::make_unique<RemoteCommandListenerMac>(client);
+}
+
+RemoteCommandListenerMac::RemoteCommandListenerMac(RemoteCommandListenerClient& client)
+    : RemoteCommandListener(client)
+{
+#if USE(MEDIAREMOTE)
+    if (!isMediaRemoteFrameworkAvailable())
+        return;
+
+    static const MRMediaRemoteCommand supportedCommands[] = {
+        MRMediaRemoteCommandPlay,
+        MRMediaRemoteCommandPause,
+        MRMediaRemoteCommandTogglePlayPause,
+        MRMediaRemoteCommandBeginFastForward,
+        MRMediaRemoteCommandEndFastForward,
+        MRMediaRemoteCommandBeginRewind,
+        MRMediaRemoteCommandEndRewind,
+    };
+
+    auto commandInfoArray = adoptCF(CFArrayCreateMutable(kCFAllocatorDefault, sizeof(supportedCommands) / sizeof(MRMediaRemoteCommand), &kCFTypeArrayCallBacks));
+
+    for (auto command : supportedCommands) {
+        auto commandInfo = adoptCF(MRMediaRemoteCommandInfoCreate(kCFAllocatorDefault));
+        MRMediaRemoteCommandInfoSetCommand(commandInfo.get(), command);
+        MRMediaRemoteCommandInfoSetEnabled(commandInfo.get(), true);
+        CFArrayAppendValue(commandInfoArray.get(), commandInfo.get());
+    }
+
+    MRMediaRemoteSetSupportedCommands(commandInfoArray.get(), MRMediaRemoteGetLocalOrigin(), nullptr, nullptr);
+
+    auto weakThis = createWeakPtr();
+    m_commandHandler = MRMediaRemoteAddAsyncCommandHandlerBlock(^(MRMediaRemoteCommand command, CFDictionaryRef options, void(^completion)(CFArrayRef)) {
+        UNUSED_PARAM(options);
+
+        PlatformMediaSession::RemoteControlCommandType platformCommand { PlatformMediaSession::NoCommand };
+
+        switch (command) {
+        case MRMediaRemoteCommandPlay:
+            platformCommand = PlatformMediaSession::PlayCommand;
+            break;
+        case MRMediaRemoteCommandPause:
+            platformCommand = PlatformMediaSession::PauseCommand;
+            break;
+        case MRMediaRemoteCommandTogglePlayPause:
+            platformCommand = PlatformMediaSession::TogglePlayPauseCommand;
+            break;
+        case MRMediaRemoteCommandBeginFastForward:
+            platformCommand = PlatformMediaSession::BeginSeekingForwardCommand;
+            break;
+        case MRMediaRemoteCommandEndFastForward:
+            platformCommand = PlatformMediaSession::EndSeekingForwardCommand;
+            break;
+        case MRMediaRemoteCommandBeginRewind:
+            platformCommand = PlatformMediaSession::BeginSeekingBackwardCommand;
+            break;
+        case MRMediaRemoteCommandEndRewind:
+            platformCommand = PlatformMediaSession::EndSeekingBackwardCommand;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        };
+
+        if (!weakThis)
+            return;
+        weakThis->m_client.didReceiveRemoteControlCommand(platformCommand);
+        completion(static_cast<CFArrayRef>(@[@0]));
+    });
+#endif // USE(MEDIAREMOTE)
+}
+
+RemoteCommandListenerMac::~RemoteCommandListenerMac()
+{
+#if USE(MEDIAREMOTE)
+    if (m_commandHandler)
+        MRMediaRemoteRemoveCommandHandlerBlock(m_commandHandler);
+#endif
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/spi/mac/MediaRemoteSPI.h b/Source/WebCore/platform/spi/mac/MediaRemoteSPI.h
new file mode 100644 (file)
index 0000000..d5d138f
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2016 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#pragma once
+
+#if USE(MEDIAREMOTE)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <MediaRemote/MediaRemote.h>
+
+#else
+
+enum {
+    MRMediaRemoteCommandPlay,
+    MRMediaRemoteCommandPause,
+    MRMediaRemoteCommandTogglePlayPause,
+    MRMediaRemoteCommandStop,
+    MRMediaRemoteCommandNextTrack,
+    MRMediaRemoteCommandPreviousTrack,
+    MRMediaRemoteCommandAdvanceShuffleMode,
+    MRMediaRemoteCommandAdvanceRepeatMode,
+    MRMediaRemoteCommandBeginFastForward,
+    MRMediaRemoteCommandEndFastForward,
+    MRMediaRemoteCommandBeginRewind,
+    MRMediaRemoteCommandEndRewind,
+    MRMediaRemoteCommandRewind15Seconds,
+    MRMediaRemoteCommandFastForward15Seconds,
+    MRMediaRemoteCommandRewind30Seconds,
+    MRMediaRemoteCommandFastForward30Seconds,
+    MRMediaRemoteCommandToggleRecord,
+    MRMediaRemoteCommandSkipForward,
+    MRMediaRemoteCommandSkipBackward,
+    MRMediaRemoteCommandChangePlaybackRate,
+    MRMediaRemoteCommandRateTrack,
+    MRMediaRemoteCommandLikeTrack,
+    MRMediaRemoteCommandDislikeTrack,
+    MRMediaRemoteCommandBookmarkTrack,
+    MRMediaRemoteCommandSeekToPlaybackPosition,
+    MRMediaRemoteCommandChangeRepeatMode,
+    MRMediaRemoteCommandChangeShuffleMode,
+    MRMediaRemoteCommandEnableLanguageOption,
+    MRMediaRemoteCommandDisableLanguageOption
+};
+typedef uint32_t MRMediaRemoteCommand;
+
+enum {
+    kMRPlaybackStateUnknown = 0,
+    kMRPlaybackStatePlaying,
+    kMRPlaybackStatePaused,
+    kMRPlaybackStateStopped,
+    kMRPlaybackStateInterrupted
+};
+typedef uint32_t MRPlaybackState;
+
+typedef uint32_t MRMediaRemoteError;
+typedef struct _MROrigin *MROriginRef;
+typedef struct _MRMediaRemoteCommandInfo *MRMediaRemoteCommandInfoRef;
+typedef void(^MRMediaRemoteAsyncCommandHandlerBlock)(MRMediaRemoteCommand command, CFDictionaryRef options, void(^completion)(CFArrayRef));
+
+WTF_EXTERN_C_BEGIN
+
+#pragma mark - MRRemoteControl
+
+void* MRMediaRemoteAddAsyncCommandHandlerBlock(MRMediaRemoteAsyncCommandHandlerBlock);
+void MRMediaRemoteRemoveCommandHandlerBlock(void *observer);
+void MRMediaRemoteSetSupportedCommands(CFArrayRef commands, MROriginRef, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError err));
+
+#pragma mark - MROrigin
+
+MROriginRef MRMediaRemoteGetLocalOrigin();
+
+#pragma mark - MRCommandInfo
+
+MRMediaRemoteCommandInfoRef MRMediaRemoteCommandInfoCreate(CFAllocatorRef);
+void MRMediaRemoteCommandInfoSetCommand(MRMediaRemoteCommandInfoRef, MRMediaRemoteCommand);
+void MRMediaRemoteCommandInfoSetEnabled(MRMediaRemoteCommandInfoRef, Boolean);
+void MRMediaRemoteCommandInfoSetOptions(MRMediaRemoteCommandInfoRef, CFDictionaryRef);
+
+#pragma mark - MRNowPlaying
+
+Boolean MRMediaRemoteSetCanBeNowPlayingApplication(Boolean);
+void MRMediaRemoteSetNowPlayingApplicationPlaybackStateForOrigin(MROriginRef, MRPlaybackState, dispatch_queue_t replyQ, void(^completion)(MRMediaRemoteError));
+void MRMediaRemoteSetNowPlayingInfo(CFDictionaryRef);
+
+WTF_EXTERN_C_END
+
+#endif // USE(APPLE_INTERNAL_SDK)
+
+#endif // USE(MEDIAREMOTE)
index 1cfd56ceff6e21eb6059557639bb320c7cab95ec..b9d8fe9d1740c9321f7dc3a8aaff6516cf37ca53 100644 (file)
@@ -1,3 +1,14 @@
+2016-06-29  Jer Noble  <jer.noble@apple.com>
+
+        Adopt MediaRemote.
+        https://bugs.webkit.org/show_bug.cgi?id=159250
+
+        Reviewed by Eric Carlson.
+
+        Add a sandbox exception allowing access to the mediaremoted XPC service.
+
+        * WebProcess/com.apple.WebProcess.sb.in:
+
 2016-06-29  Alex Christensen  <achristensen@webkit.org>
 
         WKWebView should ask WKNavigationDelegate about bad ssl certificates
index f0e1e1d6371781770871bce92dc9775aa827989d..f7ba12effe0e4c67d133372fa1980465cc5f7850 100644 (file)
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
        (global-name "com.apple.nesessionmanager.flow-divert-token")
 #endif
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+       (global-name "com.apple.mediaremoted.xpc")
+#endif
 )
 
 ;; Security framework