OLD | NEW |
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } else if (name == disableremoteplaybackAttr) { | 639 } else if (name == disableremoteplaybackAttr) { |
640 // This attribute is an extension described in the Remote Playback API spec. | 640 // This attribute is an extension described in the Remote Playback API spec. |
641 // Please see: https://w3c.github.io/remote-playback | 641 // Please see: https://w3c.github.io/remote-playback |
642 UseCounter::Count(GetDocument(), | 642 UseCounter::Count(GetDocument(), |
643 UseCounter::kDisableRemotePlaybackAttribute); | 643 UseCounter::kDisableRemotePlaybackAttribute); |
644 if (params.old_value != params.new_value) { | 644 if (params.old_value != params.new_value) { |
645 if (web_media_player_) { | 645 if (web_media_player_) { |
646 web_media_player_->RequestRemotePlaybackDisabled( | 646 web_media_player_->RequestRemotePlaybackDisabled( |
647 !params.new_value.IsNull()); | 647 !params.new_value.IsNull()); |
648 } | 648 } |
649 // TODO(mlamouri): there is no direct API to expose if | |
650 // disableRemotePLayback attribute has changed. It will require a direct | |
651 // access to MediaControls for the moment. | |
652 if (GetMediaControls()) | |
653 GetMediaControls()->OnDisableRemotePlaybackAttributeChanged(); | |
654 } | 649 } |
655 } else { | 650 } else { |
656 HTMLElement::ParseAttribute(params); | 651 HTMLElement::ParseAttribute(params); |
657 } | 652 } |
658 } | 653 } |
659 | 654 |
660 void HTMLMediaElement::FinishParsingChildren() { | 655 void HTMLMediaElement::FinishParsingChildren() { |
661 HTMLElement::FinishParsingChildren(); | 656 HTMLElement::FinishParsingChildren(); |
662 | 657 |
663 if (Traversal<HTMLTrackElement>::FirstChild(*this)) | 658 if (Traversal<HTMLTrackElement>::FirstChild(*this)) |
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 | 3147 |
3153 void HTMLMediaElement::RequestSeek(double time) { | 3148 void HTMLMediaElement::RequestSeek(double time) { |
3154 // The player is the source of this seek request. | 3149 // The player is the source of this seek request. |
3155 setCurrentTime(time); | 3150 setCurrentTime(time); |
3156 } | 3151 } |
3157 | 3152 |
3158 void HTMLMediaElement::RemoteRouteAvailabilityChanged( | 3153 void HTMLMediaElement::RemoteRouteAvailabilityChanged( |
3159 WebRemotePlaybackAvailability availability) { | 3154 WebRemotePlaybackAvailability availability) { |
3160 if (RemotePlaybackClient()) | 3155 if (RemotePlaybackClient()) |
3161 RemotePlaybackClient()->AvailabilityChanged(availability); | 3156 RemotePlaybackClient()->AvailabilityChanged(availability); |
3162 | |
3163 // TODO(mlamouri): the RemotePlayback object should be used in order to | |
3164 // register to watch availability but the object is in modules/ and core/ has | |
3165 // no access to it. It will have to be done when the media controls move to | |
3166 // modules/. | |
3167 if (GetMediaControls()) | |
3168 GetMediaControls()->OnRemotePlaybackAvailabilityChanged(); | |
3169 } | 3157 } |
3170 | 3158 |
3171 bool HTMLMediaElement::HasRemoteRoutes() const { | 3159 bool HTMLMediaElement::HasRemoteRoutes() const { |
3172 // TODO(mlamouri): this is only used for controls related code. It shouldn't | 3160 // TODO(mlamouri): used by MediaControlsPainter; should be refactored out. |
3173 // live in HTMLMediaElement. | |
3174 return RemotePlaybackClient() && | 3161 return RemotePlaybackClient() && |
3175 RemotePlaybackClient()->RemotePlaybackAvailable(); | 3162 RemotePlaybackClient()->RemotePlaybackAvailable(); |
3176 } | 3163 } |
3177 | 3164 |
3178 void HTMLMediaElement::ConnectedToRemoteDevice() { | 3165 void HTMLMediaElement::ConnectedToRemoteDevice() { |
3179 playing_remotely_ = true; | 3166 playing_remotely_ = true; |
3180 if (RemotePlaybackClient()) | 3167 if (RemotePlaybackClient()) |
3181 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kConnecting); | 3168 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kConnecting); |
3182 | |
3183 // TODO(mlamouri): the RemotePlayback object should be used in order to listen | |
3184 // for events but the object is in modules/ and core/ has no access to it. It | |
3185 // will have to be done when the media controls move to modules/. | |
3186 if (GetMediaControls()) | |
3187 GetMediaControls()->OnRemotePlaybackConnecting(); | |
3188 } | 3169 } |
3189 | 3170 |
3190 void HTMLMediaElement::DisconnectedFromRemoteDevice() { | 3171 void HTMLMediaElement::DisconnectedFromRemoteDevice() { |
3191 playing_remotely_ = false; | 3172 playing_remotely_ = false; |
3192 if (RemotePlaybackClient()) | 3173 if (RemotePlaybackClient()) |
3193 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kDisconnected); | 3174 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kDisconnected); |
3194 | |
3195 // TODO(mlamouri): the RemotePlayback object should be used in order to listen | |
3196 // for events but the object is in modules/ and core/ has no access to it. It | |
3197 // will have to be done when the media controls move to modules/. | |
3198 if (GetMediaControls()) | |
3199 GetMediaControls()->OnRemotePlaybackDisconnected(); | |
3200 } | 3175 } |
3201 | 3176 |
3202 void HTMLMediaElement::CancelledRemotePlaybackRequest() { | 3177 void HTMLMediaElement::CancelledRemotePlaybackRequest() { |
3203 if (RemotePlaybackClient()) | 3178 if (RemotePlaybackClient()) |
3204 RemotePlaybackClient()->PromptCancelled(); | 3179 RemotePlaybackClient()->PromptCancelled(); |
3205 } | 3180 } |
3206 | 3181 |
3207 void HTMLMediaElement::RemotePlaybackStarted() { | 3182 void HTMLMediaElement::RemotePlaybackStarted() { |
3208 if (RemotePlaybackClient()) | 3183 if (RemotePlaybackClient()) |
3209 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kConnected); | 3184 RemotePlaybackClient()->StateChanged(WebRemotePlaybackState::kConnected); |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4116 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4091 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
4117 } | 4092 } |
4118 | 4093 |
4119 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4094 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
4120 mostly_filling_viewport_ = true; | 4095 mostly_filling_viewport_ = true; |
4121 if (web_media_player_) | 4096 if (web_media_player_) |
4122 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4097 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
4123 } | 4098 } |
4124 | 4099 |
4125 } // namespace blink | 4100 } // namespace blink |
OLD | NEW |