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

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

Issue 2477573002: [Presentation API] (3rd) (1-UA) Split PresentationServiceDelegateImpl(PSDImpl) (Closed)
Patch Set: fix windows compile error Created 3 years, 11 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
(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 "chrome/browser/media/router/offscreen_presentation_manager.h"
8 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h"
9
10 DEFINE_WEB_CONTENTS_USER_DATA_KEY(
11 media_router::ReceiverPresentationServiceDelegateImpl);
12
13 using content::RenderFrameHost;
14
15 namespace media_router {
16
17 // static
18 void ReceiverPresentationServiceDelegateImpl::CreateForWebContents(
19 content::WebContents* web_contents,
20 const std::string& presentation_id) {
21 DCHECK(web_contents);
22
23 if (FromWebContents(web_contents))
24 return;
25
26 web_contents->SetUserData(UserDataKey(),
27 new ReceiverPresentationServiceDelegateImpl(
28 web_contents, presentation_id));
29 }
30
31 void ReceiverPresentationServiceDelegateImpl::AddObserver(
32 int render_process_id,
33 int render_frame_id,
34 content::PresentationServiceDelegate::Observer* observer) {
35 DCHECK(observer);
36 observers_.AddObserver(render_process_id, render_frame_id, observer);
37 }
38
39 void ReceiverPresentationServiceDelegateImpl::RemoveObserver(
40 int render_process_id,
41 int render_frame_id) {
42 observers_.RemoveObserver(render_process_id, render_frame_id);
43 }
44
45 void ReceiverPresentationServiceDelegateImpl::Reset(int render_process_id,
46 int render_frame_id) {
47 DVLOG(2) << __FUNCTION__ << render_process_id << ", " << render_frame_id;
48 offscreen_presentation_manager_->OnOffscreenPresentationReceiverTerminated(
49 presentation_id_);
50 }
51
52 ReceiverPresentationServiceDelegateImpl::
53 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents,
54 const std::string& presentation_id)
55 : web_contents_(web_contents),
56 presentation_id_(presentation_id),
57 offscreen_presentation_manager_(
58 OffscreenPresentationManagerFactory::GetOrCreateForWebContents(
59 web_contents_)) {
60 DCHECK(web_contents_);
61 DCHECK(!presentation_id.empty());
62 DCHECK(offscreen_presentation_manager_);
63 }
64
65 void ReceiverPresentationServiceDelegateImpl::
66 RegisterReceiverConnectionAvailableCallback(
67 const content::ReceiverConnectionAvailableCallback&
68 receiver_available_callback) {
69 offscreen_presentation_manager_->OnOffscreenPresentationReceiverCreated(
70 presentation_id_, web_contents_->GetLastCommittedURL(),
71 receiver_available_callback);
72 }
73
74 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698