Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(879)

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl.cc

Issue 2674273003: Revert of [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/presentation_service_delegate_impl.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/small_map.h" 12 #include "base/containers/small_map.h"
13 #include "base/guid.h" 13 #include "base/guid.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "chrome/browser/media/router/browser_presentation_connection_proxy.h"
17 #include "chrome/browser/media/router/create_presentation_connection_request.h" 16 #include "chrome/browser/media/router/create_presentation_connection_request.h"
18 #include "chrome/browser/media/router/media_route.h" 17 #include "chrome/browser/media/router/media_route.h"
19 #include "chrome/browser/media/router/media_router.h" 18 #include "chrome/browser/media/router/media_router.h"
20 #include "chrome/browser/media/router/media_router_dialog_controller.h" 19 #include "chrome/browser/media/router/media_router_dialog_controller.h"
21 #include "chrome/browser/media/router/media_router_factory.h" 20 #include "chrome/browser/media/router/media_router_factory.h"
22 #include "chrome/browser/media/router/media_sink.h" 21 #include "chrome/browser/media/router/media_sink.h"
23 #include "chrome/browser/media/router/media_source_helper.h" 22 #include "chrome/browser/media/router/media_source_helper.h"
24 #include "chrome/browser/media/router/offscreen_presentation_manager.h" 23 #include "chrome/browser/media/router/offscreen_presentation_manager.h"
25 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" 24 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h"
26 #include "chrome/browser/media/router/presentation_media_sinks_observer.h" 25 #include "chrome/browser/media/router/presentation_media_sinks_observer.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void RemoveConnection(const std::string& presentation_id, 156 void RemoveConnection(const std::string& presentation_id,
158 const MediaRoute::Id& route_id); 157 const MediaRoute::Id& route_id);
159 158
160 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const; 159 const MediaRoute::Id GetRouteId(const std::string& presentation_id) const;
161 160
162 void OnPresentationSessionStarted( 161 void OnPresentationSessionStarted(
163 const content::PresentationSessionInfo& session, 162 const content::PresentationSessionInfo& session,
164 const MediaRoute& route); 163 const MediaRoute& route);
165 void OnPresentationServiceDelegateDestroyed() const; 164 void OnPresentationServiceDelegateDestroyed() const;
166 165
167 bool IsOffscreenPresentation(const std::string& presentation_id) const;
168 void ConnectToPresentation(
169 const content::PresentationSessionInfo& session,
170 content::PresentationConnectionPtr controller_connection_ptr,
171 content::PresentationConnectionRequest receiver_connection_request);
172
173 private: 166 private:
174 MediaSource GetMediaSourceFromListener( 167 MediaSource GetMediaSourceFromListener(
175 content::PresentationScreenAvailabilityListener* listener) const; 168 content::PresentationScreenAvailabilityListener* listener) const;
176 base::SmallMap<std::map<std::string, MediaRoute>> presentation_id_to_route_; 169 base::SmallMap<std::map<std::string, MediaRoute::Id>>
170 presentation_id_to_route_id_;
177 base::SmallMap< 171 base::SmallMap<
178 std::map<std::string, std::unique_ptr<PresentationMediaSinksObserver>>> 172 std::map<std::string, std::unique_ptr<PresentationMediaSinksObserver>>>
179 url_to_sinks_observer_; 173 url_to_sinks_observer_;
180 std::unordered_map< 174 std::unordered_map<
181 MediaRoute::Id, 175 MediaRoute::Id,
182 std::unique_ptr<PresentationConnectionStateSubscription>> 176 std::unique_ptr<PresentationConnectionStateSubscription>>
183 connection_state_subscriptions_; 177 connection_state_subscriptions_;
184 std::unordered_map< 178 std::unordered_map<
185 MediaRoute::Id, 179 MediaRoute::Id,
186 std::unique_ptr<PresentationSessionMessagesObserver>> 180 std::unique_ptr<PresentationSessionMessagesObserver>>
187 session_messages_observers_; 181 session_messages_observers_;
188 std::unordered_map<MediaRoute::Id,
189 std::unique_ptr<BrowserPresentationConnectionProxy>>
190 browser_connection_proxies_;
191 182
192 RenderFrameHostId render_frame_host_id_; 183 RenderFrameHostId render_frame_host_id_;
193 184
194 // References to the owning WebContents, and the corresponding MediaRouter. 185 // References to the owning WebContents, and the corresponding MediaRouter.
195 content::WebContents* web_contents_; 186 content::WebContents* web_contents_;
196 MediaRouter* router_; 187 MediaRouter* router_;
197 }; 188 };
198 189
199 PresentationFrame::PresentationFrame( 190 PresentationFrame::PresentationFrame(
200 const RenderFrameHostId& render_frame_host_id, 191 const RenderFrameHostId& render_frame_host_id,
201 content::WebContents* web_contents, 192 content::WebContents* web_contents,
202 MediaRouter* router) 193 MediaRouter* router)
203 : render_frame_host_id_(render_frame_host_id), 194 : render_frame_host_id_(render_frame_host_id),
204 web_contents_(web_contents), 195 web_contents_(web_contents),
205 router_(router) { 196 router_(router) {
206 DCHECK(web_contents_); 197 DCHECK(web_contents_);
207 DCHECK(router_); 198 DCHECK(router_);
208 } 199 }
209 200
210 PresentationFrame::~PresentationFrame() { 201 PresentationFrame::~PresentationFrame() {
211 } 202 }
212 203
213 void PresentationFrame::OnPresentationSessionStarted( 204 void PresentationFrame::OnPresentationSessionStarted(
214 const content::PresentationSessionInfo& session, 205 const content::PresentationSessionInfo& session,
215 const MediaRoute& route) { 206 const MediaRoute& route) {
216 presentation_id_to_route_.insert( 207 presentation_id_to_route_id_[session.presentation_id] =
217 std::make_pair(session.presentation_id, route)); 208 route.media_route_id();
218 } 209 }
219 210
220 const MediaRoute::Id PresentationFrame::GetRouteId( 211 const MediaRoute::Id PresentationFrame::GetRouteId(
221 const std::string& presentation_id) const { 212 const std::string& presentation_id) const {
222 auto it = presentation_id_to_route_.find(presentation_id); 213 auto it = presentation_id_to_route_id_.find(presentation_id);
223 return it != presentation_id_to_route_.end() ? it->second.media_route_id() 214 return it != presentation_id_to_route_id_.end() ? it->second : "";
224 : "";
225 } 215 }
226 216
227 bool PresentationFrame::SetScreenAvailabilityListener( 217 bool PresentationFrame::SetScreenAvailabilityListener(
228 content::PresentationScreenAvailabilityListener* listener) { 218 content::PresentationScreenAvailabilityListener* listener) {
229 MediaSource source(GetMediaSourceFromListener(listener)); 219 MediaSource source(GetMediaSourceFromListener(listener));
230 auto& sinks_observer = url_to_sinks_observer_[source.id()]; 220 auto& sinks_observer = url_to_sinks_observer_[source.id()];
231 if (sinks_observer && sinks_observer->listener() == listener) 221 if (sinks_observer && sinks_observer->listener() == listener)
232 return false; 222 return false;
233 223
234 sinks_observer.reset(new PresentationMediaSinksObserver( 224 sinks_observer.reset(new PresentationMediaSinksObserver(
(...skipping 20 matching lines...) Expand all
255 } 245 }
256 return false; 246 return false;
257 } 247 }
258 248
259 bool PresentationFrame::HasScreenAvailabilityListenerForTest( 249 bool PresentationFrame::HasScreenAvailabilityListenerForTest(
260 const MediaSource::Id& source_id) const { 250 const MediaSource::Id& source_id) const {
261 return url_to_sinks_observer_.find(source_id) != url_to_sinks_observer_.end(); 251 return url_to_sinks_observer_.find(source_id) != url_to_sinks_observer_.end();
262 } 252 }
263 253
264 void PresentationFrame::Reset() { 254 void PresentationFrame::Reset() {
265 auto offscreen_presentation_manager = 255 for (const auto& pid_route_id : presentation_id_to_route_id_)
266 OffscreenPresentationManagerFactory::GetOrCreateForWebContents( 256 router_->DetachRoute(pid_route_id.second);
267 web_contents_);
268 257
269 for (const auto& pid_route : presentation_id_to_route_) { 258 presentation_id_to_route_id_.clear();
270 if (IsOffscreenPresentation(pid_route.first)) {
271 offscreen_presentation_manager->UnregisterOffscreenPresentationController(
272 pid_route.first, render_frame_host_id_);
273 }
274 router_->DetachRoute(pid_route.second.media_route_id());
275 }
276
277 presentation_id_to_route_.clear();
278 url_to_sinks_observer_.clear(); 259 url_to_sinks_observer_.clear();
279 connection_state_subscriptions_.clear(); 260 connection_state_subscriptions_.clear();
280 session_messages_observers_.clear(); 261 session_messages_observers_.clear();
281 browser_connection_proxies_.clear();
282 } 262 }
283 263
284 void PresentationFrame::RemoveConnection(const std::string& presentation_id, 264 void PresentationFrame::RemoveConnection(const std::string& presentation_id,
285 const MediaRoute::Id& route_id) { 265 const MediaRoute::Id& route_id) {
286 // Remove the presentation id mapping so a later call to Reset is a no-op. 266 // Remove the presentation id mapping so a later call to Reset is a no-op.
287 presentation_id_to_route_.erase(presentation_id); 267 presentation_id_to_route_id_.erase(presentation_id);
288 268
289 // We no longer need to observe route messages. 269 // We no longer need to observe route messages.
290 session_messages_observers_.erase(route_id); 270 session_messages_observers_.erase(route_id);
291 271
292 browser_connection_proxies_.erase(route_id);
293 // We keep the PresentationConnectionStateChangedCallback registered with MR 272 // We keep the PresentationConnectionStateChangedCallback registered with MR
294 // so the MRP can tell us when terminate() completed. 273 // so the MRP can tell us when terminate() completed.
295 } 274 }
296 275
297 void PresentationFrame::ListenForConnectionStateChange( 276 void PresentationFrame::ListenForConnectionStateChange(
298 const content::PresentationSessionInfo& connection, 277 const content::PresentationSessionInfo& connection,
299 const content::PresentationConnectionStateChangedCallback& 278 const content::PresentationConnectionStateChangedCallback&
300 state_changed_cb) { 279 state_changed_cb) {
301 auto it = presentation_id_to_route_.find(connection.presentation_id); 280 auto it = presentation_id_to_route_id_.find(connection.presentation_id);
302 if (it == presentation_id_to_route_.end()) { 281 if (it == presentation_id_to_route_id_.end()) {
303 DLOG(ERROR) << __func__ << "route id not found for presentation: " 282 DLOG(ERROR) << __func__ << "route id not found for presentation: "
304 << connection.presentation_id; 283 << connection.presentation_id;
305 return; 284 return;
306 } 285 }
307 286
308 const MediaRoute::Id& route_id = it->second.media_route_id(); 287 const MediaRoute::Id& route_id = it->second;
309 if (connection_state_subscriptions_.find(route_id) != 288 if (connection_state_subscriptions_.find(route_id) !=
310 connection_state_subscriptions_.end()) { 289 connection_state_subscriptions_.end()) {
311 DLOG(ERROR) << __func__ 290 DLOG(ERROR) << __func__
312 << "Already listening connection state change for route: " 291 << "Already listening connection state change for route: "
313 << route_id; 292 << route_id;
314 return; 293 return;
315 } 294 }
316 295
317 connection_state_subscriptions_.insert(std::make_pair( 296 connection_state_subscriptions_.insert(std::make_pair(
318 route_id, router_->AddPresentationConnectionStateChangedCallback( 297 route_id, router_->AddPresentationConnectionStateChangedCallback(
319 route_id, state_changed_cb))); 298 it->second, state_changed_cb)));
320 } 299 }
321 300
322 void PresentationFrame::ListenForSessionMessages( 301 void PresentationFrame::ListenForSessionMessages(
323 const content::PresentationSessionInfo& session, 302 const content::PresentationSessionInfo& session,
324 const content::PresentationConnectionMessageCallback& message_cb) { 303 const content::PresentationConnectionMessageCallback& message_cb) {
325 auto it = presentation_id_to_route_.find(session.presentation_id); 304 auto it = presentation_id_to_route_id_.find(session.presentation_id);
326 if (it == presentation_id_to_route_.end()) { 305 if (it == presentation_id_to_route_id_.end()) {
327 DVLOG(2) << "ListenForSessionMessages: no route for " 306 DVLOG(2) << "ListenForSessionMessages: no route for "
328 << session.presentation_id; 307 << session.presentation_id;
329 return; 308 return;
330 } 309 }
331 310
332 if (it->second.is_offscreen_presentation()) { 311 const MediaRoute::Id& route_id = it->second;
333 DVLOG(2) << "ListenForSessionMessages: do not listen for offscreen "
334 << "presentation [id]: " << session.presentation_id;
335 return;
336 }
337
338 const MediaRoute::Id& route_id = it->second.media_route_id();
339 if (session_messages_observers_.find(route_id) != 312 if (session_messages_observers_.find(route_id) !=
340 session_messages_observers_.end()) { 313 session_messages_observers_.end()) {
341 DLOG(ERROR) << __func__ 314 DLOG(ERROR) << __func__
342 << "Already listening for session messages for route: " 315 << "Already listening for session messages for route: "
343 << route_id; 316 << route_id;
344 return; 317 return;
345 } 318 }
346 319
347 session_messages_observers_.insert(std::make_pair( 320 session_messages_observers_.insert(std::make_pair(
348 route_id, base::MakeUnique<PresentationSessionMessagesObserver>( 321 route_id, base::MakeUnique<PresentationSessionMessagesObserver>(
349 router_, route_id, message_cb))); 322 router_, it->second, message_cb)));
350 } 323 }
351 324
352 MediaSource PresentationFrame::GetMediaSourceFromListener( 325 MediaSource PresentationFrame::GetMediaSourceFromListener(
353 content::PresentationScreenAvailabilityListener* listener) const { 326 content::PresentationScreenAvailabilityListener* listener) const {
354 // If the default presentation URL is empty then fall back to tab mirroring. 327 // If the default presentation URL is empty then fall back to tab mirroring.
355 return listener->GetAvailabilityUrl().is_empty() 328 return listener->GetAvailabilityUrl().is_empty()
356 ? MediaSourceForTab(SessionTabHelper::IdForTab(web_contents_)) 329 ? MediaSourceForTab(SessionTabHelper::IdForTab(web_contents_))
357 : MediaSourceForPresentationUrl(listener->GetAvailabilityUrl()); 330 : MediaSourceForPresentationUrl(listener->GetAvailabilityUrl());
358 } 331 }
359 332
360 bool PresentationFrame::IsOffscreenPresentation(
361 const std::string& presentation_id) const {
362 const auto it = presentation_id_to_route_.find(presentation_id);
363 if (it == presentation_id_to_route_.end()) {
364 DLOG(WARNING) << "No route for [presentation_id]: " << presentation_id;
365 return false;
366 }
367
368 return it->second.is_offscreen_presentation();
369 }
370
371 void PresentationFrame::ConnectToPresentation(
372 const content::PresentationSessionInfo& session,
373 content::PresentationConnectionPtr controller_connection_ptr,
374 content::PresentationConnectionRequest receiver_connection_request) {
375 const auto pid_route_it =
376 presentation_id_to_route_.find(session.presentation_id);
377
378 if (pid_route_it == presentation_id_to_route_.end()) {
379 DLOG(WARNING) << "No route for [presentation_id]: "
380 << session.presentation_id;
381 return;
382 }
383
384 if (IsOffscreenPresentation(session.presentation_id)) {
385 auto* const offscreen_presentation_manager =
386 OffscreenPresentationManagerFactory::GetOrCreateForWebContents(
387 web_contents_);
388 offscreen_presentation_manager->RegisterOffscreenPresentationController(
389 session.presentation_id, session.presentation_url,
390 render_frame_host_id_, std::move(controller_connection_ptr),
391 std::move(receiver_connection_request));
392 } else {
393 DVLOG(2)
394 << "Creating BrowserPresentationConnectionProxy for [presentation_id]: "
395 << session.presentation_id;
396 MediaRoute::Id route_id = pid_route_it->second.media_route_id();
397 auto* proxy = new BrowserPresentationConnectionProxy(
398 router_, route_id, std::move(receiver_connection_request),
399 std::move(controller_connection_ptr));
400
401 browser_connection_proxies_.insert(
402 std::make_pair(route_id, base::WrapUnique(proxy)));
403 }
404 }
405
406 // Used by PresentationServiceDelegateImpl to manage PresentationFrames. 333 // Used by PresentationServiceDelegateImpl to manage PresentationFrames.
407 class PresentationFrameManager { 334 class PresentationFrameManager {
408 public: 335 public:
409 PresentationFrameManager(content::WebContents* web_contents, 336 PresentationFrameManager(content::WebContents* web_contents,
410 MediaRouter* router); 337 MediaRouter* router);
411 ~PresentationFrameManager(); 338 ~PresentationFrameManager();
412 339
413 // Mirror corresponding APIs in PresentationServiceDelegateImpl. 340 // Mirror corresponding APIs in PresentationServiceDelegateImpl.
414 bool SetScreenAvailabilityListener( 341 bool SetScreenAvailabilityListener(
415 const RenderFrameHostId& render_frame_host_id, 342 const RenderFrameHostId& render_frame_host_id,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 381
455 void OnPresentationSessionStarted( 382 void OnPresentationSessionStarted(
456 const RenderFrameHostId& render_frame_host_id, 383 const RenderFrameHostId& render_frame_host_id,
457 const content::PresentationSessionInfo& session, 384 const content::PresentationSessionInfo& session,
458 const MediaRoute& route); 385 const MediaRoute& route);
459 void OnDefaultPresentationSessionStarted( 386 void OnDefaultPresentationSessionStarted(
460 const PresentationRequest& request, 387 const PresentationRequest& request,
461 const content::PresentationSessionInfo& session, 388 const content::PresentationSessionInfo& session,
462 const MediaRoute& route); 389 const MediaRoute& route);
463 390
464 void ConnectToPresentation(
465 const RenderFrameHostId& render_frame_host_id,
466 const content::PresentationSessionInfo& session,
467 content::PresentationConnectionPtr controller_connection_ptr,
468 content::PresentationConnectionRequest receiver_connection_request);
469
470 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id, 391 const MediaRoute::Id GetRouteId(const RenderFrameHostId& render_frame_host_id,
471 const std::string& presentation_id) const; 392 const std::string& presentation_id) const;
472 393
473 const PresentationRequest* default_presentation_request() const { 394 const PresentationRequest* default_presentation_request() const {
474 return default_presentation_request_.get(); 395 return default_presentation_request_.get();
475 } 396 }
476 397
477 private: 398 private:
478 PresentationFrame* GetOrAddPresentationFrame( 399 PresentationFrame* GetOrAddPresentationFrame(
479 const RenderFrameHostId& render_frame_host_id); 400 const RenderFrameHostId& render_frame_host_id);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 const content::PresentationSessionInfo& session, 458 const content::PresentationSessionInfo& session,
538 const MediaRoute& route) { 459 const MediaRoute& route) {
539 OnPresentationSessionStarted(request.render_frame_host_id(), session, route); 460 OnPresentationSessionStarted(request.render_frame_host_id(), session, route);
540 461
541 if (default_presentation_request_ && 462 if (default_presentation_request_ &&
542 default_presentation_request_->Equals(request)) { 463 default_presentation_request_->Equals(request)) {
543 default_presentation_started_callback_.Run(session); 464 default_presentation_started_callback_.Run(session);
544 } 465 }
545 } 466 }
546 467
547 void PresentationFrameManager::ConnectToPresentation(
548 const RenderFrameHostId& render_frame_host_id,
549 const content::PresentationSessionInfo& session,
550 content::PresentationConnectionPtr controller_connection_ptr,
551 content::PresentationConnectionRequest receiver_connection_request) {
552 auto* presentation_frame = GetOrAddPresentationFrame(render_frame_host_id);
553 presentation_frame->ConnectToPresentation(
554 session, std::move(controller_connection_ptr),
555 std::move(receiver_connection_request));
556 }
557
558 const MediaRoute::Id PresentationFrameManager::GetRouteId( 468 const MediaRoute::Id PresentationFrameManager::GetRouteId(
559 const RenderFrameHostId& render_frame_host_id, 469 const RenderFrameHostId& render_frame_host_id,
560 const std::string& presentation_id) const { 470 const std::string& presentation_id) const {
561 const auto it = presentation_frames_.find(render_frame_host_id); 471 const auto it = presentation_frames_.find(render_frame_host_id);
562 return it != presentation_frames_.end() 472 return it != presentation_frames_.end()
563 ? it->second->GetRouteId(presentation_id) : MediaRoute::Id(); 473 ? it->second->GetRouteId(presentation_id) : MediaRoute::Id();
564 } 474 }
565 475
566 bool PresentationFrameManager::SetScreenAvailabilityListener( 476 bool PresentationFrameManager::SetScreenAvailabilityListener(
567 const RenderFrameHostId& render_frame_host_id, 477 const RenderFrameHostId& render_frame_host_id,
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 int render_process_id, 885 int render_process_id,
976 int render_frame_id, 886 int render_frame_id,
977 const content::PresentationSessionInfo& connection, 887 const content::PresentationSessionInfo& connection,
978 const content::PresentationConnectionStateChangedCallback& 888 const content::PresentationConnectionStateChangedCallback&
979 state_changed_cb) { 889 state_changed_cb) {
980 frame_manager_->ListenForConnectionStateChange( 890 frame_manager_->ListenForConnectionStateChange(
981 RenderFrameHostId(render_process_id, render_frame_id), connection, 891 RenderFrameHostId(render_process_id, render_frame_id), connection,
982 state_changed_cb); 892 state_changed_cb);
983 } 893 }
984 894
985 void PresentationServiceDelegateImpl::ConnectToPresentation( 895 void PresentationServiceDelegateImpl::ConnectToOffscreenPresentation(
986 int render_process_id, 896 int render_process_id,
987 int render_frame_id, 897 int render_frame_id,
988 const content::PresentationSessionInfo& session, 898 const content::PresentationSessionInfo& session,
989 content::PresentationConnectionPtr controller_connection_ptr, 899 content::PresentationConnectionPtr controller_connection_ptr,
990 content::PresentationConnectionRequest receiver_connection_request) { 900 content::PresentationConnectionRequest receiver_connection_request) {
991 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); 901 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id);
992 frame_manager_->ConnectToPresentation(render_frame_host_id, session, 902 auto* const offscreen_presentation_manager =
993 std::move(controller_connection_ptr), 903 OffscreenPresentationManagerFactory::GetOrCreateForWebContents(
994 std::move(receiver_connection_request)); 904 web_contents_);
905 offscreen_presentation_manager->RegisterOffscreenPresentationController(
906 session.presentation_id, session.presentation_url, render_frame_host_id,
907 std::move(controller_connection_ptr),
908 std::move(receiver_connection_request));
995 } 909 }
996 910
997 void PresentationServiceDelegateImpl::OnRouteResponse( 911 void PresentationServiceDelegateImpl::OnRouteResponse(
998 const PresentationRequest& presentation_request, 912 const PresentationRequest& presentation_request,
999 const RouteRequestResult& result) { 913 const RouteRequestResult& result) {
1000 if (!result.route() || 914 if (!result.route() ||
1001 !base::ContainsValue(presentation_request.presentation_urls(), 915 !base::ContainsValue(presentation_request.presentation_urls(),
1002 result.presentation_url())) { 916 result.presentation_url())) {
1003 return; 917 return;
1004 } 918 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 const base::ListValue* origins = 969 const base::ListValue* origins =
1056 Profile::FromBrowserContext(web_contents_->GetBrowserContext()) 970 Profile::FromBrowserContext(web_contents_->GetBrowserContext())
1057 ->GetPrefs() 971 ->GetPrefs()
1058 ->GetList(prefs::kMediaRouterTabMirroringSources); 972 ->GetList(prefs::kMediaRouterTabMirroringSources);
1059 return origins && 973 return origins &&
1060 origins->Find(base::StringValue(origin.Serialize())) != origins->end(); 974 origins->Find(base::StringValue(origin.Serialize())) != origins->end();
1061 } 975 }
1062 #endif // !defined(OS_ANDROID) 976 #endif // !defined(OS_ANDROID)
1063 977
1064 } // namespace media_router 978 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698