| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/media/session/media_session_impl.h" | 5 #include "content/browser/media/session/media_session_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "content/browser/media/session/audio_focus_delegate.h" | 8 #include "content/browser/media/session/audio_focus_delegate.h" |
| 9 #include "content/browser/media/session/media_session_controller.h" | 9 #include "content/browser/media/session/media_session_controller.h" |
| 10 #include "content/browser/media/session/media_session_player_observer.h" | 10 #include "content/browser/media/session/media_session_player_observer.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 RemovePlayer(observer, player_id); | 324 RemovePlayer(observer, player_id); |
| 325 return; | 325 return; |
| 326 } | 326 } |
| 327 | 327 |
| 328 // Otherwise, suspend the session. | 328 // Otherwise, suspend the session. |
| 329 DCHECK(IsActive()); | 329 DCHECK(IsActive()); |
| 330 OnSuspendInternal(SuspendType::CONTENT, State::SUSPENDED); | 330 OnSuspendInternal(SuspendType::CONTENT, State::SUSPENDED); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void MediaSessionImpl::Resume(SuspendType suspend_type) { | 333 void MediaSessionImpl::Resume(SuspendType suspend_type) { |
| 334 DCHECK(IsSuspended()); | 334 if (!IsSuspended()) |
| 335 return; |
| 335 | 336 |
| 336 if (suspend_type == SuspendType::UI) { | 337 if (suspend_type == SuspendType::UI) { |
| 337 MediaSessionUmaHelper::RecordMediaSessionUserAction( | 338 MediaSessionUmaHelper::RecordMediaSessionUserAction( |
| 338 MediaSessionUmaHelper::MediaSessionUserAction::PlayDefault); | 339 MediaSessionUmaHelper::MediaSessionUserAction::PlayDefault); |
| 339 } | 340 } |
| 340 | 341 |
| 341 // When the resume requests comes from another source than system, audio focus | 342 // When the resume requests comes from another source than system, audio focus |
| 342 // must be requested. | 343 // must be requested. |
| 343 if (suspend_type != SuspendType::SYSTEM) { | 344 if (suspend_type != SuspendType::SYSTEM) { |
| 344 // Request audio focus again in case we lost it because another app started | 345 // Request audio focus again in case we lost it because another app started |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 if (!IsServiceActiveForRenderFrameHost(frame)) | 766 if (!IsServiceActiveForRenderFrameHost(frame)) |
| 766 continue; | 767 continue; |
| 767 best_frame = frame; | 768 best_frame = frame; |
| 768 min_depth = depth; | 769 min_depth = depth; |
| 769 } | 770 } |
| 770 | 771 |
| 771 return best_frame ? services_[best_frame] : nullptr; | 772 return best_frame ? services_[best_frame] : nullptr; |
| 772 } | 773 } |
| 773 | 774 |
| 774 } // namespace content | 775 } // namespace content |
| OLD | NEW |