| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 , m_lastTextTrackUpdateTime(-1) | 277 , m_lastTextTrackUpdateTime(-1) |
| 278 , m_textTracks(0) | 278 , m_textTracks(0) |
| 279 , m_ignoreTrackDisplayUpdate(0) | 279 , m_ignoreTrackDisplayUpdate(0) |
| 280 #endif | 280 #endif |
| 281 #if ENABLE(WEB_AUDIO) | 281 #if ENABLE(WEB_AUDIO) |
| 282 , m_audioSourceNode(0) | 282 , m_audioSourceNode(0) |
| 283 #endif | 283 #endif |
| 284 { | 284 { |
| 285 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); | 285 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); |
| 286 document->registerForMediaVolumeCallbacks(this); | 286 document->registerForMediaVolumeCallbacks(this); |
| 287 document->registerForPrivateBrowsingStateChangedCallbacks(this); | |
| 288 | 287 |
| 289 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { | 288 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { |
| 290 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 289 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 291 addBehaviorRestriction(RequireUserGestureForLoadRestriction); | 290 addBehaviorRestriction(RequireUserGestureForLoadRestriction); |
| 292 } | 291 } |
| 293 | 292 |
| 294 setHasCustomStyleCallbacks(); | 293 setHasCustomStyleCallbacks(); |
| 295 addElementToDocumentMap(this, document); | 294 addElementToDocumentMap(this, document); |
| 296 | 295 |
| 297 #if ENABLE(VIDEO_TRACK) | 296 #if ENABLE(VIDEO_TRACK) |
| 298 document->registerForCaptionPreferencesChangedCallbacks(this); | 297 document->registerForCaptionPreferencesChangedCallbacks(this); |
| 299 #endif | 298 #endif |
| 300 } | 299 } |
| 301 | 300 |
| 302 HTMLMediaElement::~HTMLMediaElement() | 301 HTMLMediaElement::~HTMLMediaElement() |
| 303 { | 302 { |
| 304 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); | 303 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); |
| 305 if (m_isWaitingUntilMediaCanStart) | 304 if (m_isWaitingUntilMediaCanStart) |
| 306 document()->removeMediaCanStartListener(this); | 305 document()->removeMediaCanStartListener(this); |
| 307 setShouldDelayLoadEvent(false); | 306 setShouldDelayLoadEvent(false); |
| 308 document()->unregisterForMediaVolumeCallbacks(this); | 307 document()->unregisterForMediaVolumeCallbacks(this); |
| 309 document()->unregisterForPrivateBrowsingStateChangedCallbacks(this); | |
| 310 #if ENABLE(VIDEO_TRACK) | 308 #if ENABLE(VIDEO_TRACK) |
| 311 document()->unregisterForCaptionPreferencesChangedCallbacks(this); | 309 document()->unregisterForCaptionPreferencesChangedCallbacks(this); |
| 312 if (m_textTracks) | 310 if (m_textTracks) |
| 313 m_textTracks->clearOwner(); | 311 m_textTracks->clearOwner(); |
| 314 if (m_textTracks) { | 312 if (m_textTracks) { |
| 315 for (unsigned i = 0; i < m_textTracks->length(); ++i) | 313 for (unsigned i = 0; i < m_textTracks->length(); ++i) |
| 316 m_textTracks->item(i)->clearClient(); | 314 m_textTracks->item(i)->clearClient(); |
| 317 } | 315 } |
| 318 #endif | 316 #endif |
| 319 | 317 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogg
ingMedia(m_currentSrc).utf8().data()); | 897 LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogg
ingMedia(m_currentSrc).utf8().data()); |
| 900 | 898 |
| 901 #if ENABLE(MEDIA_STREAM) | 899 #if ENABLE(MEDIA_STREAM) |
| 902 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) | 900 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) |
| 903 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 901 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 904 #endif | 902 #endif |
| 905 | 903 |
| 906 if (m_sendProgressEvents) | 904 if (m_sendProgressEvents) |
| 907 startProgressEventTimer(); | 905 startProgressEventTimer(); |
| 908 | 906 |
| 909 Settings* settings = document()->settings(); | |
| 910 bool privateMode = !settings || settings->privateBrowsingEnabled(); | |
| 911 m_player->setPrivateBrowsingMode(privateMode); | |
| 912 | |
| 913 // Reset display mode to force a recalculation of what to show because we ar
e resetting the player. | 907 // Reset display mode to force a recalculation of what to show because we ar
e resetting the player. |
| 914 setDisplayMode(Unknown); | 908 setDisplayMode(Unknown); |
| 915 | 909 |
| 916 if (!autoplay()) | 910 if (!autoplay()) |
| 917 m_player->setPreload(m_preload); | 911 m_player->setPreload(m_preload); |
| 918 m_player->setPreservesPitch(m_webkitPreservesPitch); | 912 m_player->setPreservesPitch(m_webkitPreservesPitch); |
| 919 | 913 |
| 920 if (fastHasAttribute(mutedAttr)) | 914 if (fastHasAttribute(mutedAttr)) |
| 921 m_muted = true; | 915 m_muted = true; |
| 922 updateVolume(); | 916 updateVolume(); |
| (...skipping 3137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 void HTMLMediaElement::clearMediaCacheForSite(const String& site) | 4054 void HTMLMediaElement::clearMediaCacheForSite(const String& site) |
| 4061 { | 4055 { |
| 4062 MediaPlayer::clearMediaCacheForSite(site); | 4056 MediaPlayer::clearMediaCacheForSite(site); |
| 4063 } | 4057 } |
| 4064 | 4058 |
| 4065 void HTMLMediaElement::resetMediaEngines() | 4059 void HTMLMediaElement::resetMediaEngines() |
| 4066 { | 4060 { |
| 4067 MediaPlayer::resetMediaEngines(); | 4061 MediaPlayer::resetMediaEngines(); |
| 4068 } | 4062 } |
| 4069 | 4063 |
| 4070 void HTMLMediaElement::privateBrowsingStateDidChange() | |
| 4071 { | |
| 4072 if (!m_player) | |
| 4073 return; | |
| 4074 | |
| 4075 Settings* settings = document()->settings(); | |
| 4076 bool privateMode = !settings || settings->privateBrowsingEnabled(); | |
| 4077 LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString
(privateMode)); | |
| 4078 m_player->setPrivateBrowsingMode(privateMode); | |
| 4079 } | |
| 4080 | |
| 4081 MediaControls* HTMLMediaElement::mediaControls() const | 4064 MediaControls* HTMLMediaElement::mediaControls() const |
| 4082 { | 4065 { |
| 4083 return toMediaControls(userAgentShadowRoot()->firstChild()); | 4066 return toMediaControls(userAgentShadowRoot()->firstChild()); |
| 4084 } | 4067 } |
| 4085 | 4068 |
| 4086 bool HTMLMediaElement::hasMediaControls() const | 4069 bool HTMLMediaElement::hasMediaControls() const |
| 4087 { | 4070 { |
| 4088 if (ShadowRoot* userAgent = userAgentShadowRoot()) { | 4071 if (ShadowRoot* userAgent = userAgentShadowRoot()) { |
| 4089 Node* node = userAgent->firstChild(); | 4072 Node* node = userAgent->firstChild(); |
| 4090 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); | 4073 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4563 info.addMember(m_mediaController, "mediaController"); | 4546 info.addMember(m_mediaController, "mediaController"); |
| 4564 | 4547 |
| 4565 #if ENABLE(WEB_AUDIO) | 4548 #if ENABLE(WEB_AUDIO) |
| 4566 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4549 info.addMember(m_audioSourceNode, "audioSourceNode"); |
| 4567 #endif | 4550 #endif |
| 4568 | 4551 |
| 4569 } | 4552 } |
| 4570 | 4553 |
| 4571 } | 4554 } |
| 4572 #endif | 4555 #endif |
| OLD | NEW |