OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "android_webview/browser/aw_media_client_android.h" | |
6 | |
7 #include <utility> | |
8 | |
9 #include "base/stl_util.h" | |
10 #include "base/strings/string_number_conversions.h" | |
11 #include "base/strings/string_util.h" | |
12 | |
13 namespace android_webview { | |
14 | |
15 namespace { | |
16 | |
17 const size_t kGUIDLength = 36U; | |
18 | |
19 std::pair<std::string, media::UUID> CreateMappingFromString( | |
20 const std::string& key_system_uuid_mapping) { | |
21 std::vector<std::string> tokens; | |
22 Tokenize(key_system_uuid_mapping, ",", &tokens); | |
23 | |
24 std::string key_system; | |
25 base::TrimWhitespaceASCII(tokens[0], base::TRIM_ALL, &key_system); | |
26 | |
27 std::vector<uint8_t> uuid; | |
28 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
| |
29 DCHECK(guid.length() == kGUIDLength); | |
30 base::RemoveChars(guid, "-", &guid); | |
31 base::HexStringToBytes(guid, &uuid); | |
32 | |
33 return std::make_pair(key_system, uuid); | |
34 } | |
35 | |
36 } // namespace | |
37 | |
38 AwMediaClientAndroid::AwMediaClientAndroid( | |
39 const std::vector<std::string>& key_system_uuid_mappings) | |
40 : key_system_uuid_mappings_(key_system_uuid_mappings) { | |
41 } | |
42 | |
43 AwMediaClientAndroid::~AwMediaClientAndroid() { | |
44 } | |
45 | |
46 void AwMediaClientAndroid::AddKeySystemUUIDMappings(KeySystemUuidMap* map) { | |
47 for (const std::string& key_system_uuid_mapping : key_system_uuid_mappings_) { | |
48 std::pair<std::string, media::UUID> mapping = | |
49 CreateMappingFromString(key_system_uuid_mapping); | |
50 (*map)[mapping.first] = mapping.second; | |
boliu
2015/04/29 19:24:25
map->insert?
gunsch
2015/04/29 20:29:44
Done.
| |
51 } | |
52 } | |
53 | |
54 media::MediaDrmBridgeDelegate* | |
55 AwMediaClientAndroid::GetMediaDrmBridgeDelegate( | |
56 const media::UUID& scheme_uuid) { | |
57 if (scheme_uuid == widevine_delegate_.GetUUID()) | |
58 return &widevine_delegate_; | |
59 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
| |
60 } | |
61 | |
62 } // namespace android_webview | |
OLD | NEW |