| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "android_webview/renderer/aw_key_systems.h" | 5 #include "android_webview/renderer/aw_key_systems.h" |
| 6 | 6 #include "components/encrypted_media/renderer/widevine_key_systems.h" |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/command_line.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "content/public/common/eme_codec.h" | |
| 12 #include "third_party/widevine/cdm/widevine_cdm_common.h" | |
| 13 | |
| 14 using content::KeySystemInfo; | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 // Return |name|'s parent key system. | |
| 19 std::string GetDirectParentName(const std::string& name) { | |
| 20 int last_period = name.find_last_of('.'); | |
| 21 DCHECK_GT(last_period, 0); | |
| 22 return name.substr(0, last_period); | |
| 23 } | |
| 24 | |
| 25 void AddWidevineWithCodecs(const std::string& key_system_name, | |
| 26 bool add_parent_name, | |
| 27 std::vector<KeySystemInfo>* concrete_key_systems) { | |
| 28 KeySystemInfo info(key_system_name); | |
| 29 | |
| 30 if (add_parent_name) | |
| 31 info.parent_key_system = GetDirectParentName(key_system_name); | |
| 32 | |
| 33 info.supported_codecs = content::EME_CODEC_MP4_ALL; | |
| 34 | |
| 35 concrete_key_systems->push_back(info); | |
| 36 } | |
| 37 | |
| 38 } // namespace | |
| 39 | 7 |
| 40 namespace android_webview { | 8 namespace android_webview { |
| 41 | 9 |
| 42 void AwAddKeySystems( | 10 void AwAddKeySystems( |
| 43 std::vector<KeySystemInfo>* key_systems_info) { | 11 std::vector<content::KeySystemInfo>* key_systems_info) { |
| 44 AddWidevineWithCodecs(kWidevineKeySystem, true, key_systems_info); | 12 encrypted_media::AddAndroidWidevine(key_systems_info); |
| 45 } | 13 } |
| 46 | 14 |
| 47 } // namespace android_webview | 15 } // namespace android_webview |
| OLD | NEW |