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

Side by Side Diff: media/cdm/aes_decryptor.cc

Issue 2108033002: EME: Clear Key CDM now generates keystatuseschange event on close() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-keystatuses.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/cdm/aes_decryptor.h" 5 #include "media/cdm/aes_decryptor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <list> 8 #include <list>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 void AesDecryptor::CloseSession(const std::string& session_id, 403 void AesDecryptor::CloseSession(const std::string& session_id,
404 std::unique_ptr<SimpleCdmPromise> promise) { 404 std::unique_ptr<SimpleCdmPromise> promise) {
405 // Validate that this is a reference to an active session and then forget it. 405 // Validate that this is a reference to an active session and then forget it.
406 std::set<std::string>::iterator it = valid_sessions_.find(session_id); 406 std::set<std::string>::iterator it = valid_sessions_.find(session_id);
407 DCHECK(it != valid_sessions_.end()); 407 DCHECK(it != valid_sessions_.end());
408 408
409 valid_sessions_.erase(it); 409 valid_sessions_.erase(it);
410 410
411 // Close the session. 411 // Close the session.
412 DeleteKeysForSession(session_id); 412 DeleteKeysForSession(session_id);
413 promise->resolve(); 413 promise->resolve();
ddorwin 2016/06/30 06:51:24 This is supposed to be last. https://w3c.github.io
jrummell 2016/07/01 00:01:22 Agreed. However, since we're not currently using a
414
415 // Update key statuses. All keys are gone, so it's an empty set.
ddorwin 2016/06/30 06:51:24 nit: "gone" sounds informal. I suggest either copy
jrummell 2016/07/01 00:01:22 Done.
416 session_keys_change_cb_.Run(session_id, false, CdmKeysInfo());
417
418 // Update expiration time to NaN. (http://crbug.com/624192)
419
420 // Resolve the closed attribute.
414 session_closed_cb_.Run(session_id); 421 session_closed_cb_.Run(session_id);
415 } 422 }
416 423
417 void AesDecryptor::RemoveSession(const std::string& session_id, 424 void AesDecryptor::RemoveSession(const std::string& session_id,
418 std::unique_ptr<SimpleCdmPromise> promise) { 425 std::unique_ptr<SimpleCdmPromise> promise) {
419 // AesDecryptor doesn't keep any persistent data, so this should be 426 // AesDecryptor doesn't keep any persistent data, so this should be
420 // NOT_REACHED(). 427 // NOT_REACHED().
421 // TODO(jrummell): Make sure persistent session types are rejected. 428 // TODO(jrummell): Make sure persistent session types are rejected.
422 // http://crbug.com/384152. 429 // http://crbug.com/384152.
423 // 430 //
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 bool AesDecryptor::DecryptionKey::Init() { 614 bool AesDecryptor::DecryptionKey::Init() {
608 CHECK(!secret_.empty()); 615 CHECK(!secret_.empty());
609 decryption_key_ = 616 decryption_key_ =
610 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_); 617 crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, secret_);
611 if (!decryption_key_) 618 if (!decryption_key_)
612 return false; 619 return false;
613 return true; 620 return true;
614 } 621 }
615 622
616 } // namespace media 623 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-keystatuses.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698