| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "core/html/MediaKeyEvent.h" | 55 #include "core/html/MediaKeyEvent.h" |
| 56 #include "core/html/TimeRanges.h" | 56 #include "core/html/TimeRanges.h" |
| 57 #include "core/html/shadow/MediaControls.h" | 57 #include "core/html/shadow/MediaControls.h" |
| 58 #include "core/html/track/InbandTextTrack.h" | 58 #include "core/html/track/InbandTextTrack.h" |
| 59 #include "core/html/track/TextTrackCueList.h" | 59 #include "core/html/track/TextTrackCueList.h" |
| 60 #include "core/html/track/TextTrackList.h" | 60 #include "core/html/track/TextTrackList.h" |
| 61 #include "core/loader/FrameLoader.h" | 61 #include "core/loader/FrameLoader.h" |
| 62 #include "core/rendering/RenderLayerCompositor.h" | 62 #include "core/rendering/RenderLayerCompositor.h" |
| 63 #include "core/rendering/RenderVideo.h" | 63 #include "core/rendering/RenderVideo.h" |
| 64 #include "core/rendering/RenderView.h" | 64 #include "core/rendering/RenderView.h" |
| 65 // FIXME: Remove dependency on modules/encryptedmedia (http://crbug.com/242754). |
| 66 #include "modules/encryptedmedia/MediaKeyNeededEvent.h" |
| 67 #include "modules/encryptedmedia/MediaKeys.h" |
| 65 #include "modules/mediastream/MediaStreamRegistry.h" | 68 #include "modules/mediastream/MediaStreamRegistry.h" |
| 66 #include "platform/ContentType.h" | 69 #include "platform/ContentType.h" |
| 67 #include "platform/Language.h" | 70 #include "platform/Language.h" |
| 68 #include "platform/Logging.h" | 71 #include "platform/Logging.h" |
| 69 #include "platform/MIMETypeFromURL.h" | 72 #include "platform/MIMETypeFromURL.h" |
| 70 #include "platform/MIMETypeRegistry.h" | 73 #include "platform/MIMETypeRegistry.h" |
| 71 #include "platform/NotImplemented.h" | 74 #include "platform/NotImplemented.h" |
| 72 #include "platform/UserGestureIndicator.h" | 75 #include "platform/UserGestureIndicator.h" |
| 73 #include "platform/graphics/GraphicsLayer.h" | 76 #include "platform/graphics/GraphicsLayer.h" |
| 74 #include "platform/weborigin/SecurityOrigin.h" | 77 #include "platform/weborigin/SecurityOrigin.h" |
| 75 #include "public/platform/Platform.h" | 78 #include "public/platform/Platform.h" |
| 76 #include "public/platform/WebInbandTextTrack.h" | 79 #include "public/platform/WebInbandTextTrack.h" |
| 77 #include "wtf/CurrentTime.h" | 80 #include "wtf/CurrentTime.h" |
| 78 #include "wtf/MathExtras.h" | 81 #include "wtf/MathExtras.h" |
| 79 #include "wtf/NonCopyingSort.h" | 82 #include "wtf/NonCopyingSort.h" |
| 80 #include "wtf/Uint8Array.h" | 83 #include "wtf/Uint8Array.h" |
| 81 #include "wtf/text/CString.h" | 84 #include "wtf/text/CString.h" |
| 82 | 85 |
| 83 #if ENABLE(WEB_AUDIO) | 86 #if ENABLE(WEB_AUDIO) |
| 84 #include "platform/audio/AudioSourceProvider.h" | 87 #include "platform/audio/AudioSourceProvider.h" |
| 85 #include "modules/webaudio/MediaElementAudioSourceNode.h" | 88 #include "modules/webaudio/MediaElementAudioSourceNode.h" |
| 86 #endif | 89 #endif |
| 87 | 90 |
| 88 #if ENABLE(ENCRYPTED_MEDIA_V2) | |
| 89 // FIXME: Remove dependency on modules/encryptedmedia (http://crbug.com/242754). | |
| 90 #include "modules/encryptedmedia/MediaKeyNeededEvent.h" | |
| 91 #include "modules/encryptedmedia/MediaKeys.h" | |
| 92 #endif | |
| 93 | |
| 94 using namespace std; | 91 using namespace std; |
| 95 using blink::WebInbandTextTrack; | 92 using blink::WebInbandTextTrack; |
| 96 using blink::WebMimeRegistry; | 93 using blink::WebMimeRegistry; |
| 97 | 94 |
| 98 namespace WebCore { | 95 namespace WebCore { |
| 99 | 96 |
| 100 #if !LOG_DISABLED | 97 #if !LOG_DISABLED |
| 101 static String urlForLoggingMedia(const KURL& url) | 98 static String urlForLoggingMedia(const KURL& url) |
| 102 { | 99 { |
| 103 static const unsigned maximumURLLengthForLogging = 128; | 100 static const unsigned maximumURLLengthForLogging = 128; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 m_textTracks->item(i)->clearClient(); | 332 m_textTracks->item(i)->clearClient(); |
| 336 } | 333 } |
| 337 | 334 |
| 338 if (m_mediaController) { | 335 if (m_mediaController) { |
| 339 m_mediaController->removeMediaElement(this); | 336 m_mediaController->removeMediaElement(this); |
| 340 m_mediaController = 0; | 337 m_mediaController = 0; |
| 341 } | 338 } |
| 342 | 339 |
| 343 closeMediaSource(); | 340 closeMediaSource(); |
| 344 | 341 |
| 345 #if ENABLE(ENCRYPTED_MEDIA_V2) | |
| 346 setMediaKeys(0); | 342 setMediaKeys(0); |
| 347 #endif | |
| 348 | 343 |
| 349 removeElementFromDocumentMap(this, &document()); | 344 removeElementFromDocumentMap(this, &document()); |
| 350 | 345 |
| 351 // Destroying the player may cause a resource load to be canceled, | 346 // Destroying the player may cause a resource load to be canceled, |
| 352 // which could result in userCancelledLoad() being called back. | 347 // which could result in userCancelledLoad() being called back. |
| 353 // Setting m_completelyLoaded ensures that such a call will not cause | 348 // Setting m_completelyLoaded ensures that such a call will not cause |
| 354 // us to dispatch an abort event, which would result in a crash. | 349 // us to dispatch an abort event, which would result in a crash. |
| 355 // See http://crbug.com/233654 for more details. | 350 // See http://crbug.com/233654 for more details. |
| 356 m_completelyLoaded = true; | 351 m_completelyLoaded = true; |
| 357 | 352 |
| (...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 initializer.initData = Uint8Array::create(initData, initDataLength); | 1715 initializer.initData = Uint8Array::create(initData, initDataLength); |
| 1721 initializer.bubbles = false; | 1716 initializer.bubbles = false; |
| 1722 initializer.cancelable = false; | 1717 initializer.cancelable = false; |
| 1723 | 1718 |
| 1724 RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitneedkey, i
nitializer); | 1719 RefPtr<Event> event = MediaKeyEvent::create(EventTypeNames::webkitneedkey, i
nitializer); |
| 1725 event->setTarget(this); | 1720 event->setTarget(this); |
| 1726 m_asyncEventQueue->enqueueEvent(event.release()); | 1721 m_asyncEventQueue->enqueueEvent(event.release()); |
| 1727 return true; | 1722 return true; |
| 1728 } | 1723 } |
| 1729 | 1724 |
| 1730 #if ENABLE(ENCRYPTED_MEDIA_V2) | |
| 1731 bool HTMLMediaElement::mediaPlayerKeyNeeded(Uint8Array* initData) | 1725 bool HTMLMediaElement::mediaPlayerKeyNeeded(Uint8Array* initData) |
| 1732 { | 1726 { |
| 1733 if (!hasEventListeners("webkitneedkey")) { | 1727 if (!hasEventListeners("webkitneedkey")) { |
| 1734 m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED); | 1728 m_error = MediaError::create(MediaError::MEDIA_ERR_ENCRYPTED); |
| 1735 scheduleEvent(EventTypeNames::error); | 1729 scheduleEvent(EventTypeNames::error); |
| 1736 return false; | 1730 return false; |
| 1737 } | 1731 } |
| 1738 | 1732 |
| 1739 MediaKeyNeededEventInit initializer; | 1733 MediaKeyNeededEventInit initializer; |
| 1740 initializer.initData = initData; | 1734 initializer.initData = initData; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1752 { | 1746 { |
| 1753 if (m_mediaKeys == mediaKeys) | 1747 if (m_mediaKeys == mediaKeys) |
| 1754 return; | 1748 return; |
| 1755 | 1749 |
| 1756 if (m_mediaKeys) | 1750 if (m_mediaKeys) |
| 1757 m_mediaKeys->setMediaElement(0); | 1751 m_mediaKeys->setMediaElement(0); |
| 1758 m_mediaKeys = mediaKeys; | 1752 m_mediaKeys = mediaKeys; |
| 1759 if (m_mediaKeys) | 1753 if (m_mediaKeys) |
| 1760 m_mediaKeys->setMediaElement(this); | 1754 m_mediaKeys->setMediaElement(this); |
| 1761 } | 1755 } |
| 1762 #endif | |
| 1763 | 1756 |
| 1764 void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) | 1757 void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) |
| 1765 { | 1758 { |
| 1766 ASSERT(m_player); | 1759 ASSERT(m_player); |
| 1767 if (m_networkState != NETWORK_LOADING) | 1760 if (m_networkState != NETWORK_LOADING) |
| 1768 return; | 1761 return; |
| 1769 | 1762 |
| 1770 double time = WTF::currentTime(); | 1763 double time = WTF::currentTime(); |
| 1771 double timedelta = time - m_previousProgressTime; | 1764 double timedelta = time - m_previousProgressTime; |
| 1772 | 1765 |
| (...skipping 2141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3914 if (m_webLayer) | 3907 if (m_webLayer) |
| 3915 m_webLayer->setOpaque(m_opaque); | 3908 m_webLayer->setOpaque(m_opaque); |
| 3916 } | 3909 } |
| 3917 | 3910 |
| 3918 bool HTMLMediaElement::isInteractiveContent() const | 3911 bool HTMLMediaElement::isInteractiveContent() const |
| 3919 { | 3912 { |
| 3920 return fastHasAttribute(controlsAttr); | 3913 return fastHasAttribute(controlsAttr); |
| 3921 } | 3914 } |
| 3922 | 3915 |
| 3923 } | 3916 } |
| OLD | NEW |