| OLD | NEW |
| 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 } |
| OLD | NEW |