Diff
Modified: trunk/Source/WebCore/ChangeLog (175399 => 175400)
--- trunk/Source/WebCore/ChangeLog 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/ChangeLog 2014-10-31 00:18:21 UTC (rev 175400)
@@ -1,3 +1,28 @@
+2014-10-30 Jer Noble <[email protected]>
+
+ [EME] Add Setting for accessing storage location for MediaKeys data
+ https://bugs.webkit.org/show_bug.cgi?id=138147
+
+ Reviewed by Brady Eidson.
+
+ Allow MediaPlayerPrivateAVFoundationObjC to query for the MediaKeys storage directory
+ by piping that request down from WebKit and WebKit2 into Settings.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaKeysStorageDirectory): Get the location from Settings and
+ append the current origin.
+ * html/HTMLMediaElement.h:
+ * page/Settings.h:
+ (WebCore::Settings::setMediaKeysStorageDirectory): Simple setter.
+ (WebCore::Settings::mediaKeysStorageDirectory): Simple accessor.
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::mediaKeysStorageDirectory): Pass through to m_client.
+ * platform/graphics/MediaPlayer.h:
+ (WebCore::MediaPlayerClient::mediaPlayerMediaKeysStorageDirectory): Default implementation.
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::streamSession): Fetch the location from MediaPlayer.
+ (WebCore::sessionStorageDirectory): Deleted.
+
2014-10-30 Dana Burkart <[email protected]>
<rdar://problem/18821260> Prepare for the mysterious future
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (175399 => 175400)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-10-31 00:18:21 UTC (rev 175400)
@@ -2195,6 +2195,23 @@
return true;
}
+String HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() const
+{
+ Settings* settings = document().settings();
+ if (!settings)
+ return emptyString();
+
+ String storageDirectory = settings->mediaKeysStorageDirectory();
+ if (storageDirectory.isEmpty())
+ return emptyString();
+
+ SecurityOrigin* origin = document().securityOrigin();
+ if (!origin)
+ return emptyString();
+
+ return pathByAppendingComponent(storageDirectory, origin->databaseIdentifier());
+}
+
void HTMLMediaElement::setMediaKeys(MediaKeys* mediaKeys)
{
if (m_mediaKeys == mediaKeys)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (175399 => 175400)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2014-10-31 00:18:21 UTC (rev 175400)
@@ -547,6 +547,7 @@
#if ENABLE(ENCRYPTED_MEDIA_V2)
virtual bool mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array*) override;
+ virtual String mediaPlayerMediaKeysStorageDirectory() const override;
#endif
#if ENABLE(IOS_AIRPLAY)
Modified: trunk/Source/WebCore/page/Settings.h (175399 => 175400)
--- trunk/Source/WebCore/page/Settings.h 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/page/Settings.h 2014-10-31 00:18:21 UTC (rev 175400)
@@ -267,6 +267,11 @@
static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
#endif
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+ WEBCORE_EXPORT void setMediaKeysStorageDirectory(const String& directory) { m_mediaKeysStorageDirectory = directory; }
+ const String& mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
+#endif
+
private:
explicit Settings(Page*);
@@ -346,6 +351,10 @@
WEBCORE_EXPORT static bool gManageAudioSession;
#endif
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+ String m_mediaKeysStorageDirectory;
+#endif
+
static double gHiddenPageDOMTimerAlignmentInterval;
static bool gLowPowerVideoAudioBufferSizeEnabled;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (175399 => 175400)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2014-10-31 00:18:21 UTC (rev 175400)
@@ -1121,6 +1121,11 @@
{
return m_client.mediaPlayerKeyNeeded(this, initData);
}
+
+String MediaPlayer::mediaKeysStorageDirectory() const
+{
+ return m_client.mediaPlayerMediaKeysStorageDirectory();
+}
#endif
String MediaPlayer::referrer() const
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (175399 => 175400)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2014-10-31 00:18:21 UTC (rev 175400)
@@ -215,6 +215,7 @@
#if ENABLE(ENCRYPTED_MEDIA_V2)
virtual bool mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array*) { return false; }
+ virtual String mediaPlayerMediaKeysStorageDirectory() const { return emptyString(); }
#endif
#if ENABLE(IOS_AIRPLAY)
@@ -516,6 +517,7 @@
#if ENABLE(ENCRYPTED_MEDIA_V2)
bool keyNeeded(Uint8Array* initData);
+ String mediaKeysStorageDirectory() const;
#endif
String referrer() const;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (175399 => 175400)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm 2014-10-31 00:18:21 UTC (rev 175400)
@@ -29,6 +29,7 @@
#if ENABLE(MEDIA_SOURCE) && USE(AVFOUNDATION)
#import "CDMSessionMediaSourceAVFObjC.h"
+#import "FileSystem.h"
#import "Logging.h"
#import "MediaSourcePrivateAVFObjC.h"
#import "MediaSourcePrivateClient.h"
@@ -674,29 +675,24 @@
}
#if ENABLE(ENCRYPTED_MEDIA_V2)
-static const String& sessionStorageDirectory()
-{
- static NeverDestroyed<String> sessionDirectoryPath;
-
- if (sessionDirectoryPath.get().isEmpty()) {
- char cacheDirectoryPath[PATH_MAX];
- if (!confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectoryPath, PATH_MAX))
- return WTF::emptyString();
-
- sessionDirectoryPath.get().append(String(cacheDirectoryPath, strlen(cacheDirectoryPath)));
- sessionDirectoryPath.get().append(ASCIILiteral("AVStreamSession/"));
- }
-
- return sessionDirectoryPath.get();
-}
-
AVStreamSession* MediaPlayerPrivateMediaSourceAVFObjC::streamSession()
{
if (!getAVStreamSessionClass() || ![getAVStreamSessionClass() instancesRespondToSelector:@selector(initWithStorageDirectoryAtURL:)])
return nil;
- if (!m_streamSession)
- m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:sessionStorageDirectory()]]);
+ if (!m_streamSession) {
+ String storageDirectory = m_player->mediaKeysStorageDirectory();
+ if (storageDirectory.isEmpty())
+ return nil;
+
+ if (!fileExists(storageDirectory)) {
+ if (!makeAllDirectories(storageDirectory))
+ return nil;
+ }
+
+ String storagePath = pathByAppendingComponent(storageDirectory, "SecureStop.plist");
+ m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
+ }
return m_streamSession.get();
}
Modified: trunk/Source/WebKit/mac/ChangeLog (175399 => 175400)
--- trunk/Source/WebKit/mac/ChangeLog 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-10-31 00:18:21 UTC (rev 175400)
@@ -1,3 +1,19 @@
+2014-10-30 Jer Noble <[email protected]>
+
+ [EME] Add Setting for accessing storage location for MediaKeys data
+ https://bugs.webkit.org/show_bug.cgi?id=138147
+
+ Reviewed by Brady Eidson.
+
+ * WebView/WebPreferenceKeysPrivate.h:
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]): Set default location.
+ (-[WebPreferences mediaKeysStorageDirectory]): Simple accessor.
+ (-[WebPreferences setMediaKeysStorageDirectory:]): Simple setter.
+ * WebView/WebPreferencesPrivate.h:
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChanged:]): Pass location from WebPreferences into Settings.
+
2014-10-30 Dana Burkart <[email protected]>
<rdar://problem/18821260> Prepare for the mysterious future
Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (175399 => 175400)
--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h 2014-10-31 00:18:21 UTC (rev 175400)
@@ -147,6 +147,7 @@
#define WebKitImageControlsEnabledPreferenceKey @"WebKitImageControlsEnabled"
#define WebKitGamepadsEnabledPreferenceKey @"WebKitGamepadsEnabled"
#define WebKitServiceControlsEnabledPreferenceKey @"WebKitServiceControlsEnabled"
+#define WebKitMediaKeysStorageDirectoryKey @"WebKitMediaKeysStorageDirectory"
#if !TARGET_OS_IPHONE
// These are private both because callers should be using the cover methods and because the
Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (175399 => 175400)
--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm 2014-10-31 00:18:21 UTC (rev 175400)
@@ -580,6 +580,9 @@
[NSNumber numberWithBool:NO], WebKitServiceControlsEnabledPreferenceKey,
#endif
[NSNumber numberWithBool:NO], WebKitEnableInheritURIQueryComponentPreferenceKey,
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+ @"~/Library/WebKit/MediaKeys", WebKitMediaKeysStorageDirectoryKey,
+#endif
nil];
#if !PLATFORM(IOS)
@@ -2465,6 +2468,16 @@
[self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
}
+- (NSString *)mediaKeysStorageDirectory
+{
+ return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
+}
+
+- (void)setMediaKeysStorageDirectory:(NSString *)directory
+{
+ [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
+}
+
@end
@implementation WebPreferences (WebInternal)
Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (175399 => 175400)
--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h 2014-10-31 00:18:21 UTC (rev 175400)
@@ -422,6 +422,9 @@
- (void)setGamepadsEnabled:(BOOL)flag;
- (BOOL)gamepadsEnabled;
+- (void)setMediaKeysStorageDirectory:(NSString *)directory;
+- (NSString *)mediaKeysStorageDirectory;
+
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < 80000
- (void)_setAllowCompositingLayerVisualDegradation:(BOOL)flag;
#endif
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (175399 => 175400)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2014-10-31 00:18:21 UTC (rev 175400)
@@ -2403,6 +2403,10 @@
[[self window] setAcceleratedDrawingEnabled:[preferences acceleratedDrawingEnabled]];
[WAKView _setInterpolationQuality:[preferences _interpolationQuality]];
#endif
+
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+ settings.setMediaKeysStorageDirectory([preferences mediaKeysStorageDirectory]);
+#endif
}
static inline IMP getMethod(id o, SEL s)
Modified: trunk/Source/WebKit2/ChangeLog (175399 => 175400)
--- trunk/Source/WebKit2/ChangeLog 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit2/ChangeLog 2014-10-31 00:18:21 UTC (rev 175400)
@@ -1,3 +1,13 @@
+2014-10-30 Jer Noble <[email protected]>
+
+ [EME] Add Setting for accessing storage location for MediaKeys data
+ https://bugs.webkit.org/show_bug.cgi?id=138147
+
+ Reviewed by Brady Eidson.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Pass from WebMediaKeyStorageManager into Settings.
+
2014-10-30 Dana Burkart <[email protected]>
Workaround for <rdar://problem/18830639>
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (175399 => 175400)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-10-31 00:16:12 UTC (rev 175399)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-10-31 00:18:21 UTC (rev 175400)
@@ -81,6 +81,7 @@
#include "WebInspectorMessages.h"
#include "WebInspectorUI.h"
#include "WebInspectorUIMessages.h"
+#include "WebMediaKeyStorageManager.h"
#include "WebNotificationClient.h"
#include "WebOpenPanelResultListener.h"
#include "WebPageCreationParameters.h"
@@ -474,6 +475,12 @@
for (auto& mimeType : parameters.mimeTypesWithCustomContentProviders)
m_mimeTypesWithCustomContentProviders.add(mimeType);
+
+
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+ if (WebMediaKeyStorageManager* manager = WebProcess::shared().supplement<WebMediaKeyStorageManager>())
+ m_page->settings().setMediaKeysStorageDirectory(manager->mediaKeyStorageDirectory());
+#endif
}
void WebPage::reinitializeWebPage(const WebPageCreationParameters& parameters)