Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h" | |
| 6 | |
| 7 #include "content/public/browser/render_frame_host.h" | |
| 8 #include "content/public/browser/render_process_host.h" | |
| 9 #include "url/gurl.h" | |
|
mark a. foltz
2016/11/15 23:41:46
None of these #includes seem to be used.
zhaobin
2016/11/16 18:02:41
Done.
| |
| 10 | |
| 11 DEFINE_WEB_CONTENTS_USER_DATA_KEY( | |
| 12 media_router::ReceiverPresentationServiceDelegateImpl); | |
| 13 | |
| 14 using content::RenderFrameHost; | |
| 15 | |
| 16 namespace media_router { | |
| 17 | |
| 18 // static | |
| 19 void ReceiverPresentationServiceDelegateImpl::CreateForWebContents( | |
| 20 content::WebContents* web_contents, | |
| 21 const std::string& presentation_id) { | |
| 22 DCHECK(web_contents); | |
| 23 | |
| 24 if (FromWebContents(web_contents)) | |
| 25 return; | |
| 26 | |
| 27 web_contents->SetUserData(UserDataKey(), | |
| 28 new ReceiverPresentationServiceDelegateImpl( | |
| 29 web_contents, presentation_id)); | |
| 30 } | |
| 31 | |
| 32 ReceiverPresentationServiceDelegateImpl:: | |
| 33 ~ReceiverPresentationServiceDelegateImpl() {} | |
| 34 | |
| 35 void ReceiverPresentationServiceDelegateImpl::AddObserver( | |
| 36 int render_process_id, | |
| 37 int render_frame_id, | |
| 38 content::PresentationServiceDelegateBase::Observer* observer) { | |
| 39 PresentationServiceDelegateBaseImpl::AddObserver(render_process_id, | |
|
mark a. foltz
2016/11/15 23:41:46
Since this just calling through to the base class
zhaobin
2016/11/16 18:02:41
Done.
| |
| 40 render_frame_id, observer); | |
| 41 } | |
| 42 | |
| 43 void ReceiverPresentationServiceDelegateImpl::RemoveObserver( | |
| 44 int render_process_id, | |
| 45 int render_frame_id) { | |
| 46 PresentationServiceDelegateBaseImpl::RemoveObserver(render_process_id, | |
| 47 render_frame_id); | |
| 48 } | |
| 49 | |
| 50 void ReceiverPresentationServiceDelegateImpl::Reset(int render_process_id, | |
| 51 int render_frame_id) { | |
| 52 DVLOG(2) << __FUNCTION__ << render_process_id << ", " << render_frame_id; | |
| 53 offscreen_presentation_manager_->OnOffscreenPresentationReceiverTerminated( | |
| 54 presentation_id_); | |
| 55 } | |
| 56 | |
| 57 ReceiverPresentationServiceDelegateImpl:: | |
| 58 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents, | |
| 59 const std::string& presentation_id) | |
| 60 : web_contents_(web_contents), | |
| 61 presentation_id_(presentation_id), | |
| 62 offscreen_presentation_manager_( | |
| 63 OffscreenPresentationManagerFactory:: | |
| 64 GetOrCreateForReceiverBrowserContext(web_contents_)) { | |
| 65 DCHECK(web_contents_); | |
| 66 DCHECK(!presentation_id.empty()); | |
| 67 DCHECK(offscreen_presentation_manager_); | |
| 68 } | |
| 69 | |
| 70 void ReceiverPresentationServiceDelegateImpl:: | |
| 71 RegisterReceiverConnectionAvailableCallback( | |
| 72 const content::ReceiverConnectionAvailableCallback& | |
| 73 receiver_available_callback) { | |
| 74 offscreen_presentation_manager_->OnOffscreenPresentationReceiverCreated( | |
| 75 presentation_id_, web_contents_->GetLastCommittedURL(), | |
| 76 receiver_available_callback); | |
| 77 } | |
| 78 | |
| 79 } // namespace media_router | |
| OLD | NEW |