| 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 // If there is no poster to display, allow the media engine to render video | 1190 // If there is no poster to display, allow the media engine to render video |
| 1191 // frames as soon as they are available. | 1191 // frames as soon as they are available. |
| 1192 UpdateDisplayState(); | 1192 UpdateDisplayState(); |
| 1193 | 1193 |
| 1194 if (GetLayoutObject()) | 1194 if (GetLayoutObject()) |
| 1195 GetLayoutObject()->UpdateFromElement(); | 1195 GetLayoutObject()->UpdateFromElement(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 void HTMLMediaElement::StartPlayerLoad(const KURL& player_provided_url) { | 1198 void HTMLMediaElement::StartPlayerLoad() { |
| 1199 DCHECK(!web_media_player_); | 1199 DCHECK(!web_media_player_); |
| 1200 | 1200 |
| 1201 WebMediaPlayerSource source; | 1201 WebMediaPlayerSource source; |
| 1202 if (src_object_) { | 1202 if (src_object_) { |
| 1203 source = WebMediaPlayerSource(WebMediaStream(src_object_)); | 1203 source = WebMediaPlayerSource(WebMediaStream(src_object_)); |
| 1204 } else { | 1204 } else { |
| 1205 // Filter out user:pass as those two URL components aren't | 1205 // Filter out user:pass as those two URL components aren't |
| 1206 // considered for media resource fetches (including for the CORS | 1206 // considered for media resource fetches (including for the CORS |
| 1207 // use-credentials mode.) That behavior aligns with Gecko, with IE | 1207 // use-credentials mode.) That behavior aligns with Gecko, with IE |
| 1208 // being more restrictive and not allowing fetches to such URLs. | 1208 // being more restrictive and not allowing fetches to such URLs. |
| 1209 // | 1209 // |
| 1210 // Spec reference: http://whatwg.org/c/#concept-media-load-resource | 1210 // Spec reference: http://whatwg.org/c/#concept-media-load-resource |
| 1211 // | 1211 // |
| 1212 // FIXME: when the HTML spec switches to specifying resource | 1212 // FIXME: when the HTML spec switches to specifying resource |
| 1213 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and | 1213 // fetches in terms of Fetch (http://fetch.spec.whatwg.org), and |
| 1214 // along with that potentially also specifying a setting for its | 1214 // along with that potentially also specifying a setting for its |
| 1215 // 'authentication flag' to control how user:pass embedded in a | 1215 // 'authentication flag' to control how user:pass embedded in a |
| 1216 // media resource URL should be treated, then update the handling | 1216 // media resource URL should be treated, then update the handling |
| 1217 // here to match. | 1217 // here to match. |
| 1218 KURL request_url = | 1218 KURL request_url = current_src_; |
| 1219 player_provided_url.IsNull() ? KURL(current_src_) : player_provided_url; | |
| 1220 if (!request_url.User().IsEmpty()) | 1219 if (!request_url.User().IsEmpty()) |
| 1221 request_url.SetUser(String()); | 1220 request_url.SetUser(String()); |
| 1222 if (!request_url.Pass().IsEmpty()) | 1221 if (!request_url.Pass().IsEmpty()) |
| 1223 request_url.SetPass(String()); | 1222 request_url.SetPass(String()); |
| 1224 | 1223 |
| 1225 KURL kurl(kParsedURLString, request_url); | 1224 KURL kurl(kParsedURLString, request_url); |
| 1226 source = WebMediaPlayerSource(WebURL(kurl)); | 1225 source = WebMediaPlayerSource(WebURL(kurl)); |
| 1227 } | 1226 } |
| 1228 | 1227 |
| 1229 LocalFrame* frame = GetDocument().GetFrame(); | 1228 LocalFrame* frame = GetDocument().GetFrame(); |
| (...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3218 WebMediaPlayer::TrackId HTMLMediaElement::GetSelectedVideoTrackId() { | 3217 WebMediaPlayer::TrackId HTMLMediaElement::GetSelectedVideoTrackId() { |
| 3219 DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()); | 3218 DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled()); |
| 3220 DCHECK(HasSelectedVideoTrack()); | 3219 DCHECK(HasSelectedVideoTrack()); |
| 3221 | 3220 |
| 3222 int selected_track_index = video_tracks_->selectedIndex(); | 3221 int selected_track_index = video_tracks_->selectedIndex(); |
| 3223 VideoTrack* track = | 3222 VideoTrack* track = |
| 3224 video_tracks_->AnonymousIndexedGetter(selected_track_index); | 3223 video_tracks_->AnonymousIndexedGetter(selected_track_index); |
| 3225 return track->id(); | 3224 return track->id(); |
| 3226 } | 3225 } |
| 3227 | 3226 |
| 3228 void HTMLMediaElement::RequestReload(const WebURL& new_url) { | |
| 3229 DCHECK(GetWebMediaPlayer()); | |
| 3230 DCHECK(!src_object_); | |
| 3231 DCHECK(new_url.IsValid()); | |
| 3232 DCHECK(IsSafeToLoadURL(new_url, kComplain)); | |
| 3233 ResetMediaPlayerAndMediaSource(); | |
| 3234 StartPlayerLoad(new_url); | |
| 3235 } | |
| 3236 | |
| 3237 bool HTMLMediaElement::IsAutoplayingMuted() { | 3227 bool HTMLMediaElement::IsAutoplayingMuted() { |
| 3238 return autoplay_policy_->IsAutoplayingMuted(); | 3228 return autoplay_policy_->IsAutoplayingMuted(); |
| 3239 } | 3229 } |
| 3240 | 3230 |
| 3241 // MediaPlayerPresentation methods | 3231 // MediaPlayerPresentation methods |
| 3242 void HTMLMediaElement::Repaint() { | 3232 void HTMLMediaElement::Repaint() { |
| 3243 if (web_layer_) | 3233 if (web_layer_) |
| 3244 web_layer_->Invalidate(); | 3234 web_layer_->Invalidate(); |
| 3245 | 3235 |
| 3246 UpdateDisplayState(); | 3236 UpdateDisplayState(); |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4116 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4106 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4117 } | 4107 } |
| 4118 | 4108 |
| 4119 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4109 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
| 4120 mostly_filling_viewport_ = true; | 4110 mostly_filling_viewport_ = true; |
| 4121 if (web_media_player_) | 4111 if (web_media_player_) |
| 4122 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4112 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
| 4123 } | 4113 } |
| 4124 | 4114 |
| 4125 } // namespace blink | 4115 } // namespace blink |
| OLD | NEW |