| 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/audio_focus_delegate.h" | 7 #include "content/browser/media/session/audio_focus_delegate.h" |
| 8 #include "content/browser/media/session/media_session_player_observer.h" | 8 #include "content/browser/media/session/media_session_player_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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 void MediaSession::SetMetadata(const base::Optional<MediaMetadata>& metadata) { | 75 void MediaSession::SetMetadata(const base::Optional<MediaMetadata>& metadata) { |
| 76 metadata_ = metadata; | 76 metadata_ = metadata; |
| 77 static_cast<WebContentsImpl*>(web_contents()) | 77 static_cast<WebContentsImpl*>(web_contents()) |
| 78 ->OnMediaSessionMetadataChanged(); | 78 ->OnMediaSessionMetadataChanged(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool MediaSession::AddPlayer(MediaSessionPlayerObserver* observer, | 81 bool MediaSession::AddPlayer(MediaSessionPlayerObserver* observer, |
| 82 int player_id, | 82 int player_id, |
| 83 media::MediaContentType media_content_type) { | 83 media::MediaContentType media_content_type) { |
| 84 if (media_content_type == media::MediaContentType::Uncontrollable) |
| 85 return true; |
| 84 if (media_content_type == media::MediaContentType::Pepper) | 86 if (media_content_type == media::MediaContentType::Pepper) |
| 85 return AddPepperPlayer(observer, player_id); | 87 return AddPepperPlayer(observer, player_id); |
| 86 | 88 |
| 87 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); | 89 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); |
| 88 | 90 |
| 89 // Determine the audio focus type required for playing the new player. | 91 // Determine the audio focus type required for playing the new player. |
| 90 // TODO(zqzhang): handle duckable and uncontrollable. | 92 // TODO(zqzhang): handle duckable and uncontrollable. |
| 91 // See https://crbug.com/639277. | 93 // See https://crbug.com/639277. |
| 92 AudioFocusManager::AudioFocusType required_audio_focus_type; | 94 AudioFocusManager::AudioFocusType required_audio_focus_type; |
| 93 if (media_content_type == media::MediaContentType::Persistent) { | 95 if (media_content_type == media::MediaContentType::Persistent) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 DCHECK(success); | 438 DCHECK(success); |
| 437 | 439 |
| 438 pepper_players_.insert(PlayerIdentifier(observer, player_id)); | 440 pepper_players_.insert(PlayerIdentifier(observer, player_id)); |
| 439 | 441 |
| 440 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); | 442 observer->OnSetVolumeMultiplier(player_id, GetVolumeMultiplier()); |
| 441 | 443 |
| 442 return true; | 444 return true; |
| 443 } | 445 } |
| 444 | 446 |
| 445 } // namespace content | 447 } // namespace content |
| OLD | NEW |