| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which | 228 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which |
| 229 // causes an ambiguity error at compile time. This class's constructor | 229 // causes an ambiguity error at compile time. This class's constructor |
| 230 // ensures that both implementations return document, so return the result | 230 // ensures that both implementations return document, so return the result |
| 231 // of one of them here. | 231 // of one of them here. |
| 232 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return H
TMLElement::executionContext(); } | 232 virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return H
TMLElement::executionContext(); } |
| 233 | 233 |
| 234 bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSing
leSecurityOrigin(); } | 234 bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSing
leSecurityOrigin(); } |
| 235 | 235 |
| 236 bool isFullscreen() const; | 236 bool isFullscreen() const; |
| 237 virtual void enterFullscreen() OVERRIDE FINAL; | 237 virtual void enterFullscreen() OVERRIDE FINAL; |
| 238 void exitFullscreen(); |
| 238 | 239 |
| 239 virtual bool hasClosedCaptions() const OVERRIDE FINAL; | 240 virtual bool hasClosedCaptions() const OVERRIDE FINAL; |
| 240 virtual bool closedCaptionsVisible() const OVERRIDE FINAL; | 241 virtual bool closedCaptionsVisible() const OVERRIDE FINAL; |
| 241 virtual void setClosedCaptionsVisible(bool) OVERRIDE FINAL; | 242 virtual void setClosedCaptionsVisible(bool) OVERRIDE FINAL; |
| 242 | 243 |
| 243 MediaControls* mediaControls() const; | 244 MediaControls* mediaControls() const; |
| 244 | 245 |
| 245 void sourceWasRemoved(HTMLSourceElement*); | 246 void sourceWasRemoved(HTMLSourceElement*); |
| 246 void sourceWasAdded(HTMLSourceElement*); | 247 void sourceWasAdded(HTMLSourceElement*); |
| 247 | 248 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 278 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 279 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
| 279 | 280 |
| 280 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; | 281 enum DisplayMode { Unknown, Poster, PosterWaitingForVideo, Video }; |
| 281 DisplayMode displayMode() const { return m_displayMode; } | 282 DisplayMode displayMode() const { return m_displayMode; } |
| 282 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 283 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
| 283 | 284 |
| 284 virtual bool isMediaElement() const OVERRIDE FINAL { return true; } | 285 virtual bool isMediaElement() const OVERRIDE FINAL { return true; } |
| 285 | 286 |
| 286 void setControllerInternal(PassRefPtr<MediaController>); | 287 void setControllerInternal(PassRefPtr<MediaController>); |
| 287 | 288 |
| 289 // Restrictions to change default behaviors. |
| 290 enum BehaviorRestrictionFlags { |
| 291 NoRestrictions = 0, |
| 292 RequireUserGestureForPlayRestriction = 1 << 0, |
| 293 RequireUserGestureForFullscreenRestriction = 1 << 1, |
| 294 }; |
| 295 typedef unsigned BehaviorRestrictions; |
| 296 |
| 297 bool userGestureRequiredForPlay() const { return m_restrictions & RequireUse
rGestureForPlayRestriction; } |
| 298 bool userGestureRequiredForFullscreen() const { return m_restrictions & Requ
ireUserGestureForFullscreenRestriction; } |
| 299 |
| 300 void addBehaviorRestriction(BehaviorRestrictions restriction) { m_restrictio
ns |= restriction; } |
| 301 void removeBehaviorRestriction(BehaviorRestrictions restriction) { m_restric
tions &= ~restriction; } |
| 302 |
| 288 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU
pdate > 0; } | 303 bool ignoreTrackDisplayUpdateRequests() const { return m_ignoreTrackDisplayU
pdate > 0; } |
| 289 void beginIgnoringTrackDisplayUpdateRequests(); | 304 void beginIgnoringTrackDisplayUpdateRequests(); |
| 290 void endIgnoringTrackDisplayUpdateRequests(); | 305 void endIgnoringTrackDisplayUpdateRequests(); |
| 291 | 306 |
| 292 private: | 307 private: |
| 293 void createMediaPlayer(); | 308 void createMediaPlayer(); |
| 294 | 309 |
| 295 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE FINAL { return
true; } | 310 virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE FINAL { return
true; } |
| 296 virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false;
} | 311 virtual bool areAuthorShadowsAllowed() const OVERRIDE FINAL { return false;
} |
| 297 | 312 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 bool createMediaControls(); | 414 bool createMediaControls(); |
| 400 void configureMediaControls(); | 415 void configureMediaControls(); |
| 401 | 416 |
| 402 void prepareMediaFragmentURI(); | 417 void prepareMediaFragmentURI(); |
| 403 void applyMediaFragmentURI(); | 418 void applyMediaFragmentURI(); |
| 404 | 419 |
| 405 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; | 420 virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL; |
| 406 | 421 |
| 407 void changeNetworkStateFromLoadingToIdle(); | 422 void changeNetworkStateFromLoadingToIdle(); |
| 408 | 423 |
| 424 void removeBehaviorsRestrictionsAfterFirstUserGesture(); |
| 425 |
| 409 const AtomicString& mediaGroup() const; | 426 const AtomicString& mediaGroup() const; |
| 410 void setMediaGroup(const AtomicString&); | 427 void setMediaGroup(const AtomicString&); |
| 411 void updateMediaController(); | 428 void updateMediaController(); |
| 412 bool isBlocked() const; | 429 bool isBlocked() const; |
| 413 bool isBlockedOnMediaController() const; | 430 bool isBlockedOnMediaController() const; |
| 414 bool isAutoplaying() const { return m_autoplaying; } | 431 bool isAutoplaying() const { return m_autoplaying; } |
| 415 | 432 |
| 416 Timer<HTMLMediaElement> m_loadTimer; | 433 Timer<HTMLMediaElement> m_loadTimer; |
| 417 Timer<HTMLMediaElement> m_progressEventTimer; | 434 Timer<HTMLMediaElement> m_progressEventTimer; |
| 418 Timer<HTMLMediaElement> m_playbackProgressTimer; | 435 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 445 // Loading state. | 462 // Loading state. |
| 446 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 463 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
| 447 LoadState m_loadState; | 464 LoadState m_loadState; |
| 448 RefPtr<HTMLSourceElement> m_currentSourceNode; | 465 RefPtr<HTMLSourceElement> m_currentSourceNode; |
| 449 RefPtr<Node> m_nextChildNodeToConsider; | 466 RefPtr<Node> m_nextChildNodeToConsider; |
| 450 | 467 |
| 451 OwnPtr<MediaPlayer> m_player; | 468 OwnPtr<MediaPlayer> m_player; |
| 452 blink::WebLayer* m_webLayer; | 469 blink::WebLayer* m_webLayer; |
| 453 bool m_opaque; | 470 bool m_opaque; |
| 454 | 471 |
| 472 BehaviorRestrictions m_restrictions; |
| 473 |
| 455 MediaPlayer::Preload m_preload; | 474 MediaPlayer::Preload m_preload; |
| 456 | 475 |
| 457 DisplayMode m_displayMode; | 476 DisplayMode m_displayMode; |
| 458 | 477 |
| 459 RefPtr<HTMLMediaSource> m_mediaSource; | 478 RefPtr<HTMLMediaSource> m_mediaSource; |
| 460 | 479 |
| 461 mutable double m_cachedTime; | 480 mutable double m_cachedTime; |
| 462 mutable double m_cachedTimeWallClockUpdateTime; | 481 mutable double m_cachedTimeWallClockUpdateTime; |
| 463 mutable double m_minimumWallClockTimeToCacheMediaTime; | 482 mutable double m_minimumWallClockTimeToCacheMediaTime; |
| 464 | 483 |
| 465 double m_fragmentStartTime; | 484 double m_fragmentStartTime; |
| 466 double m_fragmentEndTime; | 485 double m_fragmentEndTime; |
| 467 | 486 |
| 468 typedef unsigned PendingActionFlags; | 487 typedef unsigned PendingActionFlags; |
| 469 PendingActionFlags m_pendingActionFlags; | 488 PendingActionFlags m_pendingActionFlags; |
| 470 | 489 |
| 471 // FIXME: MediaElement has way too many state bits. | 490 // FIXME: MediaElement has way too many state bits. |
| 472 bool m_userGestureRequiredForPlay : 1; | |
| 473 bool m_playing : 1; | 491 bool m_playing : 1; |
| 474 bool m_shouldDelayLoadEvent : 1; | 492 bool m_shouldDelayLoadEvent : 1; |
| 475 bool m_haveFiredLoadedData : 1; | 493 bool m_haveFiredLoadedData : 1; |
| 476 bool m_active : 1; | 494 bool m_active : 1; |
| 477 bool m_autoplaying : 1; | 495 bool m_autoplaying : 1; |
| 478 bool m_muted : 1; | 496 bool m_muted : 1; |
| 479 bool m_paused : 1; | 497 bool m_paused : 1; |
| 480 bool m_seeking : 1; | 498 bool m_seeking : 1; |
| 481 | 499 |
| 482 // data has not been loaded since sending a "stalled" event | 500 // data has not been loaded since sending a "stalled" event |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 inline bool isHTMLMediaElement(const Node& node) | 560 inline bool isHTMLMediaElement(const Node& node) |
| 543 { | 561 { |
| 544 return node.isElementNode() && toElement(node).isMediaElement(); | 562 return node.isElementNode() && toElement(node).isMediaElement(); |
| 545 } | 563 } |
| 546 | 564 |
| 547 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 565 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 548 | 566 |
| 549 } //namespace | 567 } //namespace |
| 550 | 568 |
| 551 #endif | 569 #endif |
| OLD | NEW |