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

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: resolve code review comments from Derek Created 4 years 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::Reset(int render_process_id,
32 int render_frame_id) {
33 DVLOG(2) << __FUNCTION__ << render_process_id << ", " << render_frame_id;
34 offscreen_presentation_manager_->OnOffscreenPresentationReceiverTerminated(
35 presentation_id_);
36 }
37
38 ReceiverPresentationServiceDelegateImpl::
39 ReceiverPresentationServiceDelegateImpl(content::WebContents* web_contents,
40 const std::string& presentation_id)
41 : web_contents_(web_contents),
42 presentation_id_(presentation_id),
43 offscreen_presentation_manager_(
44 OffscreenPresentationManagerFactory::
45 GetOrCreateForReceiverBrowserContext(web_contents_)) {
46 DCHECK(web_contents_);
47 DCHECK(!presentation_id.empty());
48 DCHECK(offscreen_presentation_manager_);
49 }
50
51 void ReceiverPresentationServiceDelegateImpl::
52 RegisterReceiverConnectionAvailableCallback(
53 const content::ReceiverConnectionAvailableCallback&
54 receiver_available_callback) {
55 offscreen_presentation_manager_->OnOffscreenPresentationReceiverCreated(
56 presentation_id_, web_contents_->GetLastCommittedURL(),
57 receiver_available_callback);
58 }
59
60 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698