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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1398 if (video_weblayer_) | 1398 if (video_weblayer_) |
1399 video_weblayer_->layer()->SetContentsOpaque(opaque_); | 1399 video_weblayer_->layer()->SetContentsOpaque(opaque_); |
1400 } | 1400 } |
1401 | 1401 |
1402 void WebMediaPlayerImpl::OnFrameHidden() { | 1402 void WebMediaPlayerImpl::OnFrameHidden() { |
1403 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 1403 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
1404 | 1404 |
1405 if (watch_time_reporter_) | 1405 if (watch_time_reporter_) |
1406 watch_time_reporter_->OnHidden(); | 1406 watch_time_reporter_->OnHidden(); |
1407 | 1407 |
1408 if (ShouldPauseVideoWhenHidden()) { | 1408 if (!delegate_->IsFrameClosed()) { |
sandersd (OOO until July 31)
2017/01/24 19:51:21
Perhaps just call IsHidden()?
Also, rename IsHidd
| |
1409 PauseVideoIfNeeded(); | 1409 if (ShouldPauseVideoWhenHidden()) { |
1410 return; | 1410 PauseVideoIfNeeded(); |
1411 } else { | 1411 return; |
1412 DisableVideoTrackIfNeeded(); | 1412 } else { |
1413 DisableVideoTrackIfNeeded(); | |
1414 } | |
1413 } | 1415 } |
1414 | 1416 |
1415 UpdatePlayState(); | 1417 UpdatePlayState(); |
1416 | 1418 |
1417 // Schedule suspended playing media to be paused if the user doesn't come back | 1419 // Schedule suspended playing media to be paused if the user doesn't come back |
1418 // to it within some timeout period to avoid any autoplay surprises. | 1420 // to it within some timeout period to avoid any autoplay surprises. |
1419 ScheduleIdlePauseTimer(); | 1421 ScheduleIdlePauseTimer(); |
1420 } | 1422 } |
1421 | 1423 |
1422 void WebMediaPlayerImpl::OnFrameClosed() { | 1424 void WebMediaPlayerImpl::OnFrameClosed() { |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2253 UMA_HISTOGRAM_TIMES( | 2255 UMA_HISTOGRAM_TIMES( |
2254 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", | 2256 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", |
2255 time_to_first_frame); | 2257 time_to_first_frame); |
2256 } else { | 2258 } else { |
2257 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", | 2259 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", |
2258 time_to_first_frame); | 2260 time_to_first_frame); |
2259 } | 2261 } |
2260 } | 2262 } |
2261 | 2263 |
2262 } // namespace media | 2264 } // namespace media |
OLD | NEW |