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 PresentationServiceDelegateImpl* delegateImpl = | |
imcheng (use chromium acct)
2015/06/04 18:48:36
s/delegateImpl/delegate_impl
haibinlu
2015/06/04 20:25:45
Done.
| |
335 PresentationServiceDelegateImpl::FromWebContents(web_contents); | |
imcheng (use chromium acct)
2015/06/04 18:48:36
You can just do the following:
// No-ops if it al
haibinlu
2015/06/04 20:25:45
Done.
| |
336 if (!delegateImpl) { | |
337 PresentationServiceDelegateImpl::CreateForWebContents(web_contents); | |
338 delegateImpl = PresentationServiceDelegateImpl::FromWebContents( | |
339 web_contents); | |
340 } | |
341 return delegateImpl; | |
342 } | |
343 | |
330 PresentationServiceDelegateImpl::PresentationServiceDelegateImpl( | 344 PresentationServiceDelegateImpl::PresentationServiceDelegateImpl( |
331 content::WebContents* web_contents) | 345 content::WebContents* web_contents) |
332 : web_contents_(web_contents), | 346 : web_contents_(web_contents), |
333 router_(MediaRouterMojoImplFactory::GetApiForBrowserContext( | 347 router_(MediaRouterMojoImplFactory::GetApiForBrowserContext( |
334 web_contents_->GetBrowserContext())), | 348 web_contents_->GetBrowserContext())), |
335 frame_manager_(new PresentationFrameManager(web_contents, router_)), | 349 frame_manager_(new PresentationFrameManager(web_contents, router_)), |
336 weak_factory_(this) { | 350 weak_factory_(this) { |
337 DCHECK(web_contents_); | 351 DCHECK(web_contents_); |
338 DCHECK(router_); | 352 DCHECK(router_); |
339 } | 353 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( | 520 bool PresentationServiceDelegateImpl::HasScreenAvailabilityListenerForTest( |
507 int render_process_id, | 521 int render_process_id, |
508 int render_frame_id, | 522 int render_frame_id, |
509 const MediaSource::Id& source_id) const { | 523 const MediaSource::Id& source_id) const { |
510 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); | 524 RenderFrameHostId render_frame_host_id(render_process_id, render_frame_id); |
511 return frame_manager_->HasScreenAvailabilityListenerForTest( | 525 return frame_manager_->HasScreenAvailabilityListenerForTest( |
512 render_frame_host_id, source_id); | 526 render_frame_host_id, source_id); |
513 } | 527 } |
514 | 528 |
515 } // namespace media_router | 529 } // namespace media_router |
OLD | NEW |