Commit 3c8a5079 authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert PlatformVerification to new Mojo types

This CL converts PlatformVerification{Ptr, Request} in media and
chrome to the new Mojo type.

Bug: 955171
Change-Id: I5d40f530680578cadb21be430b85ef096d55e7fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1883267
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#710201}
parent ccd9ebb1
...@@ -44,7 +44,7 @@ std::vector<uint8_t> GetStorageIdSaltFromProfile( ...@@ -44,7 +44,7 @@ std::vector<uint8_t> GetStorageIdSaltFromProfile(
// static // static
void PlatformVerificationImpl::Create( void PlatformVerificationImpl::Create(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
media::mojom::PlatformVerificationRequest request) { mojo::PendingReceiver<media::mojom::PlatformVerification> receiver) {
DVLOG(2) << __func__; DVLOG(2) << __func__;
DCHECK(render_frame_host); DCHECK(render_frame_host);
...@@ -53,13 +53,13 @@ void PlatformVerificationImpl::Create( ...@@ -53,13 +53,13 @@ void PlatformVerificationImpl::Create(
// The object is bound to the lifetime of |render_frame_host| and the mojo // The object is bound to the lifetime of |render_frame_host| and the mojo
// connection. See FrameServiceBase for details. // connection. See FrameServiceBase for details.
new PlatformVerificationImpl(render_frame_host, std::move(request)); new PlatformVerificationImpl(render_frame_host, std::move(receiver));
} }
PlatformVerificationImpl::PlatformVerificationImpl( PlatformVerificationImpl::PlatformVerificationImpl(
content::RenderFrameHost* render_frame_host, content::RenderFrameHost* render_frame_host,
media::mojom::PlatformVerificationRequest request) mojo::PendingReceiver<media::mojom::PlatformVerification> receiver)
: FrameServiceBase(render_frame_host, std::move(request)), : FrameServiceBase(render_frame_host, std::move(receiver)),
render_frame_host_(render_frame_host) {} render_frame_host_(render_frame_host) {}
PlatformVerificationImpl::~PlatformVerificationImpl() { PlatformVerificationImpl::~PlatformVerificationImpl() {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "content/public/browser/frame_service_base.h" #include "content/public/browser/frame_service_base.h"
#include "media/mojo/mojom/platform_verification.mojom.h" #include "media/mojo/mojom/platform_verification.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/attestation/platform_verification_flow.h" #include "chrome/browser/chromeos/attestation/platform_verification_flow.h"
...@@ -21,11 +22,13 @@ ...@@ -21,11 +22,13 @@
class PlatformVerificationImpl final class PlatformVerificationImpl final
: public content::FrameServiceBase<media::mojom::PlatformVerification> { : public content::FrameServiceBase<media::mojom::PlatformVerification> {
public: public:
static void Create(content::RenderFrameHost* render_frame_host, static void Create(
media::mojom::PlatformVerificationRequest request); content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<media::mojom::PlatformVerification> receiver);
PlatformVerificationImpl(content::RenderFrameHost* render_frame_host, PlatformVerificationImpl(
media::mojom::PlatformVerificationRequest request); content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<media::mojom::PlatformVerification> receiver);
// mojo::InterfaceImpl<PlatformVerification> implementation. // mojo::InterfaceImpl<PlatformVerification> implementation.
void ChallengePlatform(const std::string& service_id, void ChallengePlatform(const std::string& service_id,
......
...@@ -88,15 +88,15 @@ void MojoCdmHelper::ChallengePlatform(const std::string& service_id, ...@@ -88,15 +88,15 @@ void MojoCdmHelper::ChallengePlatform(const std::string& service_id,
mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false, mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false,
"", "", ""); "", "", "");
ConnectToPlatformVerification(); ConnectToPlatformVerification();
platform_verification_ptr_->ChallengePlatform(service_id, challenge, platform_verification_->ChallengePlatform(service_id, challenge,
std::move(scoped_callback)); std::move(scoped_callback));
} }
void MojoCdmHelper::GetStorageId(uint32_t version, StorageIdCB callback) { void MojoCdmHelper::GetStorageId(uint32_t version, StorageIdCB callback) {
StorageIdCB scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( StorageIdCB scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback), version, std::vector<uint8_t>()); std::move(callback), version, std::vector<uint8_t>());
ConnectToPlatformVerification(); ConnectToPlatformVerification();
platform_verification_ptr_->GetStorageId(version, std::move(scoped_callback)); platform_verification_->GetStorageId(version, std::move(scoped_callback));
} }
void MojoCdmHelper::CloseCdmFileIO(MojoCdmFileIO* cdm_file_io) { void MojoCdmHelper::CloseCdmFileIO(MojoCdmFileIO* cdm_file_io) {
...@@ -135,9 +135,10 @@ void MojoCdmHelper::ConnectToOutputProtection() { ...@@ -135,9 +135,10 @@ void MojoCdmHelper::ConnectToOutputProtection() {
} }
void MojoCdmHelper::ConnectToPlatformVerification() { void MojoCdmHelper::ConnectToPlatformVerification() {
if (!platform_verification_ptr_) { if (!platform_verification_) {
service_manager::GetInterface<mojom::PlatformVerification>( interface_provider_->GetInterface(
interface_provider_, &platform_verification_ptr_); mojom::PlatformVerification::Name_,
platform_verification_.BindNewPipeAndPassReceiver().PassPipe());
} }
} }
......
...@@ -75,7 +75,7 @@ class MEDIA_MOJO_EXPORT MojoCdmHelper final : public CdmAuxiliaryHelper, ...@@ -75,7 +75,7 @@ class MEDIA_MOJO_EXPORT MojoCdmHelper final : public CdmAuxiliaryHelper,
mojom::CdmStoragePtr cdm_storage_ptr_; mojom::CdmStoragePtr cdm_storage_ptr_;
std::unique_ptr<CdmAllocator> allocator_; std::unique_ptr<CdmAllocator> allocator_;
mojo::Remote<mojom::OutputProtection> output_protection_; mojo::Remote<mojom::OutputProtection> output_protection_;
mojom::PlatformVerificationPtr platform_verification_ptr_; mojo::Remote<mojom::PlatformVerification> platform_verification_;
FileReadCB file_read_cb_; FileReadCB file_read_cb_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment