| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void WebMediaPlayerImpl::enteredFullscreen() { | 358 void WebMediaPlayerImpl::enteredFullscreen() { |
| 359 // |force_video_overlays_| implies that we're already in overlay mode, so take | 359 // |force_video_overlays_| implies that we're already in overlay mode, so take |
| 360 // no action here. Otherwise, switch to an overlay if it's allowed and if | 360 // no action here. Otherwise, switch to an overlay if it's allowed and if |
| 361 // it will display properly. | 361 // it will display properly. |
| 362 if (!force_video_overlays_ && enable_fullscreen_video_overlays_ && | 362 if (!force_video_overlays_ && enable_fullscreen_video_overlays_ && |
| 363 DoesOverlaySupportMetadata()) { | 363 DoesOverlaySupportMetadata()) { |
| 364 EnableOverlay(); | 364 EnableOverlay(); |
| 365 } | 365 } |
| 366 if (observer_) | 366 if (observer_) |
| 367 observer_->OnEnteredFullscreen(); | 367 observer_->OnEnteredFullscreen(); |
| 368 delegate_->SetIsEffectivelyFullscreen(delegate_id_, true); | |
| 369 } | 368 } |
| 370 | 369 |
| 371 void WebMediaPlayerImpl::exitedFullscreen() { | 370 void WebMediaPlayerImpl::exitedFullscreen() { |
| 372 // If we're in overlay mode, then exit it unless we're supposed to be in | 371 // If we're in overlay mode, then exit it unless we're supposed to be in |
| 373 // overlay mode all the time. | 372 // overlay mode all the time. |
| 374 if (!force_video_overlays_ && overlay_enabled_) | 373 if (!force_video_overlays_ && overlay_enabled_) |
| 375 DisableOverlay(); | 374 DisableOverlay(); |
| 376 if (observer_) | 375 if (observer_) |
| 377 observer_->OnExitedFullscreen(); | 376 observer_->OnExitedFullscreen(); |
| 378 delegate_->SetIsEffectivelyFullscreen(delegate_id_, false); | |
| 379 } | 377 } |
| 380 | 378 |
| 381 void WebMediaPlayerImpl::becameDominantVisibleContent(bool isDominant) { | 379 void WebMediaPlayerImpl::becameDominantVisibleContent(bool isDominant) { |
| 382 if (observer_) | 380 if (observer_) |
| 383 observer_->OnBecameDominantVisibleContent(isDominant); | 381 observer_->OnBecameDominantVisibleContent(isDominant); |
| 384 } | 382 } |
| 385 | 383 |
| 384 void WebMediaPlayerImpl::setIsEffectivelyFullscreen( |
| 385 bool isEffectivelyFullscreen) { |
| 386 delegate_->SetIsEffectivelyFullscreen(delegate_id_, isEffectivelyFullscreen); |
| 387 } |
| 388 |
| 386 void WebMediaPlayerImpl::DoLoad(LoadType load_type, | 389 void WebMediaPlayerImpl::DoLoad(LoadType load_type, |
| 387 const blink::WebURL& url, | 390 const blink::WebURL& url, |
| 388 CORSMode cors_mode) { | 391 CORSMode cors_mode) { |
| 389 DVLOG(1) << __func__; | 392 DVLOG(1) << __func__; |
| 390 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 393 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 391 | 394 |
| 392 GURL gurl(url); | 395 GURL gurl(url); |
| 393 ReportMetrics(load_type, gurl, frame_->getSecurityOrigin()); | 396 ReportMetrics(load_type, gurl, frame_->getSecurityOrigin()); |
| 394 | 397 |
| 395 // Set subresource URL for crash reporting. | 398 // Set subresource URL for crash reporting. |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 | 2315 |
| 2313 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2316 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
| 2314 DCHECK(data_source_ || chunk_demuxer_); | 2317 DCHECK(data_source_ || chunk_demuxer_); |
| 2315 if (data_source_) | 2318 if (data_source_) |
| 2316 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2319 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
| 2317 else | 2320 else |
| 2318 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2321 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
| 2319 } | 2322 } |
| 2320 | 2323 |
| 2321 } // namespace media | 2324 } // namespace media |
| OLD | NEW |