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

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

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase Created 3 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/receiver_presentation_service_delegate_imp l.h" 5 #include "chrome/browser/media/router/receiver_presentation_service_delegate_imp l.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "chrome/browser/media/router/offscreen_presentation_manager.h" 8 #include "chrome/browser/media/router/offscreen_presentation_manager.h"
8 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" 9 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h"
9 10
10 DEFINE_WEB_CONTENTS_USER_DATA_KEY( 11 DEFINE_WEB_CONTENTS_USER_DATA_KEY(
11 media_router::ReceiverPresentationServiceDelegateImpl); 12 media_router::ReceiverPresentationServiceDelegateImpl);
12 13
13 using content::RenderFrameHost; 14 using content::RenderFrameHost;
14 15
15 namespace media_router { 16 namespace media_router {
16 17
17 // static 18 // static
18 void ReceiverPresentationServiceDelegateImpl::CreateForWebContents( 19 void ReceiverPresentationServiceDelegateImpl::CreateForWebContents(
19 content::WebContents* web_contents, 20 content::WebContents* web_contents,
20 const std::string& presentation_id) { 21 const std::string& presentation_id) {
21 DCHECK(web_contents); 22 DCHECK(web_contents);
22 23
23 if (FromWebContents(web_contents)) 24 if (FromWebContents(web_contents))
24 return; 25 return;
25 26
26 web_contents->SetUserData(UserDataKey(), 27 web_contents->SetUserData(
27 new ReceiverPresentationServiceDelegateImpl( 28 UserDataKey(),
28 web_contents, presentation_id)); 29 base::WrapUnique(new ReceiverPresentationServiceDelegateImpl(
30 web_contents, presentation_id)));
29 } 31 }
30 32
31 void ReceiverPresentationServiceDelegateImpl::AddObserver( 33 void ReceiverPresentationServiceDelegateImpl::AddObserver(
32 int render_process_id, 34 int render_process_id,
33 int render_frame_id, 35 int render_frame_id,
34 content::PresentationServiceDelegate::Observer* observer) { 36 content::PresentationServiceDelegate::Observer* observer) {
35 DCHECK(observer); 37 DCHECK(observer);
36 observers_.AddObserver(render_process_id, render_frame_id, observer); 38 observers_.AddObserver(render_process_id, render_frame_id, observer);
37 } 39 }
38 40
(...skipping 26 matching lines...) Expand all
65 void ReceiverPresentationServiceDelegateImpl:: 67 void ReceiverPresentationServiceDelegateImpl::
66 RegisterReceiverConnectionAvailableCallback( 68 RegisterReceiverConnectionAvailableCallback(
67 const content::ReceiverConnectionAvailableCallback& 69 const content::ReceiverConnectionAvailableCallback&
68 receiver_available_callback) { 70 receiver_available_callback) {
69 offscreen_presentation_manager_->OnOffscreenPresentationReceiverCreated( 71 offscreen_presentation_manager_->OnOffscreenPresentationReceiverCreated(
70 presentation_id_, web_contents_->GetLastCommittedURL(), 72 presentation_id_, web_contents_->GetLastCommittedURL(),
71 receiver_available_callback); 73 receiver_available_callback);
72 } 74 }
73 75
74 } // namespace media_router 76 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698