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

Side by Side Diff: chrome/browser/media/output_protection_impl.cc

Issue 2326913003: Privatize StrongBinding lifetime management (Closed)
Patch Set: rebase Created 4 years, 3 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/output_protection_impl.h" 5 #include "chrome/browser/media/output_protection_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h"
9 10
10 using media::mojom::OutputProtection; 11 using media::mojom::OutputProtection;
11 12
12 // static 13 // static
13 void OutputProtectionImpl::Create( 14 void OutputProtectionImpl::Create(
14 content::RenderFrameHost* render_frame_host, 15 content::RenderFrameHost* render_frame_host,
15 mojo::InterfaceRequest<OutputProtection> request) { 16 mojo::InterfaceRequest<OutputProtection> request) {
16 DVLOG(2) << __FUNCTION__; 17 DVLOG(2) << __FUNCTION__;
17 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 18 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
18 DCHECK(render_frame_host); 19 DCHECK(render_frame_host);
19 20 mojo::MakeStrongBinding(
20 // The created object is strongly bound to (and owned by) the pipe. 21 base::MakeUnique<OutputProtectionImpl>(render_frame_host),
21 new OutputProtectionImpl(render_frame_host, std::move(request)); 22 std::move(request));
22 } 23 }
23 24
24 OutputProtectionImpl::OutputProtectionImpl( 25 OutputProtectionImpl::OutputProtectionImpl(
25 content::RenderFrameHost* render_frame_host, 26 content::RenderFrameHost* render_frame_host)
26 mojo::InterfaceRequest<OutputProtection> request) 27 : render_frame_host_(render_frame_host), weak_factory_(this) {
27 : binding_(this, std::move(request)),
28 render_frame_host_(render_frame_host),
29 weak_factory_(this) {
30 DCHECK(render_frame_host_); 28 DCHECK(render_frame_host_);
31 } 29 }
32 30
33 OutputProtectionImpl::~OutputProtectionImpl() {} 31 OutputProtectionImpl::~OutputProtectionImpl() {}
34 32
35 void OutputProtectionImpl::QueryStatus(const QueryStatusCallback& callback) { 33 void OutputProtectionImpl::QueryStatus(const QueryStatusCallback& callback) {
36 DVLOG(2) << __FUNCTION__; 34 DVLOG(2) << __FUNCTION__;
37 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 35 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
38 36
39 NOTIMPLEMENTED(); 37 NOTIMPLEMENTED();
40 38
41 callback.Run(false, 0, 0); 39 callback.Run(false, 0, 0);
42 } 40 }
43 41
44 void OutputProtectionImpl::EnableProtection( 42 void OutputProtectionImpl::EnableProtection(
45 uint32_t desired_protection_mask, 43 uint32_t desired_protection_mask,
46 const EnableProtectionCallback& callback) { 44 const EnableProtectionCallback& callback) {
47 DVLOG(2) << __FUNCTION__; 45 DVLOG(2) << __FUNCTION__;
48 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 46 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
49 47
50 NOTIMPLEMENTED(); 48 NOTIMPLEMENTED();
51 49
52 callback.Run(false); 50 callback.Run(false);
53 } 51 }
OLDNEW
« no previous file with comments | « chrome/browser/media/output_protection_impl.h ('k') | chrome/browser/metrics/leak_detector/leak_detector_remote_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698