Index: chromecast/browser/media/cast_media_client_android.cc |
diff --git a/chromecast/browser/media/cast_media_client_android.cc b/chromecast/browser/media/cast_media_client_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9db291dabafe9dec1a24f401a98ef643136dd64 |
--- /dev/null |
+++ b/chromecast/browser/media/cast_media_client_android.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2015 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. |
+ |
+#include "chromecast/browser/media/cast_media_client_android.h" |
+ |
+#include <utility> |
+ |
+#include "base/stl_util.h" |
+#include "chromecast/media/base/key_systems_common.h" |
+#include "chromecast/media/cdm/playready_drm_delegate_android.h" |
+#include "components/cdm/browser/widevine_drm_delegate_android.h" |
+ |
+namespace chromecast { |
+namespace media { |
+ |
+CastMediaClientAndroid::CastMediaClientAndroid() { |
+#if defined(PLAYREADY_CDM_AVAILABLE) |
+ ::media::MediaDrmBridgeDelegate* playready_delegate = |
+ new PlayreadyDrmDelegateAndroid(); |
+ AddKeySystemUUIDMapping(kChromecastPlayreadyKeySystem, |
+ playready_delegate->GetUUID()); |
+ delegates_[playready_delegate->GetUUID()] = playready_delegate; |
+#endif |
+ |
+#if defined(WIDEVINE_CDM_AVAILABLE) |
+ // Note: MediaDrmBridge adds the Widevine UUID mapping automatically. |
+ delegates_[widevine_delegate->GetUUID()] = |
+ new cdm::WidevineDrmDelegateAndroid(); |
+#endif |
+ |
+ auto platform_mappings = GetPlatformKeySystemUUIDMappings(); |
+ for (const auto& mapping : platform_mappings) { |
+ AddKeySystemUUIDMapping(mapping.first, mapping.second); |
+ } |
+} |
+ |
+CastMediaClientAndroid::~CastMediaClientAndroid() { |
+ STLDeleteContainerPairSecondPointers(delegates_.begin(), delegates_.end()); |
+} |
+ |
+::media::MediaDrmBridgeDelegate* |
+CastMediaClientAndroid::GetMediaDrmBridgeDelegate( |
+ const ::media::UUID& scheme_uuid) const { |
+ DelegateMap::const_iterator it = delegates_.find(scheme_uuid); |
+ if (it == delegates_.end()) |
+ return nullptr; |
+ return it->second; |
+} |
+ |
+} // namespace media |
+} // namespace chromecast |