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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 291 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
292 | 292 |
293 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; | 293 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; |
294 DisplayMode displayMode() const { return m_displayMode; } | 294 DisplayMode displayMode() const { return m_displayMode; } |
295 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 295 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
296 | 296 |
297 virtual bool isMediaElement() const OVERRIDE FINAL { return true; } | 297 virtual bool isMediaElement() const OVERRIDE FINAL { return true; } |
298 | 298 |
299 void setControllerInternal(PassRefPtr<MediaController>); | 299 void setControllerInternal(PassRefPtr<MediaController>); |
300 | 300 |
301 // Restrictions to change default behaviors. | |
302 enum BehaviorRestrictionFlags { | |
303 NoRestrictions = 0, | |
304 RequireUserGestureForPlayRestriction = 1 << 0, | |
305 }; | |
306 typedef unsigned BehaviorRestrictions; | |
307 | |
308 bool userGestureRequiredForPlay() const { return m_restrictions & RequireUse
rGestureForPlayRestriction; } | |
309 | |
310 void addBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictio
ns |= restriction; } | |
311 void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restric
tions &= ~restriction; } | |
312 | |
313 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU
pdate > 0; } | 301 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU
pdate > 0; } |
314 void beginIgnoringTrackDisplayUpdateRequests(); | 302 void beginIgnoringTrackDisplayUpdateRequests(); |
315 void endIgnoringTrackDisplayUpdateRequests(); | 303 void endIgnoringTrackDisplayUpdateRequests(); |
316 | 304 |
317 private: | 305 private: |
318 void createMediaPlayer(); | 306 void createMediaPlayer(); |
319 | 307 |
320 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE FINAL { return
true; } | 308 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE FINAL { return
true; } |
321 virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false;
} | 309 virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false;
} |
322 | 310 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 bool createMediaControls(); | 417 bool createMediaControls(); |
430 void configureMediaControls(); | 418 void configureMediaControls(); |
431 | 419 |
432 void prepareMediaFragmentURI(); | 420 void prepareMediaFragmentURI(); |
433 void applyMediaFragmentURI(); | 421 void applyMediaFragmentURI(); |
434 | 422 |
435 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; | 423 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; |
436 | 424 |
437 void changeNetworkStateFromLoadingToIdle(); | 425 void changeNetworkStateFromLoadingToIdle(); |
438 | 426 |
439 void removeBehaviorsRestrictionsAfterFirstUserGesture(); | |
440 | |
441 const AtomicString& mediaGroup() const; | 427 const AtomicString& mediaGroup() const; |
442 void setMediaGroup(const AtomicString&); | 428 void setMediaGroup(const AtomicString&); |
443 void updateMediaController(); | 429 void updateMediaController(); |
444 bool isBlocked() const; | 430 bool isBlocked() const; |
445 bool isBlockedOnMediaController() const; | 431 bool isBlockedOnMediaController() const; |
446 bool isAutoplaying() const { return m_autoplaying; } | 432 bool isAutoplaying() const { return m_autoplaying; } |
447 | 433 |
448 // Currently we have both EME v0.1b and EME WD implemented in media element. | 434 // Currently we have both EME v0.1b and EME WD implemented in media element. |
449 // But we do not want to support both at the same time. The one used first | 435 // But we do not want to support both at the same time. The one used first |
450 // will be supported. Use |m_emeMode| to track this selection. | 436 // will be supported. Use |m_emeMode| to track this selection. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // Loading state. | 476 // Loading state. |
491 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 477 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
492 LoadState m_loadState; | 478 LoadState m_loadState; |
493 RefPtr<HTMLSourceElement> m_currentSourceNode; | 479 RefPtr<HTMLSourceElement> m_currentSourceNode; |
494 RefPtr<Node> m_nextChildNodeToConsider; | 480 RefPtr<Node> m_nextChildNodeToConsider; |
495 | 481 |
496 OwnPtr<MediaPlayer> m_player; | 482 OwnPtr<MediaPlayer> m_player; |
497 blink::WebLayer* m_webLayer; | 483 blink::WebLayer* m_webLayer; |
498 bool m_opaque; | 484 bool m_opaque; |
499 | 485 |
500 BehaviorRestrictions m_restrictions; | |
501 | |
502 MediaPlayer::Preload m_preload; | 486 MediaPlayer::Preload m_preload; |
503 | 487 |
504 DisplayMode m_displayMode; | 488 DisplayMode m_displayMode; |
505 | 489 |
506 RefPtr<HTMLMediaSource> m_mediaSource; | 490 RefPtr<HTMLMediaSource> m_mediaSource; |
507 | 491 |
508 mutable double m_cachedTime; | 492 mutable double m_cachedTime; |
509 mutable double m_cachedTimeWallClockUpdateTime; | 493 mutable double m_cachedTimeWallClockUpdateTime; |
510 mutable double m_minimumWallClockTimeToCacheMediaTime; | 494 mutable double m_minimumWallClockTimeToCacheMediaTime; |
511 | 495 |
512 double m_fragmentStartTime; | 496 double m_fragmentStartTime; |
513 double m_fragmentEndTime; | 497 double m_fragmentEndTime; |
514 | 498 |
515 typedef unsigned PendingActionFlags; | 499 typedef unsigned PendingActionFlags; |
516 PendingActionFlags m_pendingActionFlags; | 500 PendingActionFlags m_pendingActionFlags; |
517 | 501 |
518 // FIXME: MediaElement has way too many state bits. | 502 // FIXME: MediaElement has way too many state bits. |
| 503 bool m_userGestureRequiredForPlay : 1; |
519 bool m_playing : 1; | 504 bool m_playing : 1; |
520 bool m_shouldDelayLoadEvent : 1; | 505 bool m_shouldDelayLoadEvent : 1; |
521 bool m_haveFiredLoadedData : 1; | 506 bool m_haveFiredLoadedData : 1; |
522 bool m_active : 1; | 507 bool m_active : 1; |
523 bool m_autoplaying : 1; | 508 bool m_autoplaying : 1; |
524 bool m_muted : 1; | 509 bool m_muted : 1; |
525 bool m_paused : 1; | 510 bool m_paused : 1; |
526 bool m_seeking : 1; | 511 bool m_seeking : 1; |
527 | 512 |
528 // data has not been loaded since sending a "stalled" event | 513 // data has not been loaded since sending a "stalled" event |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 inline bool isHTMLMediaElement(const Node& node) | 577 inline bool isHTMLMediaElement(const Node& node) |
593 { | 578 { |
594 return node.isElementNode() && toElement(node).isMediaElement(); | 579 return node.isElementNode() && toElement(node).isMediaElement(); |
595 } | 580 } |
596 | 581 |
597 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 582 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
598 | 583 |
599 } //namespace | 584 } //namespace |
600 | 585 |
601 #endif | 586 #endif |
OLD | NEW |