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

Unified Diff: android_webview/browser/aw_media_client_android.cc

Issue 962793005: Adds MediaClientAndroid to support embedder/MediaDrmBridge interaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added components/cdm OWNERS to components/cdm.gypi (per-file) Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/aw_media_client_android.cc
diff --git a/android_webview/browser/aw_media_client_android.cc b/android_webview/browser/aw_media_client_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..38a0cd8872a72137d780baf9018a94896110a60b
--- /dev/null
+++ b/android_webview/browser/aw_media_client_android.cc
@@ -0,0 +1,62 @@
+// 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 "android_webview/browser/aw_media_client_android.h"
+
+#include <utility>
+
+#include "base/stl_util.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
+
+namespace android_webview {
+
+namespace {
+
+const size_t kGUIDLength = 36U;
+
+std::pair<std::string, media::UUID> CreateMappingFromString(
+ const std::string& key_system_uuid_mapping) {
+ std::vector<std::string> tokens;
+ Tokenize(key_system_uuid_mapping, ",", &tokens);
+
+ std::string key_system;
+ base::TrimWhitespaceASCII(tokens[0], base::TRIM_ALL, &key_system);
+
+ std::vector<uint8_t> uuid;
+ std::string guid(tokens[1]);
boliu 2015/04/29 19:24:25 Is it safe to assume key_system_uuid_mapping can a
gunsch 2015/04/29 20:29:43 I was hoping you could answer that: I don't really
boliu 2015/04/29 23:15:44 It comes from a resource that individual devices c
+ DCHECK(guid.length() == kGUIDLength);
+ base::RemoveChars(guid, "-", &guid);
+ base::HexStringToBytes(guid, &uuid);
+
+ return std::make_pair(key_system, uuid);
+}
+
+} // namespace
+
+AwMediaClientAndroid::AwMediaClientAndroid(
+ const std::vector<std::string>& key_system_uuid_mappings)
+ : key_system_uuid_mappings_(key_system_uuid_mappings) {
+}
+
+AwMediaClientAndroid::~AwMediaClientAndroid() {
+}
+
+void AwMediaClientAndroid::AddKeySystemUUIDMappings(KeySystemUuidMap* map) {
+ for (const std::string& key_system_uuid_mapping : key_system_uuid_mappings_) {
+ std::pair<std::string, media::UUID> mapping =
+ CreateMappingFromString(key_system_uuid_mapping);
+ (*map)[mapping.first] = mapping.second;
boliu 2015/04/29 19:24:25 map->insert?
gunsch 2015/04/29 20:29:44 Done.
+ }
+}
+
+media::MediaDrmBridgeDelegate*
+AwMediaClientAndroid::GetMediaDrmBridgeDelegate(
+ const media::UUID& scheme_uuid) {
+ if (scheme_uuid == widevine_delegate_.GetUUID())
+ return &widevine_delegate_;
+ return nullptr;
boliu 2015/04/29 19:24:25 Pure question on my part since I don't actually kn
gunsch 2015/04/29 20:29:43 This patch shouldn't change any user-facing behavi
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698