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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void PpapiDecryptor::CancelKeyRequest(const std::string& key_system, | 99 void PpapiDecryptor::CancelKeyRequest(const std::string& key_system, |
100 const std::string& session_id) { | 100 const std::string& session_id) { |
101 DVLOG(2) << "CancelKeyRequest()"; | 101 DVLOG(2) << "CancelKeyRequest()"; |
102 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 102 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
103 | 103 |
104 if (!plugin_cdm_delegate_->CancelKeyRequest(session_id)) | 104 if (!plugin_cdm_delegate_->CancelKeyRequest(session_id)) |
105 ReportFailureToCallPlugin(key_system, session_id); | 105 ReportFailureToCallPlugin(key_system, session_id); |
106 } | 106 } |
107 | 107 |
| 108 media::MediaKeys* PpapiDecryptor::GetMediaKeys() { |
| 109 return this; |
| 110 } |
| 111 |
108 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, | 112 void PpapiDecryptor::RegisterNewKeyCB(StreamType stream_type, |
109 const NewKeyCB& new_key_cb) { | 113 const NewKeyCB& new_key_cb) { |
110 switch (stream_type) { | 114 switch (stream_type) { |
111 case kAudio: | 115 case kAudio: |
112 new_audio_key_cb_ = new_key_cb; | 116 new_audio_key_cb_ = new_key_cb; |
113 break; | 117 break; |
114 case kVideo: | 118 case kVideo: |
115 new_video_key_cb_ = new_key_cb; | 119 new_video_key_cb_ = new_key_cb; |
116 break; | 120 break; |
117 default: | 121 default: |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 261 } |
258 | 262 |
259 void PpapiDecryptor::KeyAdded(const std::string& key_system, | 263 void PpapiDecryptor::KeyAdded(const std::string& key_system, |
260 const std::string& session_id) { | 264 const std::string& session_id) { |
261 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 265 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
262 key_added_cb_.Run(key_system, session_id); | 266 key_added_cb_.Run(key_system, session_id); |
263 } | 267 } |
264 | 268 |
265 void PpapiDecryptor::KeyError(const std::string& key_system, | 269 void PpapiDecryptor::KeyError(const std::string& key_system, |
266 const std::string& session_id, | 270 const std::string& session_id, |
267 media::Decryptor::KeyError error_code, | 271 media::MediaKeys::KeyError error_code, |
268 int system_code) { | 272 int system_code) { |
269 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 273 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
270 key_error_cb_.Run(key_system, session_id, error_code, system_code); | 274 key_error_cb_.Run(key_system, session_id, error_code, system_code); |
271 } | 275 } |
272 | 276 |
273 void PpapiDecryptor::KeyMessage(const std::string& key_system, | 277 void PpapiDecryptor::KeyMessage(const std::string& key_system, |
274 const std::string& session_id, | 278 const std::string& session_id, |
275 const std::string& message, | 279 const std::string& message, |
276 const std::string& default_url) { | 280 const std::string& default_url) { |
277 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 281 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
278 key_message_cb_.Run(key_system, session_id, message, default_url); | 282 key_message_cb_.Run(key_system, session_id, message, default_url); |
279 } | 283 } |
280 | 284 |
281 void PpapiDecryptor::NeedKey(const std::string& key_system, | 285 void PpapiDecryptor::NeedKey(const std::string& key_system, |
282 const std::string& session_id, | 286 const std::string& session_id, |
283 const std::string& type, | 287 const std::string& type, |
284 scoped_ptr<uint8[]> init_data, | 288 scoped_ptr<uint8[]> init_data, |
285 int init_data_size) { | 289 int init_data_size) { |
286 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); | 290 DCHECK(render_loop_proxy_->BelongsToCurrentThread()); |
287 need_key_cb_.Run(key_system, session_id, type, | 291 need_key_cb_.Run(key_system, session_id, type, |
288 init_data.Pass(), init_data_size); | 292 init_data.Pass(), init_data_size); |
289 } | 293 } |
290 | 294 |
291 } // namespace webkit_media | 295 } // namespace webkit_media |
OLD | NEW |