| 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.h" | 5 #include "content/browser/media/session/media_session.h" |
| 6 | 6 |
| 7 #include "content/browser/media/session/media_session_delegate.h" | 7 #include "content/browser/media/session/media_session_delegate.h" |
| 8 #include "content/browser/media/session/media_session_observer.h" | 8 #include "content/browser/media/session/media_session_observer.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 bool MediaSession::IsReallySuspended() const { | 197 bool MediaSession::IsReallySuspended() const { |
| 198 return audio_focus_state_ == State::SUSPENDED; | 198 return audio_focus_state_ == State::SUSPENDED; |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool MediaSession::IsSuspended() const { | 201 bool MediaSession::IsSuspended() const { |
| 202 // TODO(mlamouri): should be == State::SUSPENDED. | 202 // TODO(mlamouri): should be == State::SUSPENDED. |
| 203 return audio_focus_state_ != State::ACTIVE; | 203 return audio_focus_state_ != State::ACTIVE; |
| 204 } | 204 } |
| 205 | 205 |
| 206 MediaSession::State MediaSession::audio_focus_state_for_test() const { |
| 207 return audio_focus_state_; |
| 208 } |
| 209 |
| 206 bool MediaSession::IsControllable() const { | 210 bool MediaSession::IsControllable() const { |
| 207 // Only content type media session can be controllable unless it is inactive. | 211 // Only content type media session can be controllable unless it is inactive. |
| 208 return audio_focus_state_ != State::INACTIVE && | 212 return audio_focus_state_ != State::INACTIVE && |
| 209 audio_focus_type_ == Type::Content; | 213 audio_focus_type_ == Type::Content; |
| 210 } | 214 } |
| 211 | 215 |
| 212 void MediaSession::SetDelegateForTests( | 216 void MediaSession::SetDelegateForTests( |
| 213 scoped_ptr<MediaSessionDelegate> delegate) { | 217 scoped_ptr<MediaSessionDelegate> delegate) { |
| 214 delegate_ = std::move(delegate); | 218 delegate_ = std::move(delegate); |
| 215 } | 219 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 case State::SUSPENDED: | 336 case State::SUSPENDED: |
| 333 uma_helper_.OnSessionSuspended(); | 337 uma_helper_.OnSessionSuspended(); |
| 334 break; | 338 break; |
| 335 case State::INACTIVE: | 339 case State::INACTIVE: |
| 336 uma_helper_.OnSessionInactive(); | 340 uma_helper_.OnSessionInactive(); |
| 337 break; | 341 break; |
| 338 } | 342 } |
| 339 } | 343 } |
| 340 | 344 |
| 341 } // namespace content | 345 } // namespace content |
| OLD | NEW |