| 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 "chrome/browser/media/router/mojo/media_router_mojo_impl.h" | 5 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 | 168 |
| 169 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { | 169 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { |
| 170 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 170 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 171 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; | 171 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; |
| 172 issue_manager_.AddIssue(issue); | 172 issue_manager_.AddIssue(issue); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void MediaRouterMojoImpl::OnSinksReceived( | 175 void MediaRouterMojoImpl::OnSinksReceived( |
| 176 const std::string& media_source, | 176 const std::string& media_source, |
| 177 const std::vector<MediaSink>& sinks, | 177 const std::vector<MediaSinkInternal>& internal_sinks, |
| 178 const std::vector<url::Origin>& origins) { | 178 const std::vector<url::Origin>& origins) { |
| 179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 180 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived"; | 180 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived"; |
| 181 auto it = sinks_queries_.find(media_source); | 181 auto it = sinks_queries_.find(media_source); |
| 182 if (it == sinks_queries_.end()) { | 182 if (it == sinks_queries_.end()) { |
| 183 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery."; | 183 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery."; |
| 184 return; | 184 return; |
| 185 } | 185 } |
| 186 | 186 |
| 187 std::vector<MediaSink> sinks; |
| 188 sinks.reserve(internal_sinks.size()); |
| 189 for (const auto& internal_sink : internal_sinks) |
| 190 sinks.push_back(internal_sink.sink()); |
| 191 |
| 187 auto* sinks_query = it->second.get(); | 192 auto* sinks_query = it->second.get(); |
| 188 sinks_query->has_cached_result = true; | 193 sinks_query->has_cached_result = true; |
| 189 sinks_query->origins = origins; | 194 sinks_query->origins = origins; |
| 190 sinks_query->cached_sink_list = sinks; | 195 sinks_query->cached_sink_list = sinks; |
| 191 | 196 |
| 192 if (!sinks_query->observers.might_have_observers()) { | 197 if (!sinks_query->observers.might_have_observers()) { |
| 193 DVLOG_WITH_INSTANCE(1) | 198 DVLOG_WITH_INSTANCE(1) |
| 194 << "Received sink list without any active observers: " << media_source; | 199 << "Received sink list without any active observers: " << media_source; |
| 195 } else { | 200 } else { |
| 196 for (auto& observer : sinks_query->observers) { | 201 for (auto& observer : sinks_query->observers) { |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 base::Unretained(this), source_id)); | 934 base::Unretained(this), source_id)); |
| 930 } | 935 } |
| 931 | 936 |
| 932 void MediaRouterMojoImpl::DoUpdateMediaSinks( | 937 void MediaRouterMojoImpl::DoUpdateMediaSinks( |
| 933 const MediaSource::Id& source_id) { | 938 const MediaSource::Id& source_id) { |
| 934 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; | 939 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; |
| 935 media_route_provider_->UpdateMediaSinks(source_id); | 940 media_route_provider_->UpdateMediaSinks(source_id); |
| 936 } | 941 } |
| 937 | 942 |
| 938 } // namespace media_router | 943 } // namespace media_router |
| OLD | NEW |