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

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

Powered by Google App Engine
This is Rietveld 408576698