| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/encrypted_media_player_support_impl.h" | 5 #include "content/renderer/media/crypto/encrypted_media_player_support_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "content/renderer/media/crypto/key_systems.h" | 15 #include "content/renderer/media/crypto/key_systems.h" |
| 16 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" | 16 #include "content/renderer/media/webcontentdecryptionmodule_impl.h" |
| 17 #include "content/renderer/pepper/pepper_webplugin_impl.h" | 17 #include "content/renderer/pepper/pepper_webplugin_impl.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/blink/encrypted_media_player_support.h" |
| 19 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" | 20 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h" |
| 20 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 21 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 21 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" | 22 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" |
| 22 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
| 23 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 24 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 24 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 25 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 25 | 26 |
| 26 #if defined(ENABLE_PEPPER_CDMS) | 27 #if defined(ENABLE_PEPPER_CDMS) |
| 27 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" | 28 #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h" |
| 28 #endif | 29 #endif |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // so we keep it as simple as possible without breaking major use cases. | 117 // so we keep it as simple as possible without breaking major use cases. |
| 117 static std::string GuessInitDataType(const unsigned char* init_data, | 118 static std::string GuessInitDataType(const unsigned char* init_data, |
| 118 unsigned init_data_length) { | 119 unsigned init_data_length) { |
| 119 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. | 120 // Most WebM files use KeyId of 16 bytes. MP4 init data are always >16 bytes. |
| 120 if (init_data_length == 16) | 121 if (init_data_length == 16) |
| 121 return "video/webm"; | 122 return "video/webm"; |
| 122 | 123 |
| 123 return "video/mp4"; | 124 return "video/mp4"; |
| 124 } | 125 } |
| 125 | 126 |
| 126 scoped_ptr<EncryptedMediaPlayerSupport> EncryptedMediaPlayerSupportImpl::Create( | 127 scoped_ptr<media::EncryptedMediaPlayerSupport> |
| 127 blink::WebMediaPlayerClient* client) { | 128 EncryptedMediaPlayerSupportImpl::Create(blink::WebMediaPlayerClient* client) { |
| 128 return scoped_ptr<EncryptedMediaPlayerSupport>( | 129 return scoped_ptr<EncryptedMediaPlayerSupport>( |
| 129 new EncryptedMediaPlayerSupportImpl(client)); | 130 new EncryptedMediaPlayerSupportImpl(client)); |
| 130 } | 131 } |
| 131 | 132 |
| 132 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( | 133 EncryptedMediaPlayerSupportImpl::EncryptedMediaPlayerSupportImpl( |
| 133 blink::WebMediaPlayerClient* client) | 134 blink::WebMediaPlayerClient* client) |
| 134 : client_(client), | 135 : client_(client), |
| 135 web_cdm_(NULL) { | 136 web_cdm_(NULL) { |
| 136 } | 137 } |
| 137 | 138 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 463 |
| 463 if (web_cdm_) { | 464 if (web_cdm_) { |
| 464 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); | 465 decryptor_ready_cb.Run(web_cdm_->GetDecryptor(), base::Bind(DoNothing)); |
| 465 return; | 466 return; |
| 466 } | 467 } |
| 467 | 468 |
| 468 decryptor_ready_cb_ = decryptor_ready_cb; | 469 decryptor_ready_cb_ = decryptor_ready_cb; |
| 469 } | 470 } |
| 470 | 471 |
| 471 } // namespace content | 472 } // namespace content |
| OLD | NEW |