Chromium Code Reviews| Index: chrome/browser/media/router/offscreen_presentation_manager.cc |
| diff --git a/chrome/browser/media/router/offscreen_presentation_manager.cc b/chrome/browser/media/router/offscreen_presentation_manager.cc |
| index 0e721ad4a3863a91a0454b1d440998d29b1cd42a..a73b9d8b28778ce8b6e46f4c7c519ee28599c7d6 100644 |
| --- a/chrome/browser/media/router/offscreen_presentation_manager.cc |
| +++ b/chrome/browser/media/router/offscreen_presentation_manager.cc |
| @@ -90,6 +90,29 @@ void OffscreenPresentationManager::OnOffscreenPresentationReceiverTerminated( |
| offscreen_presentations_.erase(presentation_id); |
| } |
| +void OffscreenPresentationManager::RegisterOffscreenPresentationRoute( |
| + const std::string& presentation_id, |
| + const GURL& presentation_url, |
| + const MediaRoute& route) { |
| + auto* presentation = |
| + GetOrCreateOffscreenPresentation(presentation_id, presentation_url); |
| + presentation->RegisterRoute(route); |
| +} |
| + |
| +bool OffscreenPresentationManager::IsOffscreenPresentation( |
| + const std::string& presentation_id) { |
| + return base::ContainsKey(offscreen_presentations_, presentation_id); |
| +} |
| + |
| +const MediaRoute* OffscreenPresentationManager::GetRoute( |
| + const std::string& presentation_id) { |
| + auto it = offscreen_presentations_.find(presentation_id); |
| + if (it == offscreen_presentations_.end()) |
| + return nullptr; |
| + |
| + return it->second->route_.get(); |
| +} |
| + |
| // OffscreenPresentation implementation. |
| OffscreenPresentationManager::OffscreenPresentation::OffscreenPresentation( |
| const std::string& presentation_id, |
| @@ -134,6 +157,12 @@ void OffscreenPresentationManager::OffscreenPresentation::RegisterReceiver( |
| pending_controllers_.clear(); |
| } |
| +void OffscreenPresentationManager::OffscreenPresentation::RegisterRoute( |
| + const MediaRoute& route) { |
| + DCHECK(!route_); |
| + route_ = base::MakeUnique<MediaRoute>(route); |
|
mark a. foltz
2017/03/01 06:26:32
Is it important that this take ownership of the pa
zhaobin
2017/03/15 18:18:56
Done.
imcheng
2017/03/16 01:42:51
I thought this was a unique_ptr because there's a
zhaobin
2017/03/16 18:50:30
Done.
|
| +} |
| + |
| bool OffscreenPresentationManager::OffscreenPresentation::IsValid() const { |
| return !(pending_controllers_.empty() && receiver_callback_.is_null()); |
| } |