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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 } | 1211 } |
1212 | 1212 |
1213 OnSuspendRequested(false); | 1213 OnSuspendRequested(false); |
1214 } | 1214 } |
1215 | 1215 |
1216 void WebMediaPlayerAndroid::OnShown() { | 1216 void WebMediaPlayerAndroid::OnShown() { |
1217 if (is_play_pending_) | 1217 if (is_play_pending_) |
1218 play(); | 1218 play(); |
1219 } | 1219 } |
1220 | 1220 |
1221 void WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) { | 1221 bool WebMediaPlayerAndroid::OnSuspendRequested(bool must_suspend) { |
1222 if (!must_suspend && | 1222 if (!must_suspend && |
1223 base::CommandLine::ForCurrentProcess()->HasSwitch( | 1223 base::CommandLine::ForCurrentProcess()->HasSwitch( |
1224 switches::kDisableMediaSuspend)) { | 1224 switches::kDisableMediaSuspend)) { |
1225 return; | 1225 return true; |
1226 } | 1226 } |
1227 | 1227 |
1228 // If we're idle or playing video, pause and release resources; audio only | 1228 // If we're idle or playing video, pause and release resources; audio only |
1229 // players are allowed to continue unless indicated otherwise by the call. | 1229 // players are allowed to continue unless indicated otherwise by the call. |
1230 if (must_suspend || (paused() && playback_completed_) || | 1230 if (must_suspend || (paused() && playback_completed_) || |
1231 (hasVideo() && !IsBackgroundVideoCandidate())) { | 1231 (hasVideo() && !IsBackgroundVideoCandidate())) { |
1232 SuspendAndReleaseResources(); | 1232 SuspendAndReleaseResources(); |
1233 } | 1233 } |
| 1234 |
| 1235 return true; |
1234 } | 1236 } |
1235 | 1237 |
1236 void WebMediaPlayerAndroid::OnPlay() { | 1238 void WebMediaPlayerAndroid::OnPlay() { |
1237 play(); | 1239 play(); |
1238 client_->playbackStateChanged(); | 1240 client_->playbackStateChanged(); |
1239 } | 1241 } |
1240 | 1242 |
1241 void WebMediaPlayerAndroid::OnPause() { | 1243 void WebMediaPlayerAndroid::OnPause() { |
1242 pause(); | 1244 pause(); |
1243 client_->playbackStateChanged(); | 1245 client_->playbackStateChanged(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1310 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1309 switches::kDisableMediaSuspend)) { | 1311 switches::kDisableMediaSuspend)) { |
1310 return false; | 1312 return false; |
1311 } | 1313 } |
1312 | 1314 |
1313 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && | 1315 return base::FeatureList::IsEnabled(media::kResumeBackgroundVideo) && |
1314 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); | 1316 hasAudio() && !isRemote() && delegate_ && delegate_->IsHidden(); |
1315 } | 1317 } |
1316 | 1318 |
1317 } // namespace content | 1319 } // namespace content |
OLD | NEW |