<!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>[175400] trunk/Source</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/175400">175400</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2014-10-30 17:18:21 -0700 (Thu, 30 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[EME] Add Setting for accessing storage location for MediaKeys data
https://bugs.webkit.org/show_bug.cgi?id=138147

Reviewed by Brady Eidson.

Source/WebCore:

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.

Source/WebKit/mac:

* 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.

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Pass from WebMediaKeyStorageManager into Settings.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCorepageSettingsh">trunk/Source/WebCore/page/Settings.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayercpp">trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsMediaPlayerh">trunk/Source/WebCore/platform/graphics/MediaPlayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCmm">trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesmm">trunk/Source/WebKit/mac/WebView/WebPreferences.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebPreferencesPrivateh">trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-10-30  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-10-30  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/18821260&gt; Prepare for the mysterious future
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2195,6 +2195,23 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+String HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() const
+{
+    Settings* settings = document().settings();
+    if (!settings)
+        return emptyString();
+
+    String storageDirectory = settings-&gt;mediaKeysStorageDirectory();
+    if (storageDirectory.isEmpty())
+        return emptyString();
+
+    SecurityOrigin* origin = document().securityOrigin();
+    if (!origin)
+        return emptyString();
+
+    return pathByAppendingComponent(storageDirectory, origin-&gt;databaseIdentifier());
+}
+
</ins><span class="cx"> void HTMLMediaElement::setMediaKeys(MediaKeys* mediaKeys)
</span><span class="cx"> {
</span><span class="cx">     if (m_mediaKeys == mediaKeys)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -547,6 +547,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><span class="cx">     virtual bool mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array*) override;
</span><ins>+    virtual String mediaPlayerMediaKeysStorageDirectory() const override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.h (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -267,6 +267,11 @@
</span><span class="cx">     static bool shouldManageAudioSessionCategory() { return gManageAudioSession; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ENCRYPTED_MEDIA_V2)
+    WEBCORE_EXPORT void setMediaKeysStorageDirectory(const String&amp; directory) { m_mediaKeysStorageDirectory = directory; }
+    const String&amp; mediaKeysStorageDirectory() const { return m_mediaKeysStorageDirectory; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Settings(Page*);
</span><span class="cx"> 
</span><span class="lines">@@ -346,6 +351,10 @@
</span><span class="cx">     WEBCORE_EXPORT static bool gManageAudioSession;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(ENCRYPTED_MEDIA_V2)
+    String m_mediaKeysStorageDirectory;
+#endif
+
</ins><span class="cx">     static double gHiddenPageDOMTimerAlignmentInterval;
</span><span class="cx"> 
</span><span class="cx">     static bool gLowPowerVideoAudioBufferSizeEnabled;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1121,6 +1121,11 @@
</span><span class="cx"> {
</span><span class="cx">     return m_client.mediaPlayerKeyNeeded(this, initData);
</span><span class="cx"> }
</span><ins>+
+String MediaPlayer::mediaKeysStorageDirectory() const
+{
+    return m_client.mediaPlayerMediaKeysStorageDirectory();
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> String MediaPlayer::referrer() const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsMediaPlayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -215,6 +215,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><span class="cx">     virtual bool mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array*) { return false; }
</span><ins>+    virtual String mediaPlayerMediaKeysStorageDirectory() const { return emptyString(); }
</ins><span class="cx"> #endif
</span><span class="cx">     
</span><span class="cx"> #if ENABLE(IOS_AIRPLAY)
</span><span class="lines">@@ -516,6 +517,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><span class="cx">     bool keyNeeded(Uint8Array* initData);
</span><ins>+    String mediaKeysStorageDirectory() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     String referrer() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsavfoundationobjcMediaPlayerPrivateMediaSourceAVFObjCmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE) &amp;&amp; USE(AVFOUNDATION)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;CDMSessionMediaSourceAVFObjC.h&quot;
</span><ins>+#import &quot;FileSystem.h&quot;
</ins><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;MediaSourcePrivateAVFObjC.h&quot;
</span><span class="cx"> #import &quot;MediaSourcePrivateClient.h&quot;
</span><span class="lines">@@ -674,29 +675,24 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ENCRYPTED_MEDIA_V2)
</span><del>-static const String&amp; sessionStorageDirectory()
-{
-    static NeverDestroyed&lt;String&gt; 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(&quot;AVStreamSession/&quot;));
-    }
-    
-    return sessionDirectoryPath.get();
-}
-
</del><span class="cx"> AVStreamSession* MediaPlayerPrivateMediaSourceAVFObjC::streamSession()
</span><span class="cx"> {
</span><span class="cx">     if (!getAVStreamSessionClass() || ![getAVStreamSessionClass() instancesRespondToSelector:@selector(initWithStorageDirectoryAtURL:)])
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    if (!m_streamSession)
-        m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:sessionStorageDirectory()]]);
</del><ins>+    if (!m_streamSession) {
+        String storageDirectory = m_player-&gt;mediaKeysStorageDirectory();
+        if (storageDirectory.isEmpty())
+            return nil;
+
+        if (!fileExists(storageDirectory)) {
+            if (!makeAllDirectories(storageDirectory))
+                return nil;
+        }
+
+        String storagePath = pathByAppendingComponent(storageDirectory, &quot;SecureStop.plist&quot;);
+        m_streamSession = adoptNS([[getAVStreamSessionClass() alloc] initWithStorageDirectoryAtURL:[NSURL fileURLWithPath:storagePath]]);
+    }
</ins><span class="cx">     return m_streamSession.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-10-30  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-10-30  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/18821260&gt; Prepare for the mysterious future
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferenceKeysPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -147,6 +147,7 @@
</span><span class="cx"> #define WebKitImageControlsEnabledPreferenceKey @&quot;WebKitImageControlsEnabled&quot;
</span><span class="cx"> #define WebKitGamepadsEnabledPreferenceKey @&quot;WebKitGamepadsEnabled&quot;
</span><span class="cx"> #define WebKitServiceControlsEnabledPreferenceKey @&quot;WebKitServiceControlsEnabled&quot;
</span><ins>+#define WebKitMediaKeysStorageDirectoryKey @&quot;WebKitMediaKeysStorageDirectory&quot;
</ins><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span><span class="cx"> // These are private both because callers should be using the cover methods and because the
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -580,6 +580,9 @@
</span><span class="cx">         [NSNumber numberWithBool:NO], WebKitServiceControlsEnabledPreferenceKey,
</span><span class="cx"> #endif
</span><span class="cx">         [NSNumber numberWithBool:NO], WebKitEnableInheritURIQueryComponentPreferenceKey,
</span><ins>+#if ENABLE(ENCRYPTED_MEDIA_V2)
+        @&quot;~/Library/WebKit/MediaKeys&quot;, WebKitMediaKeysStorageDirectoryKey,
+#endif
</ins><span class="cx">         nil];
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="lines">@@ -2465,6 +2468,16 @@
</span><span class="cx">     [self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSString *)mediaKeysStorageDirectory
+{
+    return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
+}
+
+- (void)setMediaKeysStorageDirectory:(NSString *)directory
+{
+    [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WebPreferences (WebInternal)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebPreferencesPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -422,6 +422,9 @@
</span><span class="cx"> - (void)setGamepadsEnabled:(BOOL)flag;
</span><span class="cx"> - (BOOL)gamepadsEnabled;
</span><span class="cx"> 
</span><ins>+- (void)setMediaKeysStorageDirectory:(NSString *)directory;
+- (NSString *)mediaKeysStorageDirectory;
+
</ins><span class="cx"> #if TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 80000
</span><span class="cx"> - (void)_setAllowCompositingLayerVisualDegradation:(BOOL)flag;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2403,6 +2403,10 @@
</span><span class="cx">     [[self window] setAcceleratedDrawingEnabled:[preferences acceleratedDrawingEnabled]];
</span><span class="cx">     [WAKView _setInterpolationQuality:[preferences _interpolationQuality]];
</span><span class="cx"> #endif
</span><ins>+
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+    settings.setMediaKeysStorageDirectory([preferences mediaKeysStorageDirectory]);
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline IMP getMethod(id o, SEL s)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-10-30  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-10-30  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Workaround for &lt;rdar://problem/18830639&gt;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (175399 => 175400)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -81,6 +81,7 @@
</span><span class="cx"> #include &quot;WebInspectorMessages.h&quot;
</span><span class="cx"> #include &quot;WebInspectorUI.h&quot;
</span><span class="cx"> #include &quot;WebInspectorUIMessages.h&quot;
</span><ins>+#include &quot;WebMediaKeyStorageManager.h&quot;
</ins><span class="cx"> #include &quot;WebNotificationClient.h&quot;
</span><span class="cx"> #include &quot;WebOpenPanelResultListener.h&quot;
</span><span class="cx"> #include &quot;WebPageCreationParameters.h&quot;
</span><span class="lines">@@ -474,6 +475,12 @@
</span><span class="cx"> 
</span><span class="cx">     for (auto&amp; mimeType : parameters.mimeTypesWithCustomContentProviders)
</span><span class="cx">         m_mimeTypesWithCustomContentProviders.add(mimeType);
</span><ins>+
+
+#if ENABLE(ENCRYPTED_MEDIA_V2)
+    if (WebMediaKeyStorageManager* manager = WebProcess::shared().supplement&lt;WebMediaKeyStorageManager&gt;())
+        m_page-&gt;settings().setMediaKeysStorageDirectory(manager-&gt;mediaKeyStorageDirectory());
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::reinitializeWebPage(const WebPageCreationParameters&amp; parameters)
</span></span></pre>
</div>
</div>

</body>
</html>