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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { | 170 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { |
171 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 171 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
172 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; | 172 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; |
173 issue_manager_.AddIssue(issue); | 173 issue_manager_.AddIssue(issue); |
174 } | 174 } |
175 | 175 |
176 void MediaRouterMojoImpl::OnSinksReceived( | 176 void MediaRouterMojoImpl::OnSinksReceived( |
177 const std::string& media_source, | 177 const std::string& media_source, |
178 std::vector<mojom::MediaSinkPtr> sinks, | 178 std::vector<std::unique_ptr<MediaSink>> sinks, |
179 const std::vector<std::string>& origins) { | 179 const std::vector<std::string>& origins) { |
180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 180 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
181 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived"; | 181 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived"; |
182 auto it = sinks_queries_.find(media_source); | 182 auto it = sinks_queries_.find(media_source); |
183 if (it == sinks_queries_.end()) { | 183 if (it == sinks_queries_.end()) { |
184 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery."; | 184 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery."; |
185 return; | 185 return; |
186 } | 186 } |
187 | 187 |
188 std::vector<GURL> origin_list; | 188 std::vector<GURL> origin_list; |
189 origin_list.reserve(origins.size()); | 189 origin_list.reserve(origins.size()); |
190 for (size_t i = 0; i < origins.size(); ++i) { | 190 for (size_t i = 0; i < origins.size(); ++i) { |
191 GURL origin(origins[i]); | 191 GURL origin(origins[i]); |
192 if (!origin.is_valid()) { | 192 if (!origin.is_valid()) { |
193 LOG(WARNING) << "Received invalid origin: " << origin | 193 LOG(WARNING) << "Received invalid origin: " << origin |
194 << ". Dropping result."; | 194 << ". Dropping result."; |
195 return; | 195 return; |
196 } | 196 } |
197 origin_list.push_back(origin); | 197 origin_list.push_back(origin); |
198 } | 198 } |
199 | 199 |
200 std::vector<MediaSink> sink_list; | 200 std::vector<MediaSink> sink_list; |
201 sink_list.reserve(sinks.size()); | 201 sink_list.reserve(sinks.size()); |
202 for (size_t i = 0; i < sinks.size(); ++i) | 202 for (size_t i = 0; i < sinks.size(); ++i) |
203 sink_list.push_back(sinks[i].To<MediaSink>()); | 203 sink_list.push_back(*sinks[i]); |
204 | 204 |
205 auto* sinks_query = it->second.get(); | 205 auto* sinks_query = it->second.get(); |
206 sinks_query->has_cached_result = true; | 206 sinks_query->has_cached_result = true; |
207 sinks_query->origins.swap(origin_list); | 207 sinks_query->origins.swap(origin_list); |
208 sinks_query->cached_sink_list.swap(sink_list); | 208 sinks_query->cached_sink_list.swap(sink_list); |
209 | 209 |
210 if (!sinks_query->observers.might_have_observers()) { | 210 if (!sinks_query->observers.might_have_observers()) { |
211 DVLOG_WITH_INSTANCE(1) | 211 DVLOG_WITH_INSTANCE(1) |
212 << "Received sink list without any active observers: " << media_source; | 212 << "Received sink list without any active observers: " << media_source; |
213 } else { | 213 } else { |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 base::Unretained(this), source_id)); | 987 base::Unretained(this), source_id)); |
988 } | 988 } |
989 | 989 |
990 void MediaRouterMojoImpl::DoUpdateMediaSinks( | 990 void MediaRouterMojoImpl::DoUpdateMediaSinks( |
991 const MediaSource::Id& source_id) { | 991 const MediaSource::Id& source_id) { |
992 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; | 992 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; |
993 media_route_provider_->UpdateMediaSinks(source_id); | 993 media_route_provider_->UpdateMediaSinks(source_id); |
994 } | 994 } |
995 | 995 |
996 } // namespace media_router | 996 } // namespace media_router |
OLD | NEW |