Merge cdm_pref_service.mojom with platform_verification.mojom

This change merges two Mojo interface used by the CDM,
cdm_pref_service.mojom and platform_verification.mojom into a new
cdm_document_service.mojom interface.

Bug: 1188717
Change-Id: I1971ef0fc94003cd482d44dd72beb0152b50d47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2920990
Reviewed-by: Alex Gough <[email protected]>
Reviewed-by: Xiaohan Wang <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Commit-Queue: Alex St-Onge <[email protected]>
Cr-Commit-Position: refs/heads/master@{#890258}
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 01339e77..ed99de4 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -703,8 +703,6 @@
     "media/media_storage_id_salt.h",
     "media/output_protection_proxy.cc",
     "media/output_protection_proxy.h",
-    "media/platform_verification_impl.cc",
-    "media/platform_verification_impl.h",
     "media/webrtc/audio_debug_recordings_handler.cc",
     "media/webrtc/audio_debug_recordings_handler.h",
     "media/webrtc/camera_pan_tilt_zoom_permission_context.cc",
@@ -4834,8 +4832,6 @@
       "install_verification/win/module_list.h",
       "install_verification/win/module_verification_common.cc",
       "install_verification/win/module_verification_common.h",
-      "media/cdm_pref_service_impl.cc",
-      "media/cdm_pref_service_impl.h",
       "media/webrtc/window_icon_util_win.cc",
       "media_galleries/win/mtp_device_delegate_impl_win.cc",
       "media_galleries/win/mtp_device_delegate_impl_win.h",
@@ -6007,6 +6003,20 @@
     }
   }
 
+  if (enable_library_cdms || is_win) {
+    sources += [
+      "media/cdm_document_service_impl.cc",
+      "media/cdm_document_service_impl.h",
+    ]
+  }
+
+  if (is_win) {
+    sources += [
+      "media/cdm_pref_service_helper.cc",
+      "media/cdm_pref_service_helper.h",
+    ]
+  }
+
   if (enable_message_center) {
     sources += [
       "notifications/notification_platform_bridge_message_center.cc",
diff --git a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
index 2d4d2f8..5a6558c 100644
--- a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
+++ b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
@@ -43,7 +43,6 @@
 #if defined(OS_ANDROID)
 #include "chrome/browser/download/android/available_offline_content_provider.h"
 #elif defined(OS_WIN)
-#include "chrome/browser/media/cdm_pref_service_impl.h"
 #include "chrome/browser/win/conflicts/module_database.h"
 #include "chrome/browser/win/conflicts/module_event_sink_impl.h"
 #elif BUILDFLAG(IS_CHROMEOS_ASH)
@@ -58,10 +57,13 @@
 #include "extensions/browser/extensions_browser_client.h"
 #endif
 
+#if BUILDFLAG(ENABLE_LIBRARY_CDMS) || defined(OS_WIN)
+#include "chrome/browser/media/cdm_document_service_impl.h"
+#endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS) || defined(OS_WIN)
+
 #if BUILDFLAG(ENABLE_LIBRARY_CDMS)
 #include "chrome/browser/media/output_protection_impl.h"
-#include "chrome/browser/media/platform_verification_impl.h"
-#endif
+#endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS)
 
 #if BUILDFLAG(ENABLE_MOJO_CDM) && defined(OS_ANDROID)
 #include "chrome/browser/media/android/cdm/media_drm_storage_factory.h"
@@ -253,19 +255,14 @@
     OutputProtectionImpl::Create(render_frame_host, std::move(r));
     return;
   }
-
-  if (auto r = receiver.As<media::mojom::PlatformVerification>()) {
-    PlatformVerificationImpl::Create(render_frame_host, std::move(r));
-    return;
-  }
 #endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS)
 
-#if defined(OS_WIN)
-  if (auto r = receiver.As<media::mojom::CdmPrefService>()) {
-    CdmPrefServiceImpl::Create(render_frame_host, std::move(r));
+#if BUILDFLAG(ENABLE_LIBRARY_CDMS) || defined(OS_WIN)
+  if (auto r = receiver.As<media::mojom::CdmDocumentService>()) {
+    CdmDocumentServiceImpl::Create(render_frame_host, std::move(r));
     return;
   }
-#endif  // defined(OS_WIN)
+#endif  // BUILDFLAG(ENABLE_LIBRARY_CDMS) || defined(OS_WIN)
 
 #if BUILDFLAG(ENABLE_MOJO_CDM) && defined(OS_ANDROID)
   if (auto r = receiver.As<media::mojom::MediaDrmStorage>()) {
diff --git a/chrome/browser/media/platform_verification_impl.cc b/chrome/browser/media/cdm_document_service_impl.cc
similarity index 73%
rename from chrome/browser/media/platform_verification_impl.cc
rename to chrome/browser/media/cdm_document_service_impl.cc
index e1c0d0ed..cbea0601 100644
--- a/chrome/browser/media/platform_verification_impl.cc
+++ b/chrome/browser/media/cdm_document_service_impl.cc
@@ -2,12 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/media/platform_verification_impl.h"
+#include "chrome/browser/media/cdm_document_service_impl.h"
 
 #include <utility>
 
 #include "base/bind.h"
 #include "build/chromeos_buildflags.h"
+#include "components/user_prefs/user_prefs.h"
+#include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/web_contents.h"
 #include "media/media_buildflags.h"
@@ -28,7 +30,9 @@
 #include "chromeos/settings/cros_settings_names.h"
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 
-using media::mojom::PlatformVerification;
+#if defined(OS_WIN)
+#include "chrome/browser/media/cdm_pref_service_helper.h"
+#endif  // defined(OS_WIN)
 
 namespace {
 
@@ -51,39 +55,40 @@
 }  // namespace
 
 // static
-void PlatformVerificationImpl::Create(
+void CdmDocumentServiceImpl::Create(
     content::RenderFrameHost* render_frame_host,
-    mojo::PendingReceiver<media::mojom::PlatformVerification> receiver) {
+    mojo::PendingReceiver<media::mojom::CdmDocumentService> receiver) {
   DVLOG(2) << __func__;
   DCHECK(render_frame_host);
 
-  // PlatformVerificationFlow requires to run on the UI thread.
+  // PlatformVerificationFlow and the pref service requires to be run/accessed
+  // on the UI thread.
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 
   // The object is bound to the lifetime of |render_frame_host| and the mojo
   // connection. See DocumentServiceBase for details.
-  new PlatformVerificationImpl(render_frame_host, std::move(receiver));
+  new CdmDocumentServiceImpl(render_frame_host, std::move(receiver));
 }
 
-PlatformVerificationImpl::PlatformVerificationImpl(
+CdmDocumentServiceImpl::CdmDocumentServiceImpl(
     content::RenderFrameHost* render_frame_host,
-    mojo::PendingReceiver<media::mojom::PlatformVerification> receiver)
+    mojo::PendingReceiver<media::mojom::CdmDocumentService> receiver)
     : DocumentServiceBase(render_frame_host, std::move(receiver)),
       render_frame_host_(render_frame_host) {}
 
-PlatformVerificationImpl::~PlatformVerificationImpl() {
+CdmDocumentServiceImpl::~CdmDocumentServiceImpl() {
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 }
 
-void PlatformVerificationImpl::ChallengePlatform(
+void CdmDocumentServiceImpl::ChallengePlatform(
     const std::string& service_id,
     const std::string& challenge,
     ChallengePlatformCallback callback) {
   DVLOG(2) << __func__;
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 
-// TODO(crbug.com/676224). This should be commented out at the mojom
-// level so that it's only available for ChromeOS.
+  // TODO(crbug.com/676224). This should be commented out at the mojom
+  // level so that it's only available for ChromeOS.
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   if (!platform_verification_flow_)
@@ -93,7 +98,7 @@
   platform_verification_flow_->ChallengePlatformKey(
       content::WebContents::FromRenderFrameHost(render_frame_host()),
       service_id, challenge,
-      base::BindOnce(&PlatformVerificationImpl::OnPlatformChallenged,
+      base::BindOnce(&CdmDocumentServiceImpl::OnPlatformChallenged,
                      weak_factory_.GetWeakPtr(), std::move(callback)));
 #else
   // Not supported, so return failure.
@@ -102,7 +107,7 @@
 }
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
-void PlatformVerificationImpl::OnPlatformChallenged(
+void CdmDocumentServiceImpl::OnPlatformChallenged(
     ChallengePlatformCallback callback,
     PlatformVerificationResult result,
     const std::string& signed_data,
@@ -128,13 +133,13 @@
 }
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 
-void PlatformVerificationImpl::GetStorageId(uint32_t version,
-                                            GetStorageIdCallback callback) {
+void CdmDocumentServiceImpl::GetStorageId(uint32_t version,
+                                          GetStorageIdCallback callback) {
   DVLOG(2) << __func__ << " version: " << version;
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 
-// TODO(crbug.com/676224). This should be commented out at the mojom
-// level so that it's only available if Storage Id is available.
+  // TODO(crbug.com/676224). This should be commented out at the mojom
+  // level so that it's only available if Storage Id is available.
 
 #if BUILDFLAG(ENABLE_CDM_STORAGE_ID)
   // Check that the request is for a supported version.
@@ -142,7 +147,7 @@
       version == kRequestLatestStorageIdVersion) {
     ComputeStorageId(
         GetStorageIdSaltFromProfile(render_frame_host_), origin(),
-        base::BindOnce(&PlatformVerificationImpl::OnStorageIdResponse,
+        base::BindOnce(&CdmDocumentServiceImpl::OnStorageIdResponse,
                        weak_factory_.GetWeakPtr(), std::move(callback)));
     return;
   }
@@ -154,7 +159,7 @@
 }
 
 #if BUILDFLAG(ENABLE_CDM_STORAGE_ID)
-void PlatformVerificationImpl::OnStorageIdResponse(
+void CdmDocumentServiceImpl::OnStorageIdResponse(
     GetStorageIdCallback callback,
     const std::vector<uint8_t>& storage_id) {
   DVLOG(2) << __func__ << " version: " << kCurrentStorageIdVersion
@@ -165,7 +170,7 @@
 #endif  // BUILDFLAG(ENABLE_CDM_STORAGE_ID)
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
-void PlatformVerificationImpl::IsVerifiedAccessEnabled(
+void CdmDocumentServiceImpl::IsVerifiedAccessEnabled(
     IsVerifiedAccessEnabledCallback callback) {
   // If we are in guest/incognito mode, then verified access is effectively
   // disabled.
@@ -187,3 +192,19 @@
   std::move(callback).Run(enabled_for_device);
 }
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
+
+#if defined(OS_WIN)
+void CdmDocumentServiceImpl::GetCdmOriginId(GetCdmOriginIdCallback callback) {
+  const url::Origin cdm_origin = origin();
+  if (cdm_origin.opaque()) {
+    mojo::ReportBadMessage("EME use is not allowed on opaque origin");
+    return;
+  }
+
+  PrefService* user_prefs = user_prefs::UserPrefs::Get(
+      content::WebContents::FromRenderFrameHost(render_frame_host())
+          ->GetBrowserContext());
+  std::move(callback).Run(
+      CdmPrefServiceHelper::GetCdmOriginId(user_prefs, cdm_origin));
+}
+#endif  // defined(OS_WIN)
diff --git a/chrome/browser/media/platform_verification_impl.h b/chrome/browser/media/cdm_document_service_impl.h
similarity index 65%
rename from chrome/browser/media/platform_verification_impl.h
rename to chrome/browser/media/cdm_document_service_impl.h
index 0efe796..98780bfe 100644
--- a/chrome/browser/media/platform_verification_impl.h
+++ b/chrome/browser/media/cdm_document_service_impl.h
@@ -2,36 +2,38 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CHROME_BROWSER_MEDIA_PLATFORM_VERIFICATION_IMPL_H_
-#define CHROME_BROWSER_MEDIA_PLATFORM_VERIFICATION_IMPL_H_
+#ifndef CHROME_BROWSER_MEDIA_CDM_DOCUMENT_SERVICE_IMPL_H_
+#define CHROME_BROWSER_MEDIA_CDM_DOCUMENT_SERVICE_IMPL_H_
 
 #include <string>
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
+#include "build/build_config.h"
 #include "build/chromeos_buildflags.h"
 #include "content/public/browser/document_service_base.h"
-#include "media/mojo/mojom/platform_verification.mojom.h"
+#include "media/mojo/mojom/cdm_document_service.mojom.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
 #include "chrome/browser/ash/attestation/platform_verification_flow.h"
 #endif
 
-// Implements media::mojom::PlatformVerification. Can only be used on the
-// UI thread because PlatformVerificationFlow lives on the UI thread.
-class PlatformVerificationImpl final
-    : public content::DocumentServiceBase<media::mojom::PlatformVerification> {
+// Implements media::mojom::CdmDocumentService. Can only be used on the
+// UI thread because PlatformVerificationFlow and the pref service lives on the
+// UI thread.
+class CdmDocumentServiceImpl final
+    : public content::DocumentServiceBase<media::mojom::CdmDocumentService> {
  public:
   static void Create(
       content::RenderFrameHost* render_frame_host,
-      mojo::PendingReceiver<media::mojom::PlatformVerification> receiver);
+      mojo::PendingReceiver<media::mojom::CdmDocumentService> receiver);
 
-  PlatformVerificationImpl(
+  CdmDocumentServiceImpl(
       content::RenderFrameHost* render_frame_host,
-      mojo::PendingReceiver<media::mojom::PlatformVerification> receiver);
+      mojo::PendingReceiver<media::mojom::CdmDocumentService> receiver);
 
-  // mojo::InterfaceImpl<PlatformVerification> implementation.
+  // media::mojom::CdmDocumentService implementation.
   void ChallengePlatform(const std::string& service_id,
                          const std::string& challenge,
                          ChallengePlatformCallback callback) final;
@@ -39,10 +41,13 @@
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   void IsVerifiedAccessEnabled(IsVerifiedAccessEnabledCallback callback) final;
 #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
+#if defined(OS_WIN)
+  void GetCdmOriginId(GetCdmOriginIdCallback callback) final;
+#endif  // defined(OS_WIN)
 
  private:
   // |this| can only be destructed as a DocumentServiceBase.
-  ~PlatformVerificationImpl() final;
+  ~CdmDocumentServiceImpl() final;
 
 #if BUILDFLAG(IS_CHROMEOS_ASH)
   using PlatformVerificationResult =
@@ -64,7 +69,7 @@
 #endif
 
   content::RenderFrameHost* const render_frame_host_;
-  base::WeakPtrFactory<PlatformVerificationImpl> weak_factory_{this};
+  base::WeakPtrFactory<CdmDocumentServiceImpl> weak_factory_{this};
 };
 
-#endif  // CHROME_BROWSER_MEDIA_PLATFORM_VERIFICATION_IMPL_H_
+#endif  // CHROME_BROWSER_MEDIA_CDM_DOCUMENT_SERVICE_IMPL_H_
diff --git a/chrome/browser/media/cdm_pref_service_impl_test.cc b/chrome/browser/media/cdm_document_service_impl_test.cc
similarity index 61%
rename from chrome/browser/media/cdm_pref_service_impl_test.cc
rename to chrome/browser/media/cdm_document_service_impl_test.cc
index 4771c9c..5da14169 100644
--- a/chrome/browser/media/cdm_pref_service_impl_test.cc
+++ b/chrome/browser/media/cdm_document_service_impl_test.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/media/cdm_pref_service_impl.h"
+#include "chrome/browser/media/cdm_document_service_impl.h"
 
 #include <memory>
 
@@ -12,7 +12,7 @@
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "components/sync_preferences/testing_pref_service_syncable.h"
-#include "media/mojo/mojom/cdm_pref_service.mojom.h"
+#include "media/mojo/mojom/cdm_document_service.mojom.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
@@ -30,17 +30,18 @@
 using GetCdmOriginIdMockCB =
     base::MockOnceCallback<void(const base::UnguessableToken&)>;
 
-class CdmPrefServiceImplTest : public ChromeRenderViewHostTestHarness {
+class CdmDocumentServiceImplTest : public ChromeRenderViewHostTestHarness {
  public:
-  void NavigateToUrlAndCreateCdmPrefService(GURL url) {
-    // The lifetime of `cdm_pref_service_` is tied to the lifetime of the Frame.
-    // When changing URL we need to unbind `cdm_pref_service_` before we can
-    // bind it to the new frame.
-    if (cdm_pref_service_.is_bound())
-      ASSERT_TRUE(cdm_pref_service_.Unbind());
+  void NavigateToUrlAndCreateCdmDocumentService(GURL url) {
+    // The lifetime of `cdm_document_service_` is tied to the lifetime of the
+    // Frame. When changing URL we need to unbind `cdm_document_service_` before
+    // we can bind it to the new frame.
+    if (cdm_document_service_.is_bound())
+      ASSERT_TRUE(cdm_document_service_.Unbind());
     NavigateAndCommit(url);
-    CdmPrefServiceImpl::Create(web_contents()->GetMainFrame(),
-                               cdm_pref_service_.BindNewPipeAndPassReceiver());
+    CdmDocumentServiceImpl::Create(
+        web_contents()->GetMainFrame(),
+        cdm_document_service_.BindNewPipeAndPassReceiver());
   }
 
   const base::UnguessableToken GetCdmOriginId() {
@@ -48,7 +49,7 @@
     GetCdmOriginIdMockCB mock_cb;
     EXPECT_CALL(mock_cb, Run(_)).WillOnce(SaveArg<0>(&origin_id));
 
-    cdm_pref_service_->GetCdmOriginId(mock_cb.Get());
+    cdm_document_service_->GetCdmOriginId(mock_cb.Get());
     base::RunLoop().RunUntilIdle();
 
     EXPECT_FALSE(origin_id.is_empty());
@@ -56,29 +57,29 @@
   }
 
  protected:
-  mojo::Remote<media::mojom::CdmPrefService> cdm_pref_service_;
+  mojo::Remote<media::mojom::CdmDocumentService> cdm_document_service_;
 };
 
 // Verify that we get a non null origin id.
-TEST_F(CdmPrefServiceImplTest, GetOriginId) {
-  NavigateToUrlAndCreateCdmPrefService(GURL(kTestOrigin));
+TEST_F(CdmDocumentServiceImplTest, GetOriginId) {
+  NavigateToUrlAndCreateCdmDocumentService(GURL(kTestOrigin));
   ignore_result(GetCdmOriginId());
 }
 
 // Verify that we can correctly get an existing origin id.
-TEST_F(CdmPrefServiceImplTest, GetSameOriginId) {
+TEST_F(CdmDocumentServiceImplTest, GetSameOriginId) {
   const auto kOrigin = url::Origin::Create(GURL(kTestOrigin));
   const auto kOtherOrigin = url::Origin::Create(GURL(kTestOrigin2));
 
-  NavigateToUrlAndCreateCdmPrefService(GURL(kTestOrigin));
+  NavigateToUrlAndCreateCdmDocumentService(GURL(kTestOrigin));
   base::UnguessableToken origin_id1 = GetCdmOriginId();
 
   // Create an unrelated origin id
-  NavigateToUrlAndCreateCdmPrefService(GURL(kTestOrigin2));
+  NavigateToUrlAndCreateCdmDocumentService(GURL(kTestOrigin2));
   base::UnguessableToken origin_id2 = GetCdmOriginId();
 
   // Get the origin id for the first origin
-  NavigateToUrlAndCreateCdmPrefService(GURL(kTestOrigin));
+  NavigateToUrlAndCreateCdmDocumentService(GURL(kTestOrigin));
   base::UnguessableToken origin_id3 = GetCdmOriginId();
 
   ASSERT_NE(origin_id2, origin_id1);
diff --git a/chrome/browser/media/cdm_pref_service_impl.cc b/chrome/browser/media/cdm_pref_service_helper.cc
similarity index 75%
rename from chrome/browser/media/cdm_pref_service_impl.cc
rename to chrome/browser/media/cdm_pref_service_helper.cc
index 01bf2e4..639875c 100644
--- a/chrome/browser/media/cdm_pref_service_impl.cc
+++ b/chrome/browser/media/cdm_pref_service_helper.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "chrome/browser/media/cdm_pref_service_impl.h"
+#include "chrome/browser/media/cdm_pref_service_helper.h"
 
 #include "base/logging.h"
 
@@ -13,7 +13,6 @@
 #include "components/prefs/pref_registry_simple.h"
 #include "components/prefs/pref_service.h"
 #include "components/prefs/scoped_user_pref_update.h"
-#include "components/user_prefs/user_prefs.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
 #include "third_party/abseil-cpp/absl/types/optional.h"
@@ -86,42 +85,26 @@
 
 }  // namespace
 
-void CdmPrefServiceImpl::Create(
-    content::RenderFrameHost* render_frame_host,
-    mojo::PendingReceiver<media::mojom::CdmPrefService> receiver) {
-  DCHECK(render_frame_host);
-  DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+CdmPrefServiceHelper::CdmPrefServiceHelper() = default;
+CdmPrefServiceHelper::~CdmPrefServiceHelper() = default;
 
-  // The object is bound to the lifetime of `render_frame_host` and the mojo
-  // connection. See DocumentServiceBase for details.
-  new CdmPrefServiceImpl(render_frame_host, std::move(receiver));
-}
-
-CdmPrefServiceImpl::CdmPrefServiceImpl(
-    content::RenderFrameHost* render_frame_host,
-    mojo::PendingReceiver<media::mojom::CdmPrefService> receiver)
-    : DocumentServiceBase(render_frame_host, std::move(receiver)) {}
-
-CdmPrefServiceImpl::~CdmPrefServiceImpl() = default;
-
-void CdmPrefServiceImpl::RegisterProfilePrefs(PrefRegistrySimple* registry) {
+void CdmPrefServiceHelper::RegisterProfilePrefs(PrefRegistrySimple* registry) {
   registry->RegisterDictionaryPref(prefs::kMediaCdmOrigin);
 }
 
-void CdmPrefServiceImpl::GetCdmOriginId(GetCdmOriginIdCallback callback) {
+base::UnguessableToken CdmPrefServiceHelper::GetCdmOriginId(
+    PrefService* user_prefs,
+    const url::Origin& cdm_origin) {
   // Access to the PrefService must be made from the UI thread.
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 
-  PrefService* user_prefs = user_prefs::UserPrefs::Get(
-      content::WebContents::FromRenderFrameHost(render_frame_host())
-          ->GetBrowserContext());
   const base::DictionaryValue* dict =
       user_prefs->GetDictionary(prefs::kMediaCdmOrigin);
 
-  const url::Origin cdm_origin = origin();
+  DCHECK(!cdm_origin.opaque());
   if (cdm_origin.opaque()) {
     mojo::ReportBadMessage("EME use is not allowed on opaque origin");
-    return;
+    return base::UnguessableToken::Null();
   }
 
   const std::string serialized_cdm_origin = cdm_origin.Serialize();
@@ -146,5 +129,5 @@
     dict->SetKey(serialized_cdm_origin, origin_data->ToDictValue());
   }
 
-  std::move(callback).Run(origin_data->origin_id());
+  return origin_data->origin_id();
 }
diff --git a/chrome/browser/media/cdm_pref_service_helper.h b/chrome/browser/media/cdm_pref_service_helper.h
new file mode 100644
index 0000000..3ff46c1
--- /dev/null
+++ b/chrome/browser/media/cdm_pref_service_helper.h
@@ -0,0 +1,31 @@
+// Copyright 2021 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_HELPER_H_
+#define CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_HELPER_H_
+
+#include "url/origin.h"
+
+class PrefService;
+class PrefRegistrySimple;
+
+// Manages reads and writes to the user prefs service related to CDM usage.
+// Updates to the CDM Origin ID dictionary will be infrequent (ie. every time
+// the Media Foundation CDM is used for a new origin). Origin ID are only stored
+// for origins serving hardware security protected contents and as such the size
+// of the CDM Origin ID dictionary should only contain a handful of items.
+class CdmPrefServiceHelper {
+ public:
+  CdmPrefServiceHelper();
+  CdmPrefServiceHelper(const CdmPrefServiceHelper&) = delete;
+  CdmPrefServiceHelper& operator=(const CdmPrefServiceHelper&) = delete;
+  ~CdmPrefServiceHelper();
+
+  static void RegisterProfilePrefs(PrefRegistrySimple* registry);
+
+  static base::UnguessableToken GetCdmOriginId(PrefService* user_prefs,
+                                               const url::Origin& origin);
+};
+
+#endif  // CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_HELPER_H_
diff --git a/chrome/browser/media/cdm_pref_service_impl.h b/chrome/browser/media/cdm_pref_service_impl.h
deleted file mode 100644
index 599cba1f..0000000
--- a/chrome/browser/media/cdm_pref_service_impl.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
-#define CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
-
-#include "content/public/browser/document_service_base.h"
-#include "media/mojo/mojom/cdm_pref_service.mojom.h"
-#include "url/origin.h"
-
-class PrefRegistrySimple;
-
-// Manages reads and writes to the user prefs service related to CDM usage.
-// Updates to the CDM Origin ID dictionary will be infrequent (ie. every time
-// the Media Foundation CDM is used for a new origin). Origin ID are only stored
-// for origins serving hardware security protected contents and as such the size
-// of the CDM Origin ID dictionary should only contain a handful of items.
-class CdmPrefServiceImpl final
-    : public content::DocumentServiceBase<media::mojom::CdmPrefService> {
- public:
-  static void Create(
-      content::RenderFrameHost* render_frame_host,
-      mojo::PendingReceiver<media::mojom::CdmPrefService> receiver);
-
-  CdmPrefServiceImpl(const CdmPrefServiceImpl&) = delete;
-  CdmPrefServiceImpl& operator=(const CdmPrefServiceImpl&) = delete;
-
-  static void RegisterProfilePrefs(PrefRegistrySimple* registry);
-
-  // media::mojom::CdmPrefService implementation
-  void GetCdmOriginId(GetCdmOriginIdCallback callback) override;
-
- private:
-  CdmPrefServiceImpl(
-      content::RenderFrameHost* render_frame_host,
-      mojo::PendingReceiver<media::mojom::CdmPrefService> receiver);
-  // `this` can only be destructed as a DocumentServiceBase
-  ~CdmPrefServiceImpl() final;
-};
-
-#endif  // CHROME_BROWSER_MEDIA_CDM_PREF_SERVICE_IMPL_H_
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 3f676a52..26723c3 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -379,7 +379,7 @@
 
 #if defined(OS_WIN)
 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
-#include "chrome/browser/media/cdm_pref_service_impl.h"
+#include "chrome/browser/media/cdm_pref_service_helper.h"
 #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
 #include "chrome/browser/win/conflicts/incompatible_applications_updater.h"
 #include "chrome/browser/win/conflicts/module_database.h"
@@ -1206,7 +1206,7 @@
 #endif
 
 #if defined(OS_WIN)
-  CdmPrefServiceImpl::RegisterProfilePrefs(registry);
+  CdmPrefServiceHelper::RegisterProfilePrefs(registry);
   component_updater::RegisterProfilePrefsForSwReporter(registry);
   NetworkProfileBubble::RegisterProfilePrefs(registry);
   safe_browsing::SettingsResetPromptPrefsManager::RegisterProfilePrefs(
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index b80c0cd3..24334438 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -4656,7 +4656,7 @@
       "../browser/install_verification/win/module_list_unittest.cc",
       "../browser/install_verification/win/module_verification_test.cc",
       "../browser/install_verification/win/module_verification_test.h",
-      "../browser/media/cdm_pref_service_impl_test.cc",
+      "../browser/media/cdm_document_service_impl_test.cc",
       "../browser/metrics/antivirus_metrics_provider_win_unittest.cc",
       "../browser/performance_manager/mechanisms/working_set_trimmer_win_unittest.cc",
       "../browser/performance_monitor/metric_evaluator_helper_win_unittest.cc",
diff --git a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc
index 82b58ae3..780dc4a 100644
--- a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc
+++ b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.cc
@@ -89,14 +89,14 @@
   // Check that the user has Verified Access enabled in their Chrome settings
   // and if they do not then block this connection since OEMCrypto utilizes
   // remote attestation as part of verification.
-  if (!platform_verification_) {
+  if (!cdm_document_service_) {
     frame_interfaces_->BindEmbedderReceiver(mojo::GenericPendingReceiver(
-        platform_verification_.BindNewPipeAndPassReceiver()));
-    platform_verification_.set_disconnect_handler(
+        cdm_document_service_.BindNewPipeAndPassReceiver()));
+    cdm_document_service_.set_disconnect_handler(
         base::BindOnce(&ChromeOsCdmFactory::OnVerificationMojoConnectionError,
                        weak_factory_.GetWeakPtr()));
   }
-  platform_verification_->IsVerifiedAccessEnabled(base::BindOnce(
+  cdm_document_service_->IsVerifiedAccessEnabled(base::BindOnce(
       &ChromeOsCdmFactory::OnVerifiedAccessEnabled, weak_factory_.GetWeakPtr(),
       key_system, cdm_config, session_message_cb, session_closed_cb,
       session_keys_change_cb, session_expiration_update_cb,
@@ -257,7 +257,7 @@
 
 void ChromeOsCdmFactory::OnVerificationMojoConnectionError() {
   DVLOG(1) << __func__;
-  platform_verification_.reset();
+  cdm_document_service_.reset();
 }
 
 }  // namespace chromeos
diff --git a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h
index 18f023d..4d080d7 100644
--- a/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h
+++ b/chromeos/components/cdm_factory_daemon/chromeos_cdm_factory.h
@@ -14,8 +14,8 @@
 #include "chromeos/components/cdm_factory_daemon/mojom/cdm_factory_daemon.mojom.h"
 #include "media/base/cdm_config.h"
 #include "media/base/cdm_factory.h"
+#include "media/mojo/mojom/cdm_document_service.mojom.h"
 #include "media/mojo/mojom/frame_interface_factory.mojom.h"
-#include "media/mojo/mojom/platform_verification.mojom.h"
 #include "mojo/public/cpp/bindings/pending_receiver.h"
 #include "mojo/public/cpp/bindings/pending_remote.h"
 #include "mojo/public/cpp/bindings/remote.h"
@@ -95,7 +95,7 @@
 
   media::mojom::FrameInterfaceFactory* frame_interfaces_;
   mojo::Remote<cdm::mojom::CdmFactory> remote_factory_;
-  mojo::Remote<media::mojom::PlatformVerification> platform_verification_;
+  mojo::Remote<media::mojom::CdmDocumentService> cdm_document_service_;
 
   // WeakPtrFactory to use for callbacks.
   base::WeakPtrFactory<ChromeOsCdmFactory> weak_factory_{this};
diff --git a/media/cdm/BUILD.gn b/media/cdm/BUILD.gn
index d35c07c..41b75f0 100644
--- a/media/cdm/BUILD.gn
+++ b/media/cdm/BUILD.gn
@@ -94,10 +94,8 @@
       "cdm_adapter_factory.h",
       "cdm_module.cc",
       "cdm_module.h",
-      "cdm_pref_service.h",
       "cdm_wrapper.h",
       "output_protection.h",
-      "platform_verification.h",
       "supported_cdm_versions.cc",
       "supported_cdm_versions.h",
     ]
@@ -118,6 +116,7 @@
       "cdm_allocator.h",
       "cdm_auxiliary_helper.cc",
       "cdm_auxiliary_helper.h",
+      "cdm_document_service.h",
       "cdm_helpers.cc",
       "cdm_helpers.h",
     ]
diff --git a/media/cdm/cdm_auxiliary_helper.cc b/media/cdm/cdm_auxiliary_helper.cc
index ae5b9b37..f9db2d8 100644
--- a/media/cdm/cdm_auxiliary_helper.cc
+++ b/media/cdm/cdm_auxiliary_helper.cc
@@ -49,8 +49,10 @@
   std::move(callback).Run(version, std::vector<uint8_t>());
 }
 
+#if defined(OS_WIN)
 void CdmAuxiliaryHelper::GetCdmOriginId(GetCdmOriginIdCB callback) {
   std::move(callback).Run(base::UnguessableToken::Null());
 }
+#endif  // defined(OS_WIN)
 
 }  // namespace media
diff --git a/media/cdm/cdm_auxiliary_helper.h b/media/cdm/cdm_auxiliary_helper.h
index efeb346..e580a70 100644
--- a/media/cdm/cdm_auxiliary_helper.h
+++ b/media/cdm/cdm_auxiliary_helper.h
@@ -13,11 +13,11 @@
 #include "base/callback.h"
 #include "base/macros.h"
 #include "base/unguessable_token.h"
+#include "build/build_config.h"
 #include "media/base/media_export.h"
 #include "media/cdm/cdm_allocator.h"
-#include "media/cdm/cdm_pref_service.h"
+#include "media/cdm/cdm_document_service.h"
 #include "media/cdm/output_protection.h"
-#include "media/cdm/platform_verification.h"
 #include "media/media_buildflags.h"
 #include "url/origin.h"
 
@@ -29,13 +29,12 @@
 namespace media {
 
 // Provides a wrapper on the auxiliary functions (CdmAllocator, CdmFileIO,
-// OutputProtection, PlatformVerification) needed by the library CDM. The
+// OutputProtection, CdmDocumentService) needed by the library CDM. The
 // default implementation does nothing -- it simply returns nullptr, false, 0,
 // etc. as required to meet the interface.
 class MEDIA_EXPORT CdmAuxiliaryHelper : public CdmAllocator,
                                         public OutputProtection,
-                                        public PlatformVerification,
-                                        public CdmPrefService {
+                                        public CdmDocumentService {
  public:
   CdmAuxiliaryHelper();
   ~CdmAuxiliaryHelper() override;
@@ -63,14 +62,15 @@
   void EnableProtection(uint32_t desired_protection_mask,
                         EnableProtectionCB callback) override;
 
-  // PlatformVerification implementation.
+  // CdmDocumentService implementation.
   void ChallengePlatform(const std::string& service_id,
                          const std::string& challenge,
                          ChallengePlatformCB callback) override;
   void GetStorageId(uint32_t version, StorageIdCB callback) override;
 
-  // CdmPrefService implementation.
+#if defined(OS_WIN)
   void GetCdmOriginId(GetCdmOriginIdCB callback) override;
+#endif  // defined(OS_WIN)
 
  private:
   DISALLOW_COPY_AND_ASSIGN(CdmAuxiliaryHelper);
diff --git a/media/cdm/platform_verification.h b/media/cdm/cdm_document_service.h
similarity index 72%
rename from media/cdm/platform_verification.h
rename to media/cdm/cdm_document_service.h
index 83b039d..180776b 100644
--- a/media/cdm/platform_verification.h
+++ b/media/cdm/cdm_document_service.h
@@ -2,22 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MEDIA_CDM_PLATFORM_VERIFICATION_H_
-#define MEDIA_CDM_PLATFORM_VERIFICATION_H_
+#ifndef MEDIA_CDM_CDM_DOCUMENT_SERVICE_H_
+#define MEDIA_CDM_CDM_DOCUMENT_SERVICE_H_
 
 #include <string>
 #include <vector>
 
 #include "base/callback.h"
 #include "base/macros.h"
+#include "build/build_config.h"
 #include "media/base/media_export.h"
 
 namespace media {
 
-class MEDIA_EXPORT PlatformVerification {
+class MEDIA_EXPORT CdmDocumentService {
  public:
-  PlatformVerification() = default;
-  virtual ~PlatformVerification() = default;
+  CdmDocumentService() = default;
+  CdmDocumentService(const CdmDocumentService& other) = delete;
+  CdmDocumentService& operator=(const CdmDocumentService& other) = delete;
+  virtual ~CdmDocumentService() = default;
 
   using ChallengePlatformCB =
       base::OnceCallback<void(bool success,
@@ -28,6 +31,9 @@
       base::OnceCallback<void(uint32_t version,
                               const std::vector<uint8_t>& storage_id)>;
 
+  using GetCdmOriginIdCB =
+      base::OnceCallback<void(const base::UnguessableToken&)>;
+
   // Allows authorized services to verify that the underlying platform is
   // trusted. An example of a trusted platform is a Chrome OS device in
   // verified boot mode. This can be used for protected content playback.
@@ -53,10 +59,14 @@
   //                 version does not exist.
   virtual void GetStorageId(uint32_t version, StorageIdCB callback) = 0;
 
- private:
-  DISALLOW_COPY_AND_ASSIGN(PlatformVerification);
+#if defined(OS_WIN)
+  // Gets the origin ID associated with the origin of the CDM. The origin ID is
+  // used in place of the origin when hiding the concrete origin is needed. The
+  // origin ID is also user resettable by clearing the browsing data.
+  virtual void GetCdmOriginId(GetCdmOriginIdCB callback) = 0;
+#endif  // defined(OS_WIN)
 };
 
 }  // namespace media
 
-#endif  // MEDIA_CDM_PLATFORM_VERIFICATION_H_
+#endif  // MEDIA_CDM_CDM_DOCUMENT_SERVICE_H_
diff --git a/media/cdm/mock_helpers.h b/media/cdm/mock_helpers.h
index 08b3620..8c3c878a 100644
--- a/media/cdm/mock_helpers.h
+++ b/media/cdm/mock_helpers.h
@@ -12,6 +12,7 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
+#include "build/build_config.h"
 #include "media/cdm/cdm_allocator.h"
 #include "media/cdm/cdm_auxiliary_helper.h"
 #include "media/cdm/cdm_helpers.h"
@@ -51,7 +52,9 @@
   MOCK_METHOD1(GetStorageIdCalled, std::vector<uint8_t>(uint32_t version));
   void GetStorageId(uint32_t version, StorageIdCB callback) override;
 
+#if defined(OS_WIN)
   MOCK_METHOD(void, GetCdmOriginId, (GetCdmOriginIdCB callback), (override));
+#endif  // defined(OS_WIN)
 
  private:
   std::unique_ptr<CdmAllocator> allocator_;
diff --git a/media/mojo/mojom/BUILD.gn b/media/mojo/mojom/BUILD.gn
index 6bf108b..f79b730 100644
--- a/media/mojo/mojom/BUILD.gn
+++ b/media/mojo/mojom/BUILD.gn
@@ -19,7 +19,7 @@
     "audio_parameters.mojom",
     "audio_stream_factory.mojom",
     "capture_handle.mojom",
-    "cdm_pref_service.mojom",
+    "cdm_document_service.mojom",
     "cdm_service.mojom",
     "cdm_storage.mojom",
     "content_decryption_module.mojom",
@@ -35,7 +35,6 @@
     "media_service.mojom",
     "media_types.mojom",
     "output_protection.mojom",
-    "platform_verification.mojom",
     "playback_events_recorder.mojom",
     "provision_fetcher.mojom",
     "renderer.mojom",
diff --git a/media/mojo/mojom/platform_verification.mojom b/media/mojo/mojom/cdm_document_service.mojom
similarity index 71%
rename from media/mojo/mojom/platform_verification.mojom
rename to media/mojo/mojom/cdm_document_service.mojom
index c3cf5b7..e395693 100644
--- a/media/mojo/mojom/platform_verification.mojom
+++ b/media/mojo/mojom/cdm_document_service.mojom
@@ -5,7 +5,12 @@
 // TODO(xhwang): Move this out of media if it is needed anywhere else.
 module media.mojom;
 
-interface PlatformVerification {
+import "mojo/public/mojom/base/unguessable_token.mojom";
+
+// The service itself is associated with a RenderFrameHost in the browser
+// process and will be called by a client living in the utility process hosting
+// the CDM.
+interface CdmDocumentService {
   // Allows authorized services to verify that the underlying platform is
   // trusted. An example of a trusted platform is a Chrome OS device in
   // verified boot mode. This can be used for protected content playback.
@@ -35,4 +40,11 @@
   // Returns true if Verified Access is enabled in settings, false otherwise.
   [EnableIf=is_chromeos_ash]
   IsVerifiedAccessEnabled() => (bool enabled);
+
+  // Gets the origin ID of the frame associated with the CDM. The origin ID is
+  // used in place of the origin when hiding the concrete origin is needed. The
+  // origin ID is also user resettable by clearing the browsing data.
+  // - `cdm_origin_id`: The origin id of the frame associated with the CDM.
+  [EnableIf=is_win]
+  GetCdmOriginId() => (mojo_base.mojom.UnguessableToken cdm_origin_id);
 };
diff --git a/media/mojo/mojom/cdm_pref_service.mojom b/media/mojo/mojom/cdm_pref_service.mojom
deleted file mode 100644
index 1649a04..0000000
--- a/media/mojo/mojom/cdm_pref_service.mojom
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-module media.mojom;
-
-import "mojo/public/mojom/base/unguessable_token.mojom";
-import "url/mojom/origin.mojom";
-
-// An interface to query the PrefService for information needed by the CDM.
-// The service itself is associated with a RenderFrameHost in the browser
-// process and will be called by a client living in the utility process hosting
-// the CDM.
-interface CdmPrefService {
-
-  // Gets the origin ID of the frame associated with the CDM. The origin ID is
-  // used in place of the origin when hiding the concrete origin is needed. The
-  // origin ID is also user resettable by clearing the browsing data.
-  // - `cdm_origin_id`: The origin id of the frame associated with the CDM.
-  GetCdmOriginId() => (mojo_base.mojom.UnguessableToken cdm_origin_id);
-};
diff --git a/media/mojo/services/mojo_cdm_helper.cc b/media/mojo/services/mojo_cdm_helper.cc
index a1a7066..8e4643ec 100644
--- a/media/mojo/services/mojo_cdm_helper.cc
+++ b/media/mojo/services/mojo_cdm_helper.cc
@@ -47,10 +47,12 @@
   return cdm_origin;
 }
 
+#if defined(OS_WIN)
 void MojoCdmHelper::GetCdmOriginId(GetCdmOriginIdCB callback) {
-  ConnectToCdmPrefService();
-  cdm_pref_service_->GetCdmOriginId(std::move(callback));
+  ConnectToCdmDocumentService();
+  cdm_document_service_->GetCdmOriginId(std::move(callback));
 }
+#endif  // defined(OS_WIN)
 
 cdm::Buffer* MojoCdmHelper::CreateCdmBuffer(size_t capacity) {
   return GetAllocator()->CreateCdmBuffer(capacity);
@@ -82,16 +84,16 @@
   ChallengePlatformCB scoped_callback =
       mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback), false,
                                                   "", "", "");
-  ConnectToPlatformVerification();
-  platform_verification_->ChallengePlatform(service_id, challenge,
-                                            std::move(scoped_callback));
+  ConnectToCdmDocumentService();
+  cdm_document_service_->ChallengePlatform(service_id, challenge,
+                                           std::move(scoped_callback));
 }
 
 void MojoCdmHelper::GetStorageId(uint32_t version, StorageIdCB callback) {
   StorageIdCB scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
       std::move(callback), version, std::vector<uint8_t>());
-  ConnectToPlatformVerification();
-  platform_verification_->GetStorageId(version, std::move(scoped_callback));
+  ConnectToCdmDocumentService();
+  cdm_document_service_->GetStorageId(version, std::move(scoped_callback));
 }
 
 void MojoCdmHelper::CloseCdmFileIO(MojoCdmFileIO* cdm_file_io) {
@@ -128,17 +130,10 @@
   }
 }
 
-void MojoCdmHelper::ConnectToPlatformVerification() {
-  if (!platform_verification_) {
+void MojoCdmHelper::ConnectToCdmDocumentService() {
+  if (!cdm_document_service_) {
     frame_interfaces_->BindEmbedderReceiver(mojo::GenericPendingReceiver(
-        platform_verification_.BindNewPipeAndPassReceiver()));
-  }
-}
-
-void MojoCdmHelper::ConnectToCdmPrefService() {
-  if (!cdm_pref_service_) {
-    frame_interfaces_->BindEmbedderReceiver(mojo::GenericPendingReceiver(
-        cdm_pref_service_.BindNewPipeAndPassReceiver()));
+        cdm_document_service_.BindNewPipeAndPassReceiver()));
   }
 }
 
diff --git a/media/mojo/services/mojo_cdm_helper.h b/media/mojo/services/mojo_cdm_helper.h
index f1b6f14..63b1b538 100644
--- a/media/mojo/services/mojo_cdm_helper.h
+++ b/media/mojo/services/mojo_cdm_helper.h
@@ -11,13 +11,13 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
+#include "build/build_config.h"
 #include "media/cdm/cdm_auxiliary_helper.h"
 #include "media/media_buildflags.h"
-#include "media/mojo/mojom/cdm_pref_service.mojom.h"
+#include "media/mojo/mojom/cdm_document_service.mojom.h"
 #include "media/mojo/mojom/cdm_storage.mojom.h"
 #include "media/mojo/mojom/frame_interface_factory.mojom.h"
 #include "media/mojo/mojom/output_protection.mojom.h"
-#include "media/mojo/mojom/platform_verification.mojom.h"
 #include "media/mojo/services/media_mojo_export.h"
 #include "media/mojo/services/mojo_cdm_file_io.h"
 #include "mojo/public/cpp/bindings/remote.h"
@@ -37,7 +37,6 @@
   void SetFileReadCB(FileReadCB file_read_cb) final;
   cdm::FileIO* CreateCdmFileIO(cdm::FileIOClient* client) final;
   url::Origin GetCdmOrigin() final;
-  void GetCdmOriginId(GetCdmOriginIdCB callback) final;
   cdm::Buffer* CreateCdmBuffer(size_t capacity) final;
   std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() final;
   void QueryStatus(QueryStatusCB callback) final;
@@ -47,6 +46,9 @@
                          const std::string& challenge,
                          ChallengePlatformCB callback) final;
   void GetStorageId(uint32_t version, StorageIdCB callback) final;
+#if defined(OS_WIN)
+  void GetCdmOriginId(GetCdmOriginIdCB callback) final;
+#endif  // defined(OS_WIN)
 
   // MojoCdmFileIO::Delegate implementation.
   void CloseCdmFileIO(MojoCdmFileIO* cdm_file_io) final;
@@ -57,8 +59,7 @@
   void ConnectToCdmStorage();
   CdmAllocator* GetAllocator();
   void ConnectToOutputProtection();
-  void ConnectToPlatformVerification();
-  void ConnectToCdmPrefService();
+  void ConnectToCdmDocumentService();
 
   // Provides interfaces when needed.
   mojom::FrameInterfaceFactory* frame_interfaces_;
@@ -70,8 +71,7 @@
   mojo::Remote<mojom::CdmStorage> cdm_storage_remote_;
   std::unique_ptr<CdmAllocator> allocator_;
   mojo::Remote<mojom::OutputProtection> output_protection_;
-  mojo::Remote<mojom::PlatformVerification> platform_verification_;
-  mojo::Remote<mojom::CdmPrefService> cdm_pref_service_;
+  mojo::Remote<mojom::CdmDocumentService> cdm_document_service_;
 
   FileReadCB file_read_cb_;