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/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 | 8 |
9 #include "base/containers/scoped_ptr_hash_map.h" | 9 #include "base/containers/scoped_ptr_hash_map.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 scoped_ptr<PresentationFrame>( | 320 scoped_ptr<PresentationFrame>( |
321 new PresentationFrame(web_contents_, router_))); | 321 new PresentationFrame(web_contents_, router_))); |
322 } | 322 } |
323 return presentation_frames_.get(render_frame_host_id); | 323 return presentation_frames_.get(render_frame_host_id); |
324 } | 324 } |
325 | 325 |
326 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { | 326 void PresentationFrameManager::SetMediaRouterForTest(MediaRouter* router) { |
327 router_ = router; | 327 router_ = router; |
328 } | 328 } |
329 | 329 |
| 330 PresentationServiceDelegateImpl* |
| 331 PresentationServiceDelegateImpl::GetOrCreateForWebContents( |
| 332 content::WebContents* web_contents) { |
| 333 DCHECK(web_contents); |
| 334 // CreateForWebContents does nothing if the delegate instance already exists. |
| 335 PresentationServiceDelegateImpl::CreateForWebContents(web_contents); |
| 336 return PresentationServiceDelegateImpl::FromWebContents(web_contents); |
| 337 } |
| 338 |
330 PresentationServiceDelegateImpl::PresentationServiceDelegateImpl( | 339 PresentationServiceDelegateImpl::PresentationServiceDelegateImpl( |
331 content::WebContents* web_contents) | 340 content::WebContents* web_contents) |
332 : web_contents_(web_contents), | 341 : web_contents_(web_contents), |
333 router_(MediaRouterMojoImplFactory::GetApiForBrowserContext( | 342 router_(MediaRouterMojoImplFactory::GetApiForBrowserContext( |
334 web_contents_->GetBrowserContext())), | 343 web_contents_->GetBrowserContext())), |
335 frame_manager_(new PresentationFrameManager(web_contents, router_)), | 344 frame_manager_(new PresentationFrameManager(web_contents, router_)), |
336 weak_factory_(this) { | 345 weak_factory_(this) { |
337 DCHECK(web_contents_); | 346 DCHECK(web_contents_); |
338 DCHECK(router_); | 347 DCHECK(router_); |
339 } | 348 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( | 515 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( |
507 int render_process_id, | 516 int render_process_id, |
508 int render_frame_id, | 517 int render_frame_id, |
509 const MediaSource::Id& source_id) const { | 518 const MediaSource::Id& source_id) const { |
510 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 519 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
511 return frame_manager_->HasScreenAvailabilityListenerForTest( | 520 return frame_manager_->HasScreenAvailabilityListenerForTest( |
512 render_frame_host_id, source_id); | 521 render_frame_host_id, source_id); |
513 } | 522 } |
514 | 523 |
515 } // namespace media_router | 524 } // namespace media_router |
OLD | NEW |