| 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 "content/renderer/media/crypto/content_decryption_module_factory.h" | 5 #include "content/renderer/media/crypto/content_decryption_module_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/media/crypto/key_systems.h" | 8 #include "content/renderer/media/crypto/key_systems.h" |
| 9 #include "media/crypto/aes_decryptor.h" | 9 #include "media/crypto/aes_decryptor.h" |
| 10 | 10 |
| 11 #if defined(ENABLE_PEPPER_CDMS) | 11 #if defined(ENABLE_PEPPER_CDMS) |
| 12 #include "content/renderer/media/crypto/ppapi_decryptor.h" | 12 #include "content/renderer/media/crypto/ppapi_decryptor.h" |
| 13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
| 14 #include "third_party/WebKit/public/web/WebFrame.h" | 14 #include "third_party/WebKit/public/web/WebFrame.h" |
| 15 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" | 15 #include "third_party/WebKit/public/web/WebMediaPlayerClient.h" |
| 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 16 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h" |
| 17 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" | 17 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" |
| 18 #elif defined(OS_ANDROID) | 18 #elif defined(OS_ANDROID) |
| 19 #include "content/renderer/media/android/proxy_media_keys.h" | 19 #include "content/renderer/media/android/proxy_media_keys.h" |
| 20 #include "content/renderer/media/android/webmediaplayer_proxy_android.h" | 20 #include "content/renderer/media/android/webmediaplayer_proxy_android.h" |
| 21 #endif // defined(ENABLE_PEPPER_CDMS) | 21 #endif // defined(ENABLE_PEPPER_CDMS) |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 | 24 |
| 25 #if defined(ENABLE_PEPPER_CDMS) | 25 #if defined(ENABLE_PEPPER_CDMS) |
| 26 // Returns the PluginInstance associated with the Helper Plugin. | 26 // Returns the PluginInstanceImpl associated with the Helper Plugin. |
| 27 // If a non-NULL pointer is returned, the caller must call closeHelperPlugin() | 27 // If a non-NULL pointer is returned, the caller must call closeHelperPlugin() |
| 28 // when the Helper Plugin is no longer needed. | 28 // when the Helper Plugin is no longer needed. |
| 29 static scoped_refptr<webkit::ppapi::PluginInstance> CreateHelperPlugin( | 29 static scoped_refptr<webkit::ppapi::PluginInstanceImpl> CreateHelperPlugin( |
| 30 const std::string& plugin_type, | 30 const std::string& plugin_type, |
| 31 WebKit::WebMediaPlayerClient* web_media_player_client, | 31 WebKit::WebMediaPlayerClient* web_media_player_client, |
| 32 WebKit::WebFrame* web_frame) { | 32 WebKit::WebFrame* web_frame) { |
| 33 DCHECK(web_media_player_client); | 33 DCHECK(web_media_player_client); |
| 34 DCHECK(web_frame); | 34 DCHECK(web_frame); |
| 35 | 35 |
| 36 WebKit::WebPlugin* web_plugin = web_media_player_client->createHelperPlugin( | 36 WebKit::WebPlugin* web_plugin = web_media_player_client->createHelperPlugin( |
| 37 WebKit::WebString::fromUTF8(plugin_type), web_frame); | 37 WebKit::WebString::fromUTF8(plugin_type), web_frame); |
| 38 if (!web_plugin) | 38 if (!web_plugin) |
| 39 return NULL; | 39 return NULL; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 const media::KeyErrorCB& key_error_cb, | 51 const media::KeyErrorCB& key_error_cb, |
| 52 const media::KeyMessageCB& key_message_cb, | 52 const media::KeyMessageCB& key_message_cb, |
| 53 const base::Closure& destroy_plugin_cb, | 53 const base::Closure& destroy_plugin_cb, |
| 54 WebKit::WebMediaPlayerClient* web_media_player_client, | 54 WebKit::WebMediaPlayerClient* web_media_player_client, |
| 55 WebKit::WebFrame* web_frame) { | 55 WebKit::WebFrame* web_frame) { |
| 56 DCHECK(web_media_player_client); | 56 DCHECK(web_media_player_client); |
| 57 DCHECK(web_frame); | 57 DCHECK(web_frame); |
| 58 | 58 |
| 59 std::string plugin_type = GetPepperType(key_system); | 59 std::string plugin_type = GetPepperType(key_system); |
| 60 DCHECK(!plugin_type.empty()); | 60 DCHECK(!plugin_type.empty()); |
| 61 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance = | 61 const scoped_refptr<webkit::ppapi::PluginInstanceImpl>& plugin_instance = |
| 62 CreateHelperPlugin(plugin_type, web_media_player_client, web_frame); | 62 CreateHelperPlugin(plugin_type, web_media_player_client, web_frame); |
| 63 if (!plugin_instance.get()) { | 63 if (!plugin_instance.get()) { |
| 64 DLOG(ERROR) << "ProxyDecryptor: plugin instance creation failed."; | 64 DLOG(ERROR) << "ProxyDecryptor: plugin instance creation failed."; |
| 65 return scoped_ptr<media::MediaKeys>(); | 65 return scoped_ptr<media::MediaKeys>(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 scoped_ptr<PpapiDecryptor> decryptor = | 68 scoped_ptr<PpapiDecryptor> decryptor = |
| 69 PpapiDecryptor::Create(key_system, | 69 PpapiDecryptor::Create(key_system, |
| 70 plugin_instance, | 70 plugin_instance, |
| 71 key_added_cb, | 71 key_added_cb, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 scoped_ptr<ProxyMediaKeys> proxy_media_keys( | 119 scoped_ptr<ProxyMediaKeys> proxy_media_keys( |
| 120 new ProxyMediaKeys(proxy, media_keys_id)); | 120 new ProxyMediaKeys(proxy, media_keys_id)); |
| 121 proxy_media_keys->InitializeCDM(key_system); | 121 proxy_media_keys->InitializeCDM(key_system); |
| 122 return proxy_media_keys.PassAs<media::MediaKeys>(); | 122 return proxy_media_keys.PassAs<media::MediaKeys>(); |
| 123 #else | 123 #else |
| 124 return scoped_ptr<media::MediaKeys>(); | 124 return scoped_ptr<media::MediaKeys>(); |
| 125 #endif // defined(ENABLE_PEPPER_CDMS) | 125 #endif // defined(ENABLE_PEPPER_CDMS) |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace content | 128 } // namespace content |
| OLD | NEW |