Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 291163004: Implement media cast buttons (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Make sure cast button intercepts touches Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 , m_seeking(false) 347 , m_seeking(false)
348 , m_sentStalledEvent(false) 348 , m_sentStalledEvent(false)
349 , m_sentEndEvent(false) 349 , m_sentEndEvent(false)
350 , m_pausedInternal(false) 350 , m_pausedInternal(false)
351 , m_closedCaptionsVisible(false) 351 , m_closedCaptionsVisible(false)
352 , m_completelyLoaded(false) 352 , m_completelyLoaded(false)
353 , m_havePreparedToPlay(false) 353 , m_havePreparedToPlay(false)
354 , m_tracksAreReady(true) 354 , m_tracksAreReady(true)
355 , m_haveVisibleTextTrack(false) 355 , m_haveVisibleTextTrack(false)
356 , m_processingPreferenceChange(false) 356 , m_processingPreferenceChange(false)
357 , m_remoteRoutesAvailable(false)
358 , m_playingRemotely(false)
357 #if ENABLE(OILPAN) 359 #if ENABLE(OILPAN)
358 , m_isFinalizing(false) 360 , m_isFinalizing(false)
359 , m_closeMediaSourceWhenFinalizing(false) 361 , m_closeMediaSourceWhenFinalizing(false)
360 #endif 362 #endif
361 , m_lastTextTrackUpdateTime(-1) 363 , m_lastTextTrackUpdateTime(-1)
362 , m_audioTracks(AudioTrackList::create(*this)) 364 , m_audioTracks(AudioTrackList::create(*this))
363 , m_videoTracks(VideoTrackList::create(*this)) 365 , m_videoTracks(VideoTrackList::create(*this))
364 , m_textTracks(nullptr) 366 , m_textTracks(nullptr)
365 , m_ignoreTrackDisplayUpdate(0) 367 , m_ignoreTrackDisplayUpdate(0)
366 #if ENABLE(WEB_AUDIO) 368 #if ENABLE(WEB_AUDIO)
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
2273 2275
2274 if (!m_paused) { 2276 if (!m_paused) {
2275 m_paused = true; 2277 m_paused = true;
2276 scheduleTimeupdateEvent(false); 2278 scheduleTimeupdateEvent(false);
2277 scheduleEvent(EventTypeNames::pause); 2279 scheduleEvent(EventTypeNames::pause);
2278 } 2280 }
2279 2281
2280 updatePlayState(); 2282 updatePlayState();
2281 } 2283 }
2282 2284
2285 void HTMLMediaElement::requestRemotePlayback()
2286 {
2287 if (!m_player)
acolwell GONE FROM CHROMIUM 2014/09/06 00:32:02 Please add code to clearMediaPlayer() and createMe
aberent 2014/09/09 18:35:30 Done.
2288 return;
2289 ASSERT(m_remoteRoutesAvailable);
2290 webMediaPlayer()->requestRemotePlayback();
2291 }
2292
2293 void HTMLMediaElement::requestRemotePlaybackControl()
2294 {
2295 if (!m_player)
2296 return;
2297 ASSERT(m_remoteRoutesAvailable);
2298 webMediaPlayer()->requestRemotePlaybackControl();
2299 }
2300
2283 void HTMLMediaElement::closeMediaSource() 2301 void HTMLMediaElement::closeMediaSource()
2284 { 2302 {
2285 if (!m_mediaSource) 2303 if (!m_mediaSource)
2286 return; 2304 return;
2287 2305
2288 m_mediaSource->close(); 2306 m_mediaSource->close();
2289 m_mediaSource = nullptr; 2307 m_mediaSource = nullptr;
2290 } 2308 }
2291 2309
2292 bool HTMLMediaElement::loop() const 2310 bool HTMLMediaElement::loop() const
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
3187 void HTMLMediaElement::mediaPlayerRequestSeek(double time) 3205 void HTMLMediaElement::mediaPlayerRequestSeek(double time)
3188 { 3206 {
3189 // The player is the source of this seek request. 3207 // The player is the source of this seek request.
3190 if (m_mediaController) { 3208 if (m_mediaController) {
3191 m_mediaController->setCurrentTime(time, IGNORE_EXCEPTION); 3209 m_mediaController->setCurrentTime(time, IGNORE_EXCEPTION);
3192 return; 3210 return;
3193 } 3211 }
3194 setCurrentTime(time, IGNORE_EXCEPTION); 3212 setCurrentTime(time, IGNORE_EXCEPTION);
3195 } 3213 }
3196 3214
3215 void HTMLMediaElement::remoteRouteAvailabilityChanged(bool routesAvailable)
3216 {
3217 m_remoteRoutesAvailable = routesAvailable;
3218 if (hasMediaControls())
3219 mediaControls()->refreshCastButtonVisibility();
3220 }
3221
3222 void HTMLMediaElement::connectedToRemoteDevice()
3223 {
3224 m_playingRemotely = true;
3225 if (hasMediaControls())
3226 mediaControls()->startedCasting();
3227 }
3228
3229 void HTMLMediaElement::disconnectedFromRemoteDevice()
3230 {
3231 m_playingRemotely = false;
acolwell GONE FROM CHROMIUM 2014/09/06 00:32:01 You'll probably need to reset this on m_player ass
aberent 2014/09/09 18:35:30 Done.
3232 if (hasMediaControls())
3233 mediaControls()->stoppedCasting();
3234 }
3235
3197 // MediaPlayerPresentation methods 3236 // MediaPlayerPresentation methods
3198 void HTMLMediaElement::mediaPlayerRepaint() 3237 void HTMLMediaElement::mediaPlayerRepaint()
3199 { 3238 {
3200 if (m_webLayer) 3239 if (m_webLayer)
3201 m_webLayer->invalidate(); 3240 m_webLayer->invalidate();
3202 3241
3203 updateDisplayState(); 3242 updateDisplayState();
3204 if (renderer()) 3243 if (renderer())
3205 renderer()->setShouldDoFullPaintInvalidation(true); 3244 renderer()->setShouldDoFullPaintInvalidation(true);
3206 } 3245 }
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
3640 ensureUserAgentShadowRoot().appendChild(mediaControls); 3679 ensureUserAgentShadowRoot().appendChild(mediaControls);
3641 3680
3642 if (!shouldShowControls() || !inDocument()) 3681 if (!shouldShowControls() || !inDocument())
3643 mediaControls->hide(); 3682 mediaControls->hide();
3644 3683
3645 return true; 3684 return true;
3646 } 3685 }
3647 3686
3648 void HTMLMediaElement::configureMediaControls() 3687 void HTMLMediaElement::configureMediaControls()
3649 { 3688 {
3650 if (!shouldShowControls() || !inDocument()) { 3689 if (!inDocument()) {
3651 if (hasMediaControls()) 3690 if (hasMediaControls())
3652 mediaControls()->hide(); 3691 mediaControls()->hide();
3653 return; 3692 return;
3654 } 3693 }
3655 3694
3656 if (!hasMediaControls() && !createMediaControls()) 3695 if (!hasMediaControls() && !createMediaControls())
3657 return; 3696 return;
3658 3697
3659 mediaControls()->reset(); 3698 mediaControls()->reset();
3660 mediaControls()->show(); 3699 if (shouldShowControls())
3700 mediaControls()->show();
3701 else
3702 mediaControls()->hide();
3661 } 3703 }
3662 3704
3663 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption) 3705 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption)
3664 { 3706 {
3665 ASSERT(m_textTracks); 3707 ASSERT(m_textTracks);
3666 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay"); 3708 WTF_LOG(Media, "HTMLMediaElement::configureTextTrackDisplay");
3667 3709
3668 if (m_processingPreferenceChange) 3710 if (m_processingPreferenceChange)
3669 return; 3711 return;
3670 3712
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3989 4031
3990 #if ENABLE(WEB_AUDIO) 4032 #if ENABLE(WEB_AUDIO)
3991 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 4033 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3992 { 4034 {
3993 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 4035 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3994 audioSourceProvider()->setClient(0); 4036 audioSourceProvider()->setClient(0);
3995 } 4037 }
3996 #endif 4038 #endif
3997 4039
3998 } 4040 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698