Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 24192004: Changes to the EME Pepper API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/renderer/pepper/content_decryptor_delegate.h" 5 #include "content/renderer/pepper/content_decryptor_delegate.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/safe_numerics.h" 10 #include "base/safe_numerics.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 weak_this_(weak_ptr_factory_.GetWeakPtr()), 236 weak_this_(weak_ptr_factory_.GetWeakPtr()),
237 audio_sample_format_(media::kUnknownSampleFormat), 237 audio_sample_format_(media::kUnknownSampleFormat),
238 audio_samples_per_second_(0), 238 audio_samples_per_second_(0),
239 audio_channel_count_(0), 239 audio_channel_count_(0),
240 audio_bytes_per_frame_(0) { 240 audio_bytes_per_frame_(0) {
241 } 241 }
242 242
243 ContentDecryptorDelegate::~ContentDecryptorDelegate() { 243 ContentDecryptorDelegate::~ContentDecryptorDelegate() {
244 } 244 }
245 245
246 void ContentDecryptorDelegate::Initialize(const std::string& key_system) { 246 void ContentDecryptorDelegate::Initialize(const std::string& key_system,
247 // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private. 247 bool can_challenge_platform) {
248 DCHECK(!key_system.empty()); 248 DCHECK(!key_system.empty());
249 DCHECK(key_system_.empty());
249 key_system_ = key_system; 250 key_system_ = key_system;
251
252 plugin_decryption_interface_->Initialize(
253 pp_instance_,
254 StringVar::StringToPPVar(key_system_),
255 PP_FromBool(can_challenge_platform));
250 } 256 }
251 257
252 void ContentDecryptorDelegate::SetKeyEventCallbacks( 258 void ContentDecryptorDelegate::SetKeyEventCallbacks(
253 const media::KeyAddedCB& key_added_cb, 259 const media::KeyAddedCB& key_added_cb,
254 const media::KeyErrorCB& key_error_cb, 260 const media::KeyErrorCB& key_error_cb,
255 const media::KeyMessageCB& key_message_cb) { 261 const media::KeyMessageCB& key_message_cb) {
256 key_added_cb_ = key_added_cb; 262 key_added_cb_ = key_added_cb;
257 key_error_cb_ = key_error_cb; 263 key_error_cb_ = key_error_cb;
258 key_message_cb_ = key_message_cb; 264 key_message_cb_ = key_message_cb;
259 } 265 }
260 266
261 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, 267 bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type,
262 const uint8* init_data, 268 const uint8* init_data,
263 int init_data_length) { 269 int init_data_length) {
264 PP_Var init_data_array = 270 PP_Var init_data_array =
265 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( 271 PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
266 init_data_length, init_data); 272 init_data_length, init_data);
267 273
268 plugin_decryption_interface_->GenerateKeyRequest( 274 plugin_decryption_interface_->GenerateKeyRequest(
269 pp_instance_, 275 pp_instance_,
270 StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove.
271 StringVar::StringToPPVar(type), 276 StringVar::StringToPPVar(type),
272 init_data_array); 277 init_data_array);
273 return true; 278 return true;
274 } 279 }
275 280
276 bool ContentDecryptorDelegate::AddKey(const std::string& session_id, 281 bool ContentDecryptorDelegate::AddKey(const std::string& session_id,
277 const uint8* key, 282 const uint8* key,
278 int key_length, 283 int key_length,
279 const uint8* init_data, 284 const uint8* init_data,
280 int init_data_length) { 285 int init_data_length) {
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 frames->push_back(frame); 1047 frames->push_back(frame);
1043 1048
1044 cur += frame_size; 1049 cur += frame_size;
1045 bytes_left -= frame_size; 1050 bytes_left -= frame_size;
1046 } while (bytes_left > 0); 1051 } while (bytes_left > 0);
1047 1052
1048 return true; 1053 return true;
1049 } 1054 }
1050 1055
1051 } // namespace content 1056 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/content_decryptor_delegate.h ('k') | content/renderer/pepper/pepper_plugin_instance_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698