2011-06-15 Eric Carlson <eric.carlson@apple.com>
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2011 17:40:03 +0000 (17:40 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Jun 2011 17:40:03 +0000 (17:40 +0000)
        Reviewed by Alexey Proskuryakov.

        MediaPlayerPrivate should not know about application cache
        https://bugs.webkit.org/show_bug.cgi?id=62648

        Test: http/tests/appcache/video.html

        * html/HTMLMediaElement.cpp:
        (WebCore::createFileURLForApplicationCacheResource): Create a url for a file
            in the application cache folder.
        (WebCore::HTMLMediaElement::loadResource): Change url to point to file in the application
            cache if necessary.
        (WebCore::HTMLMediaElement::mediaLoadingFailed): Split failure logic out of setNetworkState
            so it can be called when asked to load a file that is not in the application cache.
        (WebCore::HTMLMediaElement::setNetworkState): Move failure logic out to mediaLoadingFailed.
        * html/HTMLMediaElement.h:

        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
        (WebCore::MediaPlayerPrivateAVFoundation::setPreload): Remove app cache logic.
        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:

        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h:
        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.

        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
        (WebCore::MediaPlayerPrivateQTKit::loadInternal): Ditto.

        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::loadInternal): Ditto.

2011-06-15  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Alexey Proskuryakov.

        MediaPlayerPrivate should not know about application cache
        https://bugs.webkit.org/show_bug.cgi?id=62648

        Add test for <video> in the application cache.

        * http/tests/appcache/resources/video.manifest: Added.
        * http/tests/appcache/video-expected.txt: Added.
        * http/tests/appcache/video.html: Added.

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

14 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/appcache/resources/video.manifest [new file with mode: 0644]
LayoutTests/http/tests/appcache/video-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/appcache/video.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h
Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm
Source/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp

index ae0fec3..1211fc0 100644 (file)
@@ -1,3 +1,16 @@
+2011-06-15  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        MediaPlayerPrivate should not know about application cache
+        https://bugs.webkit.org/show_bug.cgi?id=62648
+
+        Add test for <video> in the application cache.
+
+        * http/tests/appcache/resources/video.manifest: Added.
+        * http/tests/appcache/video-expected.txt: Added.
+        * http/tests/appcache/video.html: Added.
+
 2011-06-15  Tony Chang  <tony@chromium.org>
 
         Fixing more results with RenderDeprecatedFlexibleBot rename.
diff --git a/LayoutTests/http/tests/appcache/resources/video.manifest b/LayoutTests/http/tests/appcache/resources/video.manifest
new file mode 100644 (file)
index 0000000..d3ba88b
--- /dev/null
@@ -0,0 +1,6 @@
+CACHE MANIFEST # v1
+/media-resources/media-file.js
+/media-resources/video-test.js
+
+/media-resources/content/test.mp4
+/media-resources/content/test.ogv
diff --git a/LayoutTests/http/tests/appcache/video-expected.txt b/LayoutTests/http/tests/appcache/video-expected.txt
new file mode 100644 (file)
index 0000000..e6dff64
--- /dev/null
@@ -0,0 +1,16 @@
+Test that <video> can be loaded from the application cache.
+
+*** Setting 'src' to file specified in manifest. This file should load.
+
+EVENT(durationchange)
+
+*** Setting 'src' to valid media file not in manifest. This file should fail to load.
+
+EVENT(error)
+
+*** Setting 'src' to non-media file that is in manifest. This file should fail to load.
+
+EVENT(error)
+
+END OF TEST
+
diff --git a/LayoutTests/http/tests/appcache/video.html b/LayoutTests/http/tests/appcache/video.html
new file mode 100644 (file)
index 0000000..ac0eb1b
--- /dev/null
@@ -0,0 +1,100 @@
+<!DOCTYPE html>
+<html manifest="resources/video.manifest">
+    <head>
+        <title>test media in the app cache</title>
+        <style>
+            video { background-color: yellow; width: 320px; height: 240px; }
+        </style>
+        <script src=/media-resources/media-file.js></script>
+        <script src=/media-resources/video-test.js></script>
+        <script>
+            var test;
+
+            function unexpectedEvent(event)
+            {
+                failTest(false, '<br>Unexpected "' + event.type + '" event!!');
+            }
+
+            function errorEvent()
+            {
+                consoleWrite("");
+                switch(test)
+                {
+                    case 1:
+                        logResult(false, "Failed loading file included in manifest!");
+                        endTest();
+                        break;
+                    case 2:
+                        test3()
+                        break;
+                    case 3:
+                        endTest();
+                        break;
+                }
+            }
+
+            function test3()
+            {
+                consoleWrite("*** Setting 'src' to non-media file that is in manifest. This file should fail to load.<br>");
+
+                test = 3;
+                video = document.getElementsByTagName('video')[0];
+                video.src = "/media-resources/media-file.js";
+            }
+
+            function test2()
+            {
+                consoleWrite("<br>*** Setting 'src' to valid media file not in manifest. This file should fail to load.<br>");
+
+                test = 2;
+                video = document.getElementsByTagName('video')[0];
+                video.src = "/media-resources/content/" + findMediaFile("audio", "silence");
+            }
+
+            function durationchangeEvent()
+            {
+                if (test == 2) {
+                    logResult(false, "<br>Loaded file NOT included in manifest!");
+                    consoleWrite("");
+                    endTest();
+                    return;
+                }
+
+                test2();
+            }
+
+            function test1()
+            {
+                consoleWrite("*** Setting 'src' to file specified in manifest. This file should load.<br>");
+                test = 1;
+
+                waitForEvent('durationchange', durationchangeEvent);
+                waitForEvent('error', errorEvent);
+
+                video = document.getElementsByTagName('video')[0];
+                video.src = "/media-resources/content/" + findMediaFile("video", "test");
+            }
+
+            function updateready(event)
+            {
+                applicationCache.swapCache();
+                test1();
+            }
+
+            applicationCache.addEventListener("updateready", updateready, false);
+            applicationCache.addEventListener("noupdate", test1, false);
+            applicationCache.addEventListener("cached", test1, false);
+
+            applicationCache.addEventListener("obsolete", unexpectedEvent, false);
+            applicationCache.addEventListener("error", unexpectedEvent, false);
+        </script>
+
+    </head>
+    <body>
+
+        <video controls ></video>
+
+        <p>Test that &lt;video&gt; can be loaded from the application cache.</p>
+    </body>
+</html>
+
index 2e18ed4..ccea0d4 100644 (file)
@@ -1,3 +1,36 @@
+2011-06-15  Eric Carlson  <eric.carlson@apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        MediaPlayerPrivate should not know about application cache
+        https://bugs.webkit.org/show_bug.cgi?id=62648
+
+        Test: http/tests/appcache/video.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::createFileURLForApplicationCacheResource): Create a url for a file
+            in the application cache folder.
+        (WebCore::HTMLMediaElement::loadResource): Change url to point to file in the application
+            cache if necessary.
+        (WebCore::HTMLMediaElement::mediaLoadingFailed): Split failure logic out of setNetworkState
+            so it can be called when asked to load a file that is not in the application cache.
+        (WebCore::HTMLMediaElement::setNetworkState): Move failure logic out to mediaLoadingFailed.
+        * html/HTMLMediaElement.h:
+
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundation::setPreload): Remove app cache logic.
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.h:
+        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
+
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
+        * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
+        (WebCore::MediaPlayerPrivateQTKit::loadInternal): Ditto.
+
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::loadInternal): Ditto.
+
 2011-06-15  Mark Pilgrim  <pilgrim@chromium.org>
 
         Reviewed by Tony Chang.
index c3b0492..d45835a 100644 (file)
@@ -28,6 +28,8 @@
 #if ENABLE(VIDEO)
 #include "HTMLMediaElement.h"
 
+#include "ApplicationCacheHost.h"
+#include "ApplicationCacheResource.h"
 #include "Attribute.h"
 #include "Chrome.h"
 #include "ChromeClient.h"
@@ -37,6 +39,7 @@
 #include "ContentType.h"
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
+#include "DocumentLoader.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
@@ -671,6 +674,21 @@ void HTMLMediaElement::loadNextSourceChild()
     loadResource(mediaURL, contentType);
 }
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS) && !PLATFORM(CHROMIUM)
+static KURL createFileURLForApplicationCacheResource(const String& path)
+{
+    // KURL should have a function to create a url from a path, but it does not. This function
+    // is not suitable because KURL::setPath uses encodeWithURLEscapeSequences, which it notes
+    // does not correctly escape '#' and '?'. This function works for our purposes because
+    // app cache media files are always created with encodeForFileName(createCanonicalUUIDString()).
+    KURL url;
+
+    url.setProtocol("file");
+    url.setPath(path);
+    return url;
+}
+#endif
+
 void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& contentType)
 {
     ASSERT(isSafeToLoadURL(initialURL, Complain));
@@ -688,8 +706,32 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
     // The resource fetch algorithm 
     m_networkState = NETWORK_LOADING;
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS) && !PLATFORM(CHROMIUM)
+    // If the url should be loaded from the application cache, pass the url of the cached file
+    // to the media engine.
+    ApplicationCacheHost* cacheHost = frame->loader()->documentLoader()->applicationCacheHost();
+    ApplicationCacheResource* resource = 0;
+    if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(url), resource)) {
+        // Resources that are not present in the manifest will always fail to load (at least, after the
+        // cache has been primed the first time), making the testing of offline applications simpler.
+        if (!resource || resource->path().isEmpty()) {
+            mediaLoadingFailed(MediaPlayer::NetworkError);
+            return;
+        }
+    }
+#endif
+
+    // Set m_currentSrc *before* changing to the cache url, the fact that we are loading from the app
+    // cache is an internal detail not exposed through the media element API.
     m_currentSrc = url;
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS) && !PLATFORM(CHROMIUM)
+    if (resource) {
+        url = createFileURLForApplicationCacheResource(resource->path());
+        LOG(Media, "HTMLMediaElement::loadResource - will load from app cache -> %s", urlForLogging(url).utf8().data());
+    }
+#endif
+
     LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogging(m_currentSrc).utf8().data());
 
     if (m_sendProgressEvents) 
@@ -707,7 +749,7 @@ void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content
     m_player->setPreservesPitch(m_webkitPreservesPitch);
     updateVolume();
 
-    m_player->load(m_currentSrc.string(), contentType);
+    m_player->load(url.string(), contentType);
 
     // If there is no poster to display, allow the media engine to render video frames as soon as
     // they are available.
@@ -856,6 +898,42 @@ void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*)
     endProcessingMediaPlayerCallback();
 }
 
+void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState state)
+{
+    stopPeriodicTimers();
+    
+    // If we failed while trying to load a <source> element, the movie was never parsed, and there are more
+    // <source> children, schedule the next one
+    if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {
+        
+        if (m_currentSourceNode)
+            m_currentSourceNode->scheduleErrorEvent();
+        else
+            LOG(Media, "HTMLMediaElement::setNetworkState - error event not sent, <source> was removed");
+        
+        if (havePotentialSourceChild()) {
+            LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next <source>");
+            scheduleNextSourceChild();
+        } else {
+            LOG(Media, "HTMLMediaElement::setNetworkState - no more <source> elements, waiting");
+            waitForSourceChange();
+        }
+        
+        return;
+    }
+    
+    if (state == MediaPlayer::NetworkError && m_readyState >= HAVE_METADATA)
+        mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK));
+    else if (state == MediaPlayer::DecodeError)
+        mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE));
+    else if ((state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError) && m_loadState == LoadingFromSrcAttr)
+        noneSupported();
+    
+    updateDisplayState();
+    if (hasMediaControls())
+        mediaControls()->reportedError();
+}
+
 void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
 {
     LOG(Media, "HTMLMediaElement::setNetworkState(%d) - current state is %d", static_cast<int>(state), static_cast<int>(m_networkState));
@@ -867,38 +945,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
     }
 
     if (state == MediaPlayer::FormatError || state == MediaPlayer::NetworkError || state == MediaPlayer::DecodeError) {
-        stopPeriodicTimers();
-
-        // If we failed while trying to load a <source> element, the movie was never parsed, and there are more
-        // <source> children, schedule the next one
-        if (m_readyState < HAVE_METADATA && m_loadState == LoadingFromSourceElement) {
-
-            if (m_currentSourceNode)
-                m_currentSourceNode->scheduleErrorEvent();
-            else
-                LOG(Media, "HTMLMediaElement::setNetworkState - error event not sent, <source> was removed");
-
-            if (havePotentialSourceChild()) {
-                LOG(Media, "HTMLMediaElement::setNetworkState - scheduling next <source>");
-                scheduleNextSourceChild();
-            } else {
-                LOG(Media, "HTMLMediaElement::setNetworkState - no more <source> elements, waiting");
-                waitForSourceChange();
-            }
-
-            return;
-        }
-
-        if (state == MediaPlayer::NetworkError)
-            mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK));
-        else if (state == MediaPlayer::DecodeError)
-            mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_DECODE));
-        else if (state == MediaPlayer::FormatError && m_loadState == LoadingFromSrcAttr)
-            noneSupported();
-
-        updateDisplayState();
-        if (hasMediaControls())
-            mediaControls()->reportedError();
+        mediaLoadingFailed(state);
         return;
     }
 
index 271639e..7028db7 100644 (file)
@@ -300,6 +300,7 @@ private:
     enum InvalidSourceAction { DoNothing, Complain };
     bool isSafeToLoadURL(const KURL&, InvalidSourceAction);
     KURL selectNextSourceChild(ContentType*, InvalidSourceAction);
+    void mediaLoadingFailed(MediaPlayer::NetworkState);
 
     // These "internal" functions do not check user gesture restrictions.
     void loadInternal();
@@ -362,13 +363,13 @@ private:
     unsigned m_previousProgress;
     double m_previousProgressTime;
 
-    // the last time a timeupdate event was sent (wall clock)
+    // The last time a timeupdate event was sent (wall clock).
     double m_lastTimeUpdateEventWallTime;
 
-    // the last time a timeupdate event was sent in movie time
+    // The last time a timeupdate event was sent in movie time.
     float m_lastTimeUpdateEventMovieTime;
     
-    // loading state
+    // Loading state.
     enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement };
     LoadState m_loadState;
     HTMLSourceElement* m_currentSourceNode;
index b4c9e99..7839ce8 100644 (file)
@@ -29,8 +29,6 @@
 
 #include "MediaPlayerPrivateAVFoundation.h"
 
-#include "ApplicationCacheHost.h"
-#include "ApplicationCacheResource.h"
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -618,23 +616,8 @@ void MediaPlayerPrivateAVFoundation::setPreload(MediaPlayer::Preload preload)
     setDelayCallbacks(true);
 
     if (m_preload >= MediaPlayer::MetaData && assetStatus() == MediaPlayerAVAssetStatusDoesNotExist) {
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-        Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0;
-        ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0;
-        ApplicationCacheResource* resource;
-        if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(m_assetURL), resource) && resource) {
-            // AVFoundation can't open arbitrary data pointers, so if this ApplicationCacheResource doesn't 
-            // have a valid local path, just open the resource's original URL.
-            if (resource->path().isEmpty())
-                createAVAssetForURL(resource->url());
-            else
-                createAVAssetForCacheResource(resource);
-        } else
-#endif    
-            createAVAssetForURL(m_assetURL);
-
+        createAVAssetForURL(m_assetURL);
         createAVPlayer();
-
         checkPlayability();
     }
 
index 6803d64..c29e1ea 100644 (file)
@@ -35,8 +35,6 @@
 
 namespace WebCore {
 
-class ApplicationCacheResource;
-
 class MediaPlayerPrivateAVFoundation : public MediaPlayerPrivateInterface {
 public:
 
@@ -160,9 +158,6 @@ protected:
     virtual void createAVAssetForURL(const String&) = 0;
     virtual void createAVPlayer() = 0;
     virtual void createAVPlayerItem() = 0;
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    virtual void createAVAssetForCacheResource(ApplicationCacheResource*) = 0;
-#endif
 
     enum ItemStatus {
         MediaPlayerAVPlayerItemStatusDoesNotExist,
index 382d79f..7fd2465 100644 (file)
@@ -51,8 +51,6 @@ typedef struct CGImage *CGImageRef;
 
 namespace WebCore {
 
-class ApplicationCacheResource;
-
 class MediaPlayerPrivateAVFoundationObjC : public MediaPlayerPrivateAVFoundation {
 public:
     ~MediaPlayerPrivateAVFoundationObjC();
@@ -90,9 +88,6 @@ private:
     virtual void createAVPlayer();
     virtual void createAVPlayerItem();
     virtual void createAVAssetForURL(const String& url);
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    virtual void createAVAssetForCacheResource(ApplicationCacheResource*);
-#endif
     virtual MediaPlayerPrivateAVFoundation::ItemStatus playerItemStatus() const;
     virtual MediaPlayerPrivateAVFoundation::AssetStatus assetStatus() const;
 
index 528cf26..85cb349 100644 (file)
@@ -29,7 +29,6 @@
 
 #import "MediaPlayerPrivateAVFoundationObjC.h"
 
-#import "ApplicationCacheResource.h"
 #import "BlockExceptions.h"
 #import "FloatConversion.h"
 #import "FrameView.h"
@@ -269,27 +268,6 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
     setDelayCallbacks(false);
 }
 
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-void MediaPlayerPrivateAVFoundationObjC::createAVAssetForCacheResource(ApplicationCacheResource* resource)
-{
-    if (m_avAsset)
-        return;
-
-    LOG(Media, "MediaPlayerPrivateAVFoundationObjC::createAVAssetForCacheResource(%p)", this);
-
-    // AVFoundation can't open arbitrary data pointers.
-    ASSERT(!resource->path().isEmpty());
-    
-    setDelayCallbacks(true);
-
-    NSURL* localURL = [NSURL fileURLWithPath:resource->path()];
-    m_avAsset.adoptNS([[AVURLAsset alloc] initWithURL:localURL options:nil]);
-    m_haveCheckedPlayability = false;
-
-    setDelayCallbacks(false);
-}
-#endif
-
 void MediaPlayerPrivateAVFoundationObjC::createAVPlayer()
 {
     if (m_avPlayer)
index a41946a..6519630 100644 (file)
@@ -57,8 +57,6 @@ class WebCoreMovieObserver;
 
 namespace WebCore {
     
-class ApplicationCacheResource;
-
 class MediaPlayerPrivateQTKit : public MediaPlayerPrivateInterface {
 public:
     ~MediaPlayerPrivateQTKit();
@@ -149,7 +147,6 @@ private:
 
     void createQTMovie(const String& url);
     void createQTMovie(NSURL *, NSDictionary *movieAttributes);
-    void createQTMovie(ApplicationCacheResource*);
 
     enum MediaRenderingMode { MediaRenderingNone, MediaRenderingMovieView, MediaRenderingSoftwareRenderer, MediaRenderingMovieLayer };
     MediaRenderingMode currentRenderingMode() const;
index 878c0de..cac808e 100644 (file)
 
 #import "MediaPlayerPrivateQTKit.h"
 
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-#include "ApplicationCacheHost.h"
-#include "ApplicationCacheResource.h"
-#endif
-
 #import "BlockExceptions.h"
 #import "DocumentLoader.h"
 #import "Frame.h"
@@ -294,33 +289,6 @@ void MediaPlayerPrivateQTKit::createQTMovie(const String& url)
     createQTMovie(cocoaURL, movieAttributes);
 }
 
-void MediaPlayerPrivateQTKit::createQTMovie(ApplicationCacheResource* resource)
-{
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    ASSERT(resource);
-
-    NSMutableDictionary *movieAttributes = commonMovieAttributes();    
-    [movieAttributes setObject:[NSNumber numberWithBool:YES] forKey:@"QTMovieOpenForPlaybackAttribute"];
-    
-    // ApplicationCacheResources can supply either a data pointer, or a path to a locally cached 
-    // flat file.  We would prefer the path over the data, but QTKit can handle either:
-    String localPath = resource->path();
-    NSURL* cocoaURL = !localPath.isEmpty() ? [NSURL fileURLWithPath:localPath isDirectory:NO] : nil;
-    if (cocoaURL)
-        [movieAttributes setValue:cocoaURL forKey:QTMovieURLAttribute];
-    else {
-        NSData* movieData = resource->data()->createNSData();
-        [movieAttributes setValue:movieData forKey:QTMovieDataAttribute];
-        [movieData release];
-    }
-    
-    createQTMovie(cocoaURL, movieAttributes);
-    
-#else
-    ASSERT_NOT_REACHED();
-#endif
-}
-
 static void disableComponentsOnce()
 {
     static bool sComponentsDisabled = false;
@@ -682,14 +650,6 @@ void MediaPlayerPrivateQTKit::loadInternal(const String& url)
     
     [m_objcObserver.get() setDelayCallbacks:YES];
 
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : NULL;
-    ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : NULL;
-    ApplicationCacheResource* resource = NULL;
-    if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(url), resource) && resource)
-        createQTMovie(resource);
-    else
-#endif    
     createQTMovie(url);
 
     [m_objcObserver.get() loadStateChanged:nil];
index 7b5541f..e2e0c10 100644 (file)
@@ -28,8 +28,6 @@
 #if ENABLE(VIDEO)
 #include "MediaPlayerPrivateQuickTimeVisualContext.h"
 
-#include "ApplicationCacheHost.h"
-#include "ApplicationCacheResource.h"
 #include "Cookie.h"
 #include "CookieJar.h"
 #include "DocumentLoader.h"
@@ -374,15 +372,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::loadInternal(const String& url)
 
     m_movie = adoptRef(new QTMovie(m_movieClient.get()));
 
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    Frame* frame = m_player->frameView() ? m_player->frameView()->frame() : 0;
-    ApplicationCacheHost* cacheHost = frame ? frame->loader()->documentLoader()->applicationCacheHost() : 0;
-    ApplicationCacheResource* resource = 0;
-    if (cacheHost && cacheHost->shouldLoadResourceFromApplicationCache(ResourceRequest(url), resource) && resource && !resource->path().isEmpty())
-        m_movie->load(resource->path().characters(), resource->path().length(), m_player->preservesPitch());
-    else
-#endif
-        m_movie->load(url.characters(), url.length(), m_player->preservesPitch());
+    m_movie->load(url.characters(), url.length(), m_player->preservesPitch());
     m_movie->setVolume(m_player->volume());
 }