| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return m_audioSourceProvider; | 286 return m_audioSourceProvider; |
| 287 } | 287 } |
| 288 | 288 |
| 289 enum InvalidURLAction { DoNothing, Complain }; | 289 enum InvalidURLAction { DoNothing, Complain }; |
| 290 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 290 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 291 | 291 |
| 292 // Checks to see if current media data is CORS-same-origin as the | 292 // Checks to see if current media data is CORS-same-origin as the |
| 293 // specified origin. | 293 // specified origin. |
| 294 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 294 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 295 | 295 |
| 296 // Returns this media element is in a cross-origin frame. |
| 297 bool isInCrossOriginFrame() const; |
| 298 |
| 296 void scheduleEvent(Event*); | 299 void scheduleEvent(Event*); |
| 297 void scheduleTimeupdateEvent(bool periodicEvent); | 300 void scheduleTimeupdateEvent(bool periodicEvent); |
| 298 | 301 |
| 299 // Returns the "effective media volume" value as specified in the HTML5 spec. | 302 // Returns the "effective media volume" value as specified in the HTML5 spec. |
| 300 double effectiveMediaVolume() const; | 303 double effectiveMediaVolume() const; |
| 301 | 304 |
| 302 // Predicates also used when dispatching wrapper creation (cf. | 305 // Predicates also used when dispatching wrapper creation (cf. |
| 303 // [SpecialWrapFor] IDL attribute usage.) | 306 // [SpecialWrapFor] IDL attribute usage.) |
| 304 virtual bool isHTMLAudioElement() const { return false; } | 307 virtual bool isHTMLAudioElement() const { return false; } |
| 305 virtual bool isHTMLVideoElement() const { return false; } | 308 virtual bool isHTMLVideoElement() const { return false; } |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 // Sets the selected/enabled tracks if they aren't set before we initially | 506 // Sets the selected/enabled tracks if they aren't set before we initially |
| 504 // transition to kHaveMetadata. | 507 // transition to kHaveMetadata. |
| 505 void selectInitialTracksIfNecessary(); | 508 void selectInitialTracksIfNecessary(); |
| 506 | 509 |
| 507 // Return true if and only if a user gesture is required to unlock this | 510 // Return true if and only if a user gesture is required to unlock this |
| 508 // media element for unrestricted autoplay / script control. Don't confuse | 511 // media element for unrestricted autoplay / script control. Don't confuse |
| 509 // this with isGestureNeededForPlayback(). The latter is usually what one | 512 // this with isGestureNeededForPlayback(). The latter is usually what one |
| 510 // should use, if checking to see if an action is allowed. | 513 // should use, if checking to see if an action is allowed. |
| 511 bool isLockedPendingUserGesture() const; | 514 bool isLockedPendingUserGesture() const; |
| 512 | 515 |
| 516 bool isLockedPendingUserGestureIfCrossOriginExperimentEnabled() const; |
| 517 |
| 513 // If the user gesture is required, then this will remove it. Note that | 518 // If the user gesture is required, then this will remove it. Note that |
| 514 // one should not generally call this method directly; use the one on | 519 // one should not generally call this method directly; use the one on |
| 515 // m_helper and give it a reason. | 520 // m_helper and give it a reason. |
| 516 void unlockUserGesture(); | 521 void unlockUserGesture(); |
| 517 | 522 |
| 518 // Return true if and only if a user gesture is requried for playback. Even | 523 // Return true if and only if a user gesture is requried for playback. Even |
| 519 // if isLockedPendingUserGesture() return true, this might return false if | 524 // if isLockedPendingUserGesture() return true, this might return false if |
| 520 // the requirement is currently overridden. This does not check if a user | 525 // the requirement is currently overridden. This does not check if a user |
| 521 // gesture is currently being processed. | 526 // gesture is currently being processed. |
| 522 bool isGestureNeededForPlayback() const; | 527 bool isGestureNeededForPlayback() const; |
| 523 | 528 |
| 529 bool isGestureNeededForPlaybackIfCrossOriginExperimentEnabled() const; |
| 530 |
| 524 // Return true if and only if the settings allow autoplay of media on this | 531 // Return true if and only if the settings allow autoplay of media on this |
| 525 // frame. | 532 // frame. |
| 526 bool isAutoplayAllowedPerSettings() const; | 533 bool isAutoplayAllowedPerSettings() const; |
| 527 | 534 |
| 528 void setNetworkState(NetworkState); | 535 void setNetworkState(NetworkState); |
| 529 | 536 |
| 530 void audioTracksTimerFired(TimerBase*); | 537 void audioTracksTimerFired(TimerBase*); |
| 531 | 538 |
| 532 void scheduleResolvePlayPromises(); | 539 void scheduleResolvePlayPromises(); |
| 533 void scheduleRejectPlayPromises(ExceptionCode); | 540 void scheduleRejectPlayPromises(ExceptionCode); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 mutable double m_officialPlaybackPosition; | 626 mutable double m_officialPlaybackPosition; |
| 620 mutable bool m_officialPlaybackPositionNeedsUpdate; | 627 mutable bool m_officialPlaybackPositionNeedsUpdate; |
| 621 | 628 |
| 622 double m_fragmentEndTime; | 629 double m_fragmentEndTime; |
| 623 | 630 |
| 624 typedef unsigned PendingActionFlags; | 631 typedef unsigned PendingActionFlags; |
| 625 PendingActionFlags m_pendingActionFlags; | 632 PendingActionFlags m_pendingActionFlags; |
| 626 | 633 |
| 627 // FIXME: HTMLMediaElement has way too many state bits. | 634 // FIXME: HTMLMediaElement has way too many state bits. |
| 628 bool m_lockedPendingUserGesture : 1; | 635 bool m_lockedPendingUserGesture : 1; |
| 636 bool m_lockedPendingUserGestureIfCrossOriginExperimentEnabled : 1; |
| 629 bool m_playing : 1; | 637 bool m_playing : 1; |
| 630 bool m_shouldDelayLoadEvent : 1; | 638 bool m_shouldDelayLoadEvent : 1; |
| 631 bool m_haveFiredLoadedData : 1; | 639 bool m_haveFiredLoadedData : 1; |
| 632 bool m_autoplaying : 1; | 640 bool m_autoplaying : 1; |
| 633 bool m_muted : 1; | 641 bool m_muted : 1; |
| 634 bool m_paused : 1; | 642 bool m_paused : 1; |
| 635 bool m_seeking : 1; | 643 bool m_seeking : 1; |
| 636 | 644 |
| 637 // data has not been loaded since sending a "stalled" event | 645 // data has not been loaded since sending a "stalled" event |
| 638 bool m_sentStalledEvent : 1; | 646 bool m_sentStalledEvent : 1; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 | 747 |
| 740 inline bool isHTMLMediaElement(const HTMLElement& element) { | 748 inline bool isHTMLMediaElement(const HTMLElement& element) { |
| 741 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 749 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 742 } | 750 } |
| 743 | 751 |
| 744 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 752 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 745 | 753 |
| 746 } // namespace blink | 754 } // namespace blink |
| 747 | 755 |
| 748 #endif // HTMLMediaElement_h | 756 #endif // HTMLMediaElement_h |
| OLD | NEW |