| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "core/layout/api/LayoutViewItem.h" | 69 #include "core/layout/api/LayoutViewItem.h" |
| 70 #include "core/layout/compositing/PaintLayerCompositor.h" | 70 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 71 #include "core/loader/FrameLoader.h" | 71 #include "core/loader/FrameLoader.h" |
| 72 #include "core/loader/FrameLoaderClient.h" | 72 #include "core/loader/FrameLoaderClient.h" |
| 73 #include "core/page/ChromeClient.h" | 73 #include "core/page/ChromeClient.h" |
| 74 #include "core/page/NetworkStateNotifier.h" | 74 #include "core/page/NetworkStateNotifier.h" |
| 75 #include "platform/ContentType.h" | 75 #include "platform/ContentType.h" |
| 76 #include "platform/Histogram.h" | 76 #include "platform/Histogram.h" |
| 77 #include "platform/LayoutTestSupport.h" | 77 #include "platform/LayoutTestSupport.h" |
| 78 #include "platform/MIMETypeFromURL.h" | 78 #include "platform/MIMETypeFromURL.h" |
| 79 #include "platform/MIMETypeRegistry.h" | |
| 80 #include "platform/RuntimeEnabledFeatures.h" | 79 #include "platform/RuntimeEnabledFeatures.h" |
| 81 #include "platform/UserGestureIndicator.h" | 80 #include "platform/UserGestureIndicator.h" |
| 82 #include "platform/audio/AudioBus.h" | 81 #include "platform/audio/AudioBus.h" |
| 83 #include "platform/audio/AudioSourceProviderClient.h" | 82 #include "platform/audio/AudioSourceProviderClient.h" |
| 84 #include "platform/graphics/GraphicsLayer.h" | 83 #include "platform/graphics/GraphicsLayer.h" |
| 85 #include "platform/mediastream/MediaStreamDescriptor.h" | 84 #include "platform/mediastream/MediaStreamDescriptor.h" |
| 86 #include "platform/weborigin/SecurityOrigin.h" | 85 #include "platform/weborigin/SecurityOrigin.h" |
| 87 #include "public/platform/Platform.h" | 86 #include "public/platform/Platform.h" |
| 88 #include "public/platform/WebAudioSourceProvider.h" | 87 #include "public/platform/WebAudioSourceProvider.h" |
| 89 #include "public/platform/WebContentDecryptionModule.h" | 88 #include "public/platform/WebContentDecryptionModule.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // If no MIME type is specified, always attempt to load. | 254 // If no MIME type is specified, always attempt to load. |
| 256 if (contentMIMEType.isEmpty()) | 255 if (contentMIMEType.isEmpty()) |
| 257 return true; | 256 return true; |
| 258 | 257 |
| 259 // 4.8.10.3 MIME types - In the absence of a specification to the contrary, | 258 // 4.8.10.3 MIME types - In the absence of a specification to the contrary, |
| 260 // the MIME type "application/octet-stream" when used with parameters, e.g. | 259 // the MIME type "application/octet-stream" when used with parameters, e.g. |
| 261 // "application/octet-stream;codecs=theora", is a type that the user agent | 260 // "application/octet-stream;codecs=theora", is a type that the user agent |
| 262 // knows it cannot render. | 261 // knows it cannot render. |
| 263 if (contentMIMEType != "application/octet-stream" || | 262 if (contentMIMEType != "application/octet-stream" || |
| 264 contentTypeCodecs.isEmpty()) { | 263 contentTypeCodecs.isEmpty()) { |
| 265 WebMimeRegistry::SupportsType supported = | 264 return MIMETypeRegistry::supportsMediaMIMEType(contentMIMEType, |
| 266 Platform::current()->mimeRegistry()->supportsMediaMIMEType( | 265 contentTypeCodecs); |
| 267 contentMIMEType, contentTypeCodecs); | |
| 268 return supported > WebMimeRegistry::IsNotSupported; | |
| 269 } | 266 } |
| 270 | 267 |
| 271 return false; | 268 return false; |
| 272 } | 269 } |
| 273 | 270 |
| 274 String preloadTypeToString(WebMediaPlayer::Preload preloadType) { | 271 String preloadTypeToString(WebMediaPlayer::Preload preloadType) { |
| 275 switch (preloadType) { | 272 switch (preloadType) { |
| 276 case WebMediaPlayer::PreloadNone: | 273 case WebMediaPlayer::PreloadNone: |
| 277 return "none"; | 274 return "none"; |
| 278 case WebMediaPlayer::PreloadMetaData: | 275 case WebMediaPlayer::PreloadMetaData: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 347 |
| 351 Member<HTMLMediaElement> m_element; | 348 Member<HTMLMediaElement> m_element; |
| 352 }; | 349 }; |
| 353 | 350 |
| 354 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) { | 351 void HTMLMediaElement::recordAutoplayMetric(AutoplayMetrics metric) { |
| 355 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, | 352 DEFINE_STATIC_LOCAL(EnumerationHistogram, autoplayHistogram, |
| 356 ("Blink.MediaElement.Autoplay", NumberOfAutoplayMetrics)); | 353 ("Blink.MediaElement.Autoplay", NumberOfAutoplayMetrics)); |
| 357 autoplayHistogram.count(metric); | 354 autoplayHistogram.count(metric); |
| 358 } | 355 } |
| 359 | 356 |
| 360 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType( | 357 MIMETypeRegistry::SupportsType HTMLMediaElement::supportsType( |
| 361 const ContentType& contentType) { | 358 const ContentType& contentType) { |
| 362 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); | 359 DEFINE_STATIC_LOCAL(const String, codecs, ("codecs")); |
| 363 | 360 |
| 364 String type = contentType.type().lower(); | 361 String type = contentType.type().lower(); |
| 365 // The codecs string is not lower-cased because MP4 values are case sensitive | 362 // The codecs string is not lower-cased because MP4 values are case sensitive |
| 366 // per http://tools.ietf.org/html/rfc4281#page-7. | 363 // per http://tools.ietf.org/html/rfc4281#page-7. |
| 367 String typeCodecs = contentType.parameter(codecs); | 364 String typeCodecs = contentType.parameter(codecs); |
| 368 | 365 |
| 369 if (type.isEmpty()) | 366 if (type.isEmpty()) |
| 370 return WebMimeRegistry::IsNotSupported; | 367 return MIMETypeRegistry::IsNotSupported; |
| 371 | 368 |
| 372 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty | 369 // 4.8.10.3 MIME types - The canPlayType(type) method must return the empty |
| 373 // string if type is a type that the user agent knows it cannot render or is | 370 // string if type is a type that the user agent knows it cannot render or is |
| 374 // the type "application/octet-stream" | 371 // the type "application/octet-stream" |
| 375 if (type == "application/octet-stream") | 372 if (type == "application/octet-stream") |
| 376 return WebMimeRegistry::IsNotSupported; | 373 return MIMETypeRegistry::IsNotSupported; |
| 377 | 374 |
| 378 return Platform::current()->mimeRegistry()->supportsMediaMIMEType(type, | 375 return MIMETypeRegistry::supportsMediaMIMEType(type, typeCodecs); |
| 379 typeCodecs); | |
| 380 } | 376 } |
| 381 | 377 |
| 382 URLRegistry* HTMLMediaElement::s_mediaStreamRegistry = 0; | 378 URLRegistry* HTMLMediaElement::s_mediaStreamRegistry = 0; |
| 383 | 379 |
| 384 void HTMLMediaElement::setMediaStreamRegistry(URLRegistry* registry) { | 380 void HTMLMediaElement::setMediaStreamRegistry(URLRegistry* registry) { |
| 385 DCHECK(!s_mediaStreamRegistry); | 381 DCHECK(!s_mediaStreamRegistry); |
| 386 s_mediaStreamRegistry = registry; | 382 s_mediaStreamRegistry = registry; |
| 387 } | 383 } |
| 388 | 384 |
| 389 bool HTMLMediaElement::isMediaStreamURL(const String& url) { | 385 bool HTMLMediaElement::isMediaStreamURL(const String& url) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 BLINK_MEDIA_LOG << "setSrcObject(" << (void*)this << ")"; | 708 BLINK_MEDIA_LOG << "setSrcObject(" << (void*)this << ")"; |
| 713 m_srcObject = srcObject; | 709 m_srcObject = srcObject; |
| 714 invokeLoadAlgorithm(); | 710 invokeLoadAlgorithm(); |
| 715 } | 711 } |
| 716 | 712 |
| 717 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const { | 713 HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const { |
| 718 return m_networkState; | 714 return m_networkState; |
| 719 } | 715 } |
| 720 | 716 |
| 721 String HTMLMediaElement::canPlayType(const String& mimeType) const { | 717 String HTMLMediaElement::canPlayType(const String& mimeType) const { |
| 722 WebMimeRegistry::SupportsType support = supportsType(ContentType(mimeType)); | 718 MIMETypeRegistry::SupportsType support = supportsType(ContentType(mimeType)); |
| 723 String canPlay; | 719 String canPlay; |
| 724 | 720 |
| 725 // 4.8.10.3 | 721 // 4.8.10.3 |
| 726 switch (support) { | 722 switch (support) { |
| 727 case WebMimeRegistry::IsNotSupported: | 723 case MIMETypeRegistry::IsNotSupported: |
| 728 canPlay = emptyString(); | 724 canPlay = emptyString(); |
| 729 break; | 725 break; |
| 730 case WebMimeRegistry::MayBeSupported: | 726 case MIMETypeRegistry::MayBeSupported: |
| 731 canPlay = "maybe"; | 727 canPlay = "maybe"; |
| 732 break; | 728 break; |
| 733 case WebMimeRegistry::IsSupported: | 729 case MIMETypeRegistry::IsSupported: |
| 734 canPlay = "probably"; | 730 canPlay = "probably"; |
| 735 break; | 731 break; |
| 736 } | 732 } |
| 737 | 733 |
| 738 BLINK_MEDIA_LOG << "canPlayType(" << (void*)this << ", " << mimeType | 734 BLINK_MEDIA_LOG << "canPlayType(" << (void*)this << ", " << mimeType |
| 739 << ") -> " << canPlay; | 735 << ") -> " << canPlay; |
| 740 | 736 |
| 741 return canPlay; | 737 return canPlay; |
| 742 } | 738 } |
| 743 | 739 |
| (...skipping 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 | 4083 |
| 4088 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() | 4084 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() |
| 4089 const { | 4085 const { |
| 4090 IntRect result; | 4086 IntRect result; |
| 4091 if (LayoutObject* object = m_element->layoutObject()) | 4087 if (LayoutObject* object = m_element->layoutObject()) |
| 4092 result = object->absoluteBoundingBoxRect(); | 4088 result = object->absoluteBoundingBoxRect(); |
| 4093 return result; | 4089 return result; |
| 4094 } | 4090 } |
| 4095 | 4091 |
| 4096 } // namespace blink | 4092 } // namespace blink |
| OLD | NEW |