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

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

Issue 2587083002: Media Controls: add comments regarding cast/remote related calls from element. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 configureMediaControls(); 541 configureMediaControls();
542 } else if (name == preloadAttr) { 542 } else if (name == preloadAttr) {
543 setPlayerPreload(); 543 setPlayerPreload();
544 } else if (name == disableremoteplaybackAttr) { 544 } else if (name == disableremoteplaybackAttr) {
545 // This attribute is an extension described in the Remote Playback API spec. 545 // This attribute is an extension described in the Remote Playback API spec.
546 // Please see: https://w3c.github.io/remote-playback 546 // Please see: https://w3c.github.io/remote-playback
547 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute); 547 UseCounter::count(document(), UseCounter::DisableRemotePlaybackAttribute);
548 if (oldValue != value) { 548 if (oldValue != value) {
549 if (m_webMediaPlayer) 549 if (m_webMediaPlayer)
550 m_webMediaPlayer->requestRemotePlaybackDisabled(!value.isNull()); 550 m_webMediaPlayer->requestRemotePlaybackDisabled(!value.isNull());
551 // TODO(mlamouri): there is no direct API to expose if
552 // disableRemotePLayback attribute has changed. It will require a direct
553 // access to MediaControls for the moment.
551 if (mediaControls()) 554 if (mediaControls())
552 mediaControls()->refreshCastButtonVisibility(); 555 mediaControls()->onDisableRemotePlaybackAttributeChanged();
553 } 556 }
554 } else { 557 } else {
555 HTMLElement::parseAttribute(name, oldValue, value); 558 HTMLElement::parseAttribute(name, oldValue, value);
556 } 559 }
557 } 560 }
558 561
559 void HTMLMediaElement::finishParsingChildren() { 562 void HTMLMediaElement::finishParsingChildren() {
560 HTMLElement::finishParsingChildren(); 563 HTMLElement::finishParsingChildren();
561 564
562 if (Traversal<HTMLTrackElement>::firstChild(*this)) 565 if (Traversal<HTMLTrackElement>::firstChild(*this))
(...skipping 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 3083
3081 void HTMLMediaElement::requestSeek(double time) { 3084 void HTMLMediaElement::requestSeek(double time) {
3082 // The player is the source of this seek request. 3085 // The player is the source of this seek request.
3083 setCurrentTime(time); 3086 setCurrentTime(time);
3084 } 3087 }
3085 3088
3086 void HTMLMediaElement::remoteRouteAvailabilityChanged( 3089 void HTMLMediaElement::remoteRouteAvailabilityChanged(
3087 WebRemotePlaybackAvailability availability) { 3090 WebRemotePlaybackAvailability availability) {
3088 if (remotePlaybackClient()) 3091 if (remotePlaybackClient())
3089 remotePlaybackClient()->availabilityChanged(availability); 3092 remotePlaybackClient()->availabilityChanged(availability);
3093
3094 // TODO(mlamouri): the RemotePlayback object should be used in order to
3095 // register to watch availability but the object is in modules/ and core/ has
3096 // no access to it. It will have to be done when the media controls move to
3097 // modules/.
3090 if (mediaControls()) 3098 if (mediaControls())
3091 mediaControls()->refreshCastButtonVisibility(); 3099 mediaControls()->onRemotePlaybackAvailabilityChanged();
3092 } 3100 }
3093 3101
3094 bool HTMLMediaElement::hasRemoteRoutes() const { 3102 bool HTMLMediaElement::hasRemoteRoutes() const {
3103 // TODO(mlamouri): this is only used for controls related code. It shouldn't
3104 // live in HTMLMediaElement.
3095 return remotePlaybackClient() && 3105 return remotePlaybackClient() &&
3096 remotePlaybackClient()->remotePlaybackAvailable(); 3106 remotePlaybackClient()->remotePlaybackAvailable();
3097 } 3107 }
3098 3108
3099 void HTMLMediaElement::connectedToRemoteDevice() { 3109 void HTMLMediaElement::connectedToRemoteDevice() {
3100 m_playingRemotely = true; 3110 m_playingRemotely = true;
3101 if (mediaControls())
3102 mediaControls()->startedCasting();
3103 if (remotePlaybackClient()) 3111 if (remotePlaybackClient())
3104 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting); 3112 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connecting);
3113
3114 // TODO(mlamouri): the RemotePlayback object should be used in order to listen
3115 // for events but the object is in modules/ and core/ has no access to it. It
3116 // will have to be done when the media controls move to modules/.
3117 if (mediaControls())
3118 mediaControls()->onRemotePlaybackConnecting();
3105 } 3119 }
3106 3120
3107 void HTMLMediaElement::disconnectedFromRemoteDevice() { 3121 void HTMLMediaElement::disconnectedFromRemoteDevice() {
3108 m_playingRemotely = false; 3122 m_playingRemotely = false;
3109 if (mediaControls())
3110 mediaControls()->stoppedCasting();
3111 if (remotePlaybackClient()) 3123 if (remotePlaybackClient())
3112 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Disconnected); 3124 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Disconnected);
3125
3126 // TODO(mlamouri): the RemotePlayback object should be used in order to listen
3127 // for events but the object is in modules/ and core/ has no access to it. It
3128 // will have to be done when the media controls move to modules/.
3129 if (mediaControls())
3130 mediaControls()->onRemotePlaybackDisconnected();
3113 } 3131 }
3114 3132
3115 void HTMLMediaElement::cancelledRemotePlaybackRequest() { 3133 void HTMLMediaElement::cancelledRemotePlaybackRequest() {
3116 if (remotePlaybackClient()) 3134 if (remotePlaybackClient())
3117 remotePlaybackClient()->promptCancelled(); 3135 remotePlaybackClient()->promptCancelled();
3118 } 3136 }
3119 3137
3120 void HTMLMediaElement::remotePlaybackStarted() { 3138 void HTMLMediaElement::remotePlaybackStarted() {
3121 if (remotePlaybackClient()) 3139 if (remotePlaybackClient())
3122 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connected); 3140 remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connected);
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4119 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4102 } 4120 }
4103 4121
4104 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { 4122 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) {
4105 m_mostlyFillingViewport = true; 4123 m_mostlyFillingViewport = true;
4106 if (m_webMediaPlayer) 4124 if (m_webMediaPlayer)
4107 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); 4125 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport);
4108 } 4126 }
4109 4127
4110 } // namespace blink 4128 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698