| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/media/crypto/ppapi_decryptor.h" | 5 #include "webkit/media/crypto/ppapi_decryptor.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" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 DCHECK(client_); | 33 DCHECK(client_); |
| 34 DCHECK(cdm_plugin_); | 34 DCHECK(cdm_plugin_); |
| 35 cdm_plugin_->set_decrypt_client(client); | 35 cdm_plugin_->set_decrypt_client(client); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PpapiDecryptor::~PpapiDecryptor() { | 38 PpapiDecryptor::~PpapiDecryptor() { |
| 39 cdm_plugin_->set_decrypt_client(NULL); | 39 cdm_plugin_->set_decrypt_client(NULL); |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool PpapiDecryptor::GenerateKeyRequest(const std::string& key_system, | 42 bool PpapiDecryptor::GenerateKeyRequest(const std::string& key_system, |
| 43 const std::string& type, |
| 43 const uint8* init_data, | 44 const uint8* init_data, |
| 44 int init_data_length) { | 45 int init_data_length) { |
| 45 DVLOG(2) << "GenerateKeyRequest()"; | 46 DVLOG(2) << "GenerateKeyRequest()"; |
| 46 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 47 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
| 47 DCHECK(cdm_plugin_); | 48 DCHECK(cdm_plugin_); |
| 48 | 49 |
| 49 // TODO(xhwang): Finalize the data type for |init_data| to avoid unnecessary | 50 // TODO(xhwang): Finalize the data type for |init_data| to avoid unnecessary |
| 50 // data type conversions. | 51 // data type conversions. |
| 51 if (!cdm_plugin_->GenerateKeyRequest( | 52 if (!cdm_plugin_->GenerateKeyRequest( |
| 52 key_system, | 53 key_system, |
| 54 type, |
| 53 std::string(reinterpret_cast<const char*>(init_data), | 55 std::string(reinterpret_cast<const char*>(init_data), |
| 54 init_data_length))) { | 56 init_data_length))) { |
| 55 ReportFailureToCallPlugin(key_system, ""); | 57 ReportFailureToCallPlugin(key_system, ""); |
| 56 return false; | 58 return false; |
| 57 } | 59 } |
| 58 | 60 |
| 59 return true; | 61 return true; |
| 60 } | 62 } |
| 61 | 63 |
| 62 void PpapiDecryptor::AddKey(const std::string& key_system, | 64 void PpapiDecryptor::AddKey(const std::string& key_system, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 video_key_added_cb_ = key_added_cb; | 243 video_key_added_cb_ = key_added_cb; |
| 242 base::ResetAndReturn(&video_decoder_init_cb_).Run(success); | 244 base::ResetAndReturn(&video_decoder_init_cb_).Run(success); |
| 243 break; | 245 break; |
| 244 | 246 |
| 245 default: | 247 default: |
| 246 NOTREACHED(); | 248 NOTREACHED(); |
| 247 } | 249 } |
| 248 } | 250 } |
| 249 | 251 |
| 250 } // namespace webkit_media | 252 } // namespace webkit_media |
| OLD | NEW |