OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "media/base/android/android_cdm_factory.h" | 5 #include "media/base/android/android_cdm_factory.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "media/base/android/media_drm_bridge.h" | 9 #include "media/base/android/media_drm_bridge.h" |
10 #include "media/base/bind_to_current_loop.h" | 10 #include "media/base/bind_to_current_loop.h" |
11 #include "media/base/cdm_config.h" | 11 #include "media/base/cdm_config.h" |
| 12 #include "media/base/content_decryption_module.h" |
12 #include "media/base/key_system_names.h" | 13 #include "media/base/key_system_names.h" |
13 #include "media/base/key_systems.h" | 14 #include "media/base/key_systems.h" |
14 #include "media/base/media_switches.h" | 15 #include "media/base/media_switches.h" |
15 #include "media/cdm/aes_decryptor.h" | 16 #include "media/cdm/aes_decryptor.h" |
16 #include "third_party/widevine/cdm/widevine_cdm_common.h" | 17 #include "third_party/widevine/cdm/widevine_cdm_common.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
21 AndroidCdmFactory::AndroidCdmFactory(const CreateFetcherCB& create_fetcher_cb) | 22 AndroidCdmFactory::AndroidCdmFactory(const CreateFetcherCB& create_fetcher_cb) |
(...skipping 15 matching lines...) Expand all Loading... |
37 | 38 |
38 if (!security_origin.is_valid()) { | 39 if (!security_origin.is_valid()) { |
39 bound_cdm_created_cb.Run(nullptr, "Invalid origin."); | 40 bound_cdm_created_cb.Run(nullptr, "Invalid origin."); |
40 return; | 41 return; |
41 } | 42 } |
42 | 43 |
43 // Create AesDecryptor here to support External Clear Key key system. | 44 // Create AesDecryptor here to support External Clear Key key system. |
44 // This is used for testing. | 45 // This is used for testing. |
45 if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting) && | 46 if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting) && |
46 IsExternalClearKey(key_system)) { | 47 IsExternalClearKey(key_system)) { |
47 scoped_refptr<MediaKeys> cdm( | 48 scoped_refptr<ContentDecryptionModule> cdm( |
48 new AesDecryptor(security_origin, session_message_cb, session_closed_cb, | 49 new AesDecryptor(security_origin, session_message_cb, session_closed_cb, |
49 session_keys_change_cb)); | 50 session_keys_change_cb)); |
50 bound_cdm_created_cb.Run(cdm, ""); | 51 bound_cdm_created_cb.Run(cdm, ""); |
51 return; | 52 return; |
52 } | 53 } |
53 | 54 |
54 std::string error_message; | 55 std::string error_message; |
55 | 56 |
56 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { | 57 if (!MediaDrmBridge::IsKeySystemSupported(key_system)) { |
57 error_message = "Key system not supported unexpectedly: " + key_system; | 58 error_message = "Key system not supported unexpectedly: " + key_system; |
(...skipping 28 matching lines...) Expand all Loading... |
86 LOG(ERROR) << error_message; | 87 LOG(ERROR) << error_message; |
87 bound_cdm_created_cb.Run(nullptr, error_message); | 88 bound_cdm_created_cb.Run(nullptr, error_message); |
88 return; | 89 return; |
89 } | 90 } |
90 | 91 |
91 // Success! | 92 // Success! |
92 bound_cdm_created_cb.Run(cdm, ""); | 93 bound_cdm_created_cb.Run(cdm, ""); |
93 } | 94 } |
94 | 95 |
95 } // namespace media | 96 } // namespace media |
OLD | NEW |