| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 , m_lastTextTrackUpdateTime(-1) | 273 , m_lastTextTrackUpdateTime(-1) |
| 274 , m_textTracks(0) | 274 , m_textTracks(0) |
| 275 , m_ignoreTrackDisplayUpdate(0) | 275 , m_ignoreTrackDisplayUpdate(0) |
| 276 #endif | 276 #endif |
| 277 #if ENABLE(WEB_AUDIO) | 277 #if ENABLE(WEB_AUDIO) |
| 278 , m_audioSourceNode(0) | 278 , m_audioSourceNode(0) |
| 279 #endif | 279 #endif |
| 280 { | 280 { |
| 281 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); | 281 LOG(Media, "HTMLMediaElement::HTMLMediaElement"); |
| 282 document->registerForMediaVolumeCallbacks(this); | 282 document->registerForMediaVolumeCallbacks(this); |
| 283 document->registerForPrivateBrowsingStateChangedCallbacks(this); | |
| 284 | 283 |
| 285 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { | 284 if (document->settings() && document->settings()->mediaPlaybackRequiresUserG
esture()) { |
| 286 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 285 addBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 287 addBehaviorRestriction(RequireUserGestureForLoadRestriction); | 286 addBehaviorRestriction(RequireUserGestureForLoadRestriction); |
| 288 } | 287 } |
| 289 | 288 |
| 290 setHasCustomStyleCallbacks(); | 289 setHasCustomStyleCallbacks(); |
| 291 addElementToDocumentMap(this, document); | 290 addElementToDocumentMap(this, document); |
| 292 | 291 |
| 293 #if ENABLE(VIDEO_TRACK) | 292 #if ENABLE(VIDEO_TRACK) |
| 294 document->registerForCaptionPreferencesChangedCallbacks(this); | 293 document->registerForCaptionPreferencesChangedCallbacks(this); |
| 295 #endif | 294 #endif |
| 296 } | 295 } |
| 297 | 296 |
| 298 HTMLMediaElement::~HTMLMediaElement() | 297 HTMLMediaElement::~HTMLMediaElement() |
| 299 { | 298 { |
| 300 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); | 299 LOG(Media, "HTMLMediaElement::~HTMLMediaElement"); |
| 301 if (m_isWaitingUntilMediaCanStart) | 300 if (m_isWaitingUntilMediaCanStart) |
| 302 document()->removeMediaCanStartListener(this); | 301 document()->removeMediaCanStartListener(this); |
| 303 setShouldDelayLoadEvent(false); | 302 setShouldDelayLoadEvent(false); |
| 304 document()->unregisterForMediaVolumeCallbacks(this); | 303 document()->unregisterForMediaVolumeCallbacks(this); |
| 305 document()->unregisterForPrivateBrowsingStateChangedCallbacks(this); | |
| 306 #if ENABLE(VIDEO_TRACK) | 304 #if ENABLE(VIDEO_TRACK) |
| 307 document()->unregisterForCaptionPreferencesChangedCallbacks(this); | 305 document()->unregisterForCaptionPreferencesChangedCallbacks(this); |
| 308 if (m_textTracks) | 306 if (m_textTracks) |
| 309 m_textTracks->clearOwner(); | 307 m_textTracks->clearOwner(); |
| 310 if (m_textTracks) { | 308 if (m_textTracks) { |
| 311 for (unsigned i = 0; i < m_textTracks->length(); ++i) | 309 for (unsigned i = 0; i < m_textTracks->length(); ++i) |
| 312 m_textTracks->item(i)->clearClient(); | 310 m_textTracks->item(i)->clearClient(); |
| 313 } | 311 } |
| 314 #endif | 312 #endif |
| 315 | 313 |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogg
ingMedia(m_currentSrc).utf8().data()); | 889 LOG(Media, "HTMLMediaElement::loadResource - m_currentSrc -> %s", urlForLogg
ingMedia(m_currentSrc).utf8().data()); |
| 892 | 890 |
| 893 #if ENABLE(MEDIA_STREAM) | 891 #if ENABLE(MEDIA_STREAM) |
| 894 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) | 892 if (MediaStreamRegistry::registry().lookupMediaStreamDescriptor(url.string()
)) |
| 895 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); | 893 removeBehaviorRestriction(RequireUserGestureForRateChangeRestriction); |
| 896 #endif | 894 #endif |
| 897 | 895 |
| 898 if (m_sendProgressEvents) | 896 if (m_sendProgressEvents) |
| 899 startProgressEventTimer(); | 897 startProgressEventTimer(); |
| 900 | 898 |
| 901 Settings* settings = document()->settings(); | |
| 902 bool privateMode = !settings || settings->privateBrowsingEnabled(); | |
| 903 m_player->setPrivateBrowsingMode(privateMode); | |
| 904 | |
| 905 // Reset display mode to force a recalculation of what to show because we ar
e resetting the player. | 899 // Reset display mode to force a recalculation of what to show because we ar
e resetting the player. |
| 906 setDisplayMode(Unknown); | 900 setDisplayMode(Unknown); |
| 907 | 901 |
| 908 if (!autoplay()) | 902 if (!autoplay()) |
| 909 m_player->setPreload(m_preload); | 903 m_player->setPreload(m_preload); |
| 910 m_player->setPreservesPitch(m_webkitPreservesPitch); | 904 m_player->setPreservesPitch(m_webkitPreservesPitch); |
| 911 | 905 |
| 912 if (fastHasAttribute(mutedAttr)) | 906 if (fastHasAttribute(mutedAttr)) |
| 913 m_muted = true; | 907 m_muted = true; |
| 914 updateVolume(); | 908 updateVolume(); |
| (...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4048 void HTMLMediaElement::clearMediaCacheForSite(const String& site) | 4042 void HTMLMediaElement::clearMediaCacheForSite(const String& site) |
| 4049 { | 4043 { |
| 4050 MediaPlayer::clearMediaCacheForSite(site); | 4044 MediaPlayer::clearMediaCacheForSite(site); |
| 4051 } | 4045 } |
| 4052 | 4046 |
| 4053 void HTMLMediaElement::resetMediaEngines() | 4047 void HTMLMediaElement::resetMediaEngines() |
| 4054 { | 4048 { |
| 4055 MediaPlayer::resetMediaEngines(); | 4049 MediaPlayer::resetMediaEngines(); |
| 4056 } | 4050 } |
| 4057 | 4051 |
| 4058 void HTMLMediaElement::privateBrowsingStateDidChange() | |
| 4059 { | |
| 4060 if (!m_player) | |
| 4061 return; | |
| 4062 | |
| 4063 Settings* settings = document()->settings(); | |
| 4064 bool privateMode = !settings || settings->privateBrowsingEnabled(); | |
| 4065 LOG(Media, "HTMLMediaElement::privateBrowsingStateDidChange(%s)", boolString
(privateMode)); | |
| 4066 m_player->setPrivateBrowsingMode(privateMode); | |
| 4067 } | |
| 4068 | |
| 4069 MediaControls* HTMLMediaElement::mediaControls() const | 4052 MediaControls* HTMLMediaElement::mediaControls() const |
| 4070 { | 4053 { |
| 4071 return toMediaControls(userAgentShadowRoot()->firstChild()); | 4054 return toMediaControls(userAgentShadowRoot()->firstChild()); |
| 4072 } | 4055 } |
| 4073 | 4056 |
| 4074 bool HTMLMediaElement::hasMediaControls() const | 4057 bool HTMLMediaElement::hasMediaControls() const |
| 4075 { | 4058 { |
| 4076 if (ShadowRoot* userAgent = userAgentShadowRoot()) { | 4059 if (ShadowRoot* userAgent = userAgentShadowRoot()) { |
| 4077 Node* node = userAgent->firstChild(); | 4060 Node* node = userAgent->firstChild(); |
| 4078 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); | 4061 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4536 info.addMember(m_mediaController, "mediaController"); | 4519 info.addMember(m_mediaController, "mediaController"); |
| 4537 | 4520 |
| 4538 #if ENABLE(WEB_AUDIO) | 4521 #if ENABLE(WEB_AUDIO) |
| 4539 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4522 info.addMember(m_audioSourceNode, "audioSourceNode"); |
| 4540 #endif | 4523 #endif |
| 4541 | 4524 |
| 4542 } | 4525 } |
| 4543 | 4526 |
| 4544 } | 4527 } |
| 4545 #endif | 4528 #endif |
| OLD | NEW |