diff options
author | jrummell <jrummell@chromium.org> | 2014-12-19 14:20:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-19 22:21:15 +0000 |
commit | 5408939ce692921b24d5bd19ceab28877c70050c (patch) | |
tree | 59ec0c41fe9334531b54deeb6b1d9f9a483b2097 /media | |
parent | 29a831e6d40110be14444ba4cb4d02492badab57 (diff) | |
download | chromium_src-5408939ce692921b24d5bd19ceab28877c70050c.zip chromium_src-5408939ce692921b24d5bd19ceab28877c70050c.tar.gz chromium_src-5408939ce692921b24d5bd19ceab28877c70050c.tar.bz2 |
Remove GetUsableKeyIds()
As this was never called from blink, and is no longer part of the EME
spec, removing this functionality.
BUG=428384
TEST=existing EME tests pass
Review URL: https://codereview.chromium.org/814083002
Cr-Commit-Position: refs/heads/master@{#309279}
Diffstat (limited to 'media')
-rw-r--r-- | media/base/cdm_callback_promise.cc | 1 | ||||
-rw-r--r-- | media/base/cdm_promise.h | 6 | ||||
-rw-r--r-- | media/base/media_keys.h | 7 | ||||
-rw-r--r-- | media/blink/cdm_result_promise.h | 8 | ||||
-rw-r--r-- | media/blink/cdm_session_adapter.cc | 6 | ||||
-rw-r--r-- | media/blink/cdm_session_adapter.h | 5 | ||||
-rw-r--r-- | media/blink/webcontentdecryptionmodulesession_impl.cc | 9 | ||||
-rw-r--r-- | media/blink/webcontentdecryptionmodulesession_impl.h | 1 | ||||
-rw-r--r-- | media/cdm/aes_decryptor.cc | 17 | ||||
-rw-r--r-- | media/cdm/aes_decryptor.h | 2 | ||||
-rw-r--r-- | media/cdm/aes_decryptor_unittest.cc | 65 | ||||
-rw-r--r-- | media/cdm/ppapi/external_clear_key/clear_key_cdm.cc | 22 | ||||
-rw-r--r-- | media/cdm/ppapi/external_clear_key/clear_key_cdm.h | 1 | ||||
-rw-r--r-- | media/mojo/interfaces/content_decryption_module.mojom | 6 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm.cc | 8 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm.h | 2 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm_promise.cc | 1 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm_service.cc | 9 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm_service.h | 5 | ||||
-rw-r--r-- | media/mojo/services/mojo_type_trait.h | 6 |
20 files changed, 2 insertions, 185 deletions
diff --git a/media/base/cdm_callback_promise.cc b/media/base/cdm_callback_promise.cc index 7b952ab..a198f45 100644 --- a/media/base/cdm_callback_promise.cc +++ b/media/base/cdm_callback_promise.cc @@ -38,6 +38,5 @@ void CdmCallbackPromise<T...>::reject(MediaKeys::Exception exception_code, // Explicit template instantiation for the Promises needed. template class MEDIA_EXPORT CdmCallbackPromise<>; template class MEDIA_EXPORT CdmCallbackPromise<std::string>; -template class MEDIA_EXPORT CdmCallbackPromise<KeyIdsVector>; } // namespace media diff --git a/media/base/cdm_promise.h b/media/base/cdm_promise.h index 783d688d..f8ba219 100644 --- a/media/base/cdm_promise.h +++ b/media/base/cdm_promise.h @@ -72,12 +72,6 @@ struct CdmPromiseTraits<std::string> { static const CdmPromise::ResolveParameterType kType = CdmPromise::STRING_TYPE; }; -template <> -struct CdmPromiseTraits<KeyIdsVector> { - static const CdmPromise::ResolveParameterType kType = - CdmPromise::KEY_IDS_VECTOR_TYPE; -}; - } // namespace // This class adds the resolve(T) method. This class is still an interface, and diff --git a/media/base/media_keys.h b/media/base/media_keys.h index e213748..c6efb27 100644 --- a/media/base/media_keys.h +++ b/media/base/media_keys.h @@ -27,8 +27,6 @@ class CdmPromiseTemplate; typedef CdmPromiseTemplate<std::string> NewSessionCdmPromise; typedef CdmPromiseTemplate<> SimpleCdmPromise; -typedef std::vector<std::vector<uint8> > KeyIdsVector; -typedef CdmPromiseTemplate<KeyIdsVector> KeyIdsPromise; // Performs media key operations. // @@ -112,11 +110,6 @@ class MEDIA_EXPORT MediaKeys{ virtual void RemoveSession(const std::string& web_session_id, scoped_ptr<SimpleCdmPromise> promise) = 0; - // Retrieves the key IDs for keys in the session that the CDM knows are - // currently usable to decrypt media data. - virtual void GetUsableKeyIds(const std::string& web_session_id, - scoped_ptr<KeyIdsPromise> promise) = 0; - // Returns the CdmContext associated with |this|, which must NOT be null. // Usually the CdmContext is owned by |this|. Caller needs to make sure it is // not used after |this| is destructed. diff --git a/media/blink/cdm_result_promise.h b/media/blink/cdm_result_promise.h index e59ea1c..57313df 100644 --- a/media/blink/cdm_result_promise.h +++ b/media/blink/cdm_result_promise.h @@ -65,14 +65,6 @@ inline void CdmResultPromise<>::resolve() { web_cdm_result_.complete(); } -template <> -inline void CdmResultPromise<media::KeyIdsVector>::resolve( - const media::KeyIdsVector& result) { - // TODO(jrummell): Update blink::WebContentDecryptionModuleResult to - // handle the set of keys. - reject(media::MediaKeys::NOT_SUPPORTED_ERROR, 0, "Not implemented."); -} - template <typename... T> void CdmResultPromise<T...>::reject(media::MediaKeys::Exception exception_code, uint32 system_code, diff --git a/media/blink/cdm_session_adapter.cc b/media/blink/cdm_session_adapter.cc index 43ce395..9b79ddb 100644 --- a/media/blink/cdm_session_adapter.cc +++ b/media/blink/cdm_session_adapter.cc @@ -121,12 +121,6 @@ void CdmSessionAdapter::RemoveSession( media_keys_->RemoveSession(web_session_id, promise.Pass()); } -void CdmSessionAdapter::GetUsableKeyIds( - const std::string& web_session_id, - scoped_ptr<KeyIdsPromise> promise) { - media_keys_->GetUsableKeyIds(web_session_id, promise.Pass()); -} - CdmContext* CdmSessionAdapter::GetCdmContext() { return media_keys_->GetCdmContext(); } diff --git a/media/blink/cdm_session_adapter.h b/media/blink/cdm_session_adapter.h index bfb5690..2f3ee87 100644 --- a/media/blink/cdm_session_adapter.h +++ b/media/blink/cdm_session_adapter.h @@ -83,11 +83,6 @@ class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { void RemoveSession(const std::string& web_session_id, scoped_ptr<SimpleCdmPromise> promise); - // Retrieves the key IDs for keys in the session that the CDM knows are - // currently usable to decrypt media data. - void GetUsableKeyIds(const std::string& web_session_id, - scoped_ptr<KeyIdsPromise> promise); - // Returns the CdmContext associated with |media_keys_|. // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor // after WebContentDecryptionModule is freed. http://crbug.com/330324 diff --git a/media/blink/webcontentdecryptionmodulesession_impl.cc b/media/blink/webcontentdecryptionmodulesession_impl.cc index 74c117d..061ee1f 100644 --- a/media/blink/webcontentdecryptionmodulesession_impl.cc +++ b/media/blink/webcontentdecryptionmodulesession_impl.cc @@ -140,15 +140,6 @@ void WebContentDecryptionModuleSessionImpl::remove( new CdmResultPromise<>(result, std::string()))); } -void WebContentDecryptionModuleSessionImpl::getUsableKeyIds( - blink::WebContentDecryptionModuleResult result) { - DCHECK(!web_session_id_.empty()); - adapter_->GetUsableKeyIds( - web_session_id_, - scoped_ptr<KeyIdsPromise>( - new CdmResultPromise<KeyIdsVector>(result, std::string()))); -} - void WebContentDecryptionModuleSessionImpl::release( blink::WebContentDecryptionModuleResult result) { close(result); diff --git a/media/blink/webcontentdecryptionmodulesession_impl.h b/media/blink/webcontentdecryptionmodulesession_impl.h index ac2a1e9f..423619a 100644 --- a/media/blink/webcontentdecryptionmodulesession_impl.h +++ b/media/blink/webcontentdecryptionmodulesession_impl.h @@ -50,7 +50,6 @@ class WebContentDecryptionModuleSessionImpl blink::WebContentDecryptionModuleResult result); virtual void close(blink::WebContentDecryptionModuleResult result); virtual void remove(blink::WebContentDecryptionModuleResult result); - virtual void getUsableKeyIds(blink::WebContentDecryptionModuleResult result); // TODO(jrummell): Remove the next method once blink updated. virtual void release(blink::WebContentDecryptionModuleResult result); diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc index 6b015cc..be781fd 100644 --- a/media/cdm/aes_decryptor.cc +++ b/media/cdm/aes_decryptor.cc @@ -367,23 +367,6 @@ void AesDecryptor::RemoveSession(const std::string& web_session_id, promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); } -void AesDecryptor::GetUsableKeyIds(const std::string& web_session_id, - scoped_ptr<KeyIdsPromise> promise) { - // Since |web_session_id| is not provided by the user, this should never - // happen. - DCHECK(valid_sessions_.find(web_session_id) != valid_sessions_.end()); - - KeyIdsVector keyids; - base::AutoLock auto_lock(key_map_lock_); - for (KeyIdToSessionKeysMap::iterator it = key_map_.begin(); - it != key_map_.end(); - ++it) { - if (it->second->Contains(web_session_id)) - keyids.push_back(std::vector<uint8>(it->first.begin(), it->first.end())); - } - promise->resolve(keyids); -} - CdmContext* AesDecryptor::GetCdmContext() { return this; } diff --git a/media/cdm/aes_decryptor.h b/media/cdm/aes_decryptor.h index 7669a56..8f97487 100644 --- a/media/cdm/aes_decryptor.h +++ b/media/cdm/aes_decryptor.h @@ -54,8 +54,6 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys, scoped_ptr<SimpleCdmPromise> promise) override; void RemoveSession(const std::string& web_session_id, scoped_ptr<SimpleCdmPromise> promise) override; - void GetUsableKeyIds(const std::string& web_session_id, - scoped_ptr<KeyIdsPromise> promise) override; CdmContext* GetCdmContext() override; // CdmContext implementation. diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index 1a228d4..dc0b4db 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc @@ -241,14 +241,6 @@ class AesDecryptorTest : public testing::Test { EXPECT_EQ(expected_result, RESOLVED) << "Unexpectedly resolved."; } - void OnResolveWithUsableKeyIds(PromiseResult expected_result, - uint32 expected_count, - const KeyIdsVector& useable_key_ids) { - EXPECT_EQ(expected_result, RESOLVED) << "Unexpectedly resolved."; - EXPECT_EQ(expected_count, useable_key_ids.size()); - useable_key_ids_ = useable_key_ids; - } - void OnReject(PromiseResult expected_result, MediaKeys::Exception exception_code, uint32 system_code, @@ -280,20 +272,6 @@ class AesDecryptorTest : public testing::Test { return promise.Pass(); } - scoped_ptr<KeyIdsPromise> CreateUsableKeyIdsPromise( - PromiseResult expected_result, - uint32 expected_count) { - scoped_ptr<KeyIdsPromise> promise(new CdmCallbackPromise<KeyIdsVector>( - base::Bind(&AesDecryptorTest::OnResolveWithUsableKeyIds, - base::Unretained(this), - expected_result, - expected_count), - base::Bind(&AesDecryptorTest::OnReject, - base::Unretained(this), - expected_result))); - return promise.Pass(); - } - // Creates a new session using |key_id|. Returns the session ID. std::string CreateSession(const std::vector<uint8>& key_id) { DCHECK(!key_id.empty()); @@ -344,23 +322,6 @@ class AesDecryptorTest : public testing::Test { CreatePromise(expected_result)); } - void GetUsableKeyIdsAndExpect(const std::string& session_id, - PromiseResult expected_result, - uint32 expected_count) { - decryptor_.GetUsableKeyIds( - session_id, CreateUsableKeyIdsPromise(expected_result, expected_count)); - } - - bool UsableKeyIdsContains(std::vector<uint8> expected) { - for (KeyIdsVector::iterator it = useable_key_ids_.begin(); - it != useable_key_ids_.end(); - ++it) { - if (*it == expected) - return true; - } - return false; - } - MOCK_METHOD2(BufferDecrypted, void(Decryptor::Status, const scoped_refptr<DecoderBuffer>&)); @@ -433,10 +394,6 @@ class AesDecryptorTest : public testing::Test { AesDecryptor::DecryptCB decrypt_cb_; std::string web_session_id_; - // Copy of the vector from the last successful call to - // OnResolveWithUsableKeyIds(). - KeyIdsVector useable_key_ids_; - // Constants for testing. const std::vector<uint8> original_data_; const std::vector<uint8> encrypted_data_; @@ -879,26 +836,4 @@ TEST_F(AesDecryptorTest, JWKKey) { CloseSession(session_id); } -TEST_F(AesDecryptorTest, GetKeyIds) { - std::vector<uint8> key_id1(kKeyId, kKeyId + arraysize(kKeyId)); - std::vector<uint8> key_id2(kKeyId2, kKeyId2 + arraysize(kKeyId2)); - - std::string session_id = CreateSession(key_id_); - GetUsableKeyIdsAndExpect(session_id, RESOLVED, 0); - EXPECT_FALSE(UsableKeyIdsContains(key_id1)); - EXPECT_FALSE(UsableKeyIdsContains(key_id2)); - - // Add 1 key, verify ID is returned. - UpdateSessionAndExpect(session_id, kKeyAsJWK, RESOLVED); - GetUsableKeyIdsAndExpect(session_id, RESOLVED, 1); - EXPECT_TRUE(UsableKeyIdsContains(key_id1)); - EXPECT_FALSE(UsableKeyIdsContains(key_id2)); - - // Add second key, verify both IDs returned. - UpdateSessionAndExpect(session_id, kKey2AsJWK, RESOLVED); - GetUsableKeyIdsAndExpect(session_id, RESOLVED, 2); - EXPECT_TRUE(UsableKeyIdsContains(key_id1)); - EXPECT_TRUE(UsableKeyIdsContains(key_id2)); -} - } // namespace media diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc index d9fba30..ecb757e 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc @@ -378,16 +378,8 @@ void ClearKeyCdm::SetServerCertificate(uint32 promise_id, void ClearKeyCdm::GetUsableKeyIds(uint32_t promise_id, const char* web_session_id, uint32_t web_session_id_length) { - std::string web_session_str(web_session_id, web_session_id_length); - scoped_ptr<media::KeyIdsPromise> promise( - new media::CdmCallbackPromise<KeyIdsVector>( - base::Bind(&ClearKeyCdm::OnUsableKeyIdsObtained, - base::Unretained(this), - promise_id), - base::Bind(&ClearKeyCdm::OnPromiseFailed, - base::Unretained(this), - promise_id))); - decryptor_.GetUsableKeyIds(web_session_str, promise.Pass()); + // Not used anymore, but required for CDM_6 interface. + NOTREACHED() << "GetUsableKeyIds() should not be called"; } void ClearKeyCdm::TimerExpired(void* context) { @@ -761,16 +753,6 @@ void ClearKeyCdm::OnSessionUpdated(uint32 promise_id, host_->OnResolvePromise(promise_id); } -void ClearKeyCdm::OnUsableKeyIdsObtained(uint32 promise_id, - const KeyIdsVector& key_ids) { - scoped_ptr<cdm::BinaryData[]> result(new cdm::BinaryData[key_ids.size()]); - for (uint32 i = 0; i < key_ids.size(); ++i) { - result[i].data = key_ids[i].data(); - result[i].length = key_ids[i].size(); - } - host_->OnResolveKeyIdsPromise(promise_id, result.get(), key_ids.size()); -} - void ClearKeyCdm::OnPromiseResolved(uint32 promise_id) { host_->OnResolvePromise(promise_id); } diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.h b/media/cdm/ppapi/external_clear_key/clear_key_cdm.h index f75dcc5..49be9d0 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.h +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.h @@ -101,7 +101,6 @@ class ClearKeyCdm : public ClearKeyCdmInterface { void OnSessionCreated(uint32 promise_id, const std::string& web_session_id); void OnSessionLoaded(uint32 promise_id, const std::string& web_session_id); void OnSessionUpdated(uint32 promise_id, const std::string& web_session_id); - void OnUsableKeyIdsObtained(uint32 promise_id, const KeyIdsVector& key_ids); void OnPromiseResolved(uint32 promise_id); void OnPromiseFailed(uint32 promise_id, MediaKeys::Exception exception_code, diff --git a/media/mojo/interfaces/content_decryption_module.mojom b/media/mojo/interfaces/content_decryption_module.mojom index 9baf606..119b1aa 100644 --- a/media/mojo/interfaces/content_decryption_module.mojom +++ b/media/mojo/interfaces/content_decryption_module.mojom @@ -74,12 +74,6 @@ interface ContentDecryptionModule { // |session_id|. RemoveSession(string session_id) => (CdmPromiseResult result); - // Retrieves the key IDs for keys in the session that the CDM knows are - // currently usable to decrypt media data. If |result.success| is - // false, the |usable_key_ids| will be null. - GetUsableKeyIds(string session_id) - => (CdmPromiseResult result, array<array<uint8>>? usable_key_ids); - // Assigns the |cdm_id| to the CDM, and retrieves the |decryptor| associated // with this CDM instance. // A CDM implementation must choose to support either an explicit or implicit diff --git a/media/mojo/services/mojo_cdm.cc b/media/mojo/services/mojo_cdm.cc index 868f5d5..5d9a1a9 100644 --- a/media/mojo/services/mojo_cdm.cc +++ b/media/mojo/services/mojo_cdm.cc @@ -113,14 +113,6 @@ void MojoCdm::RemoveSession(const std::string& session_id, base::Passed(&promise))); } -void MojoCdm::GetUsableKeyIds(const std::string& session_id, - scoped_ptr<KeyIdsPromise> promise) { - remote_cdm_->GetUsableKeyIds( - session_id, - base::Bind(&MojoCdm::OnPromiseResult<KeyIdsVector>, - weak_factory_.GetWeakPtr(), base::Passed(&promise))); -} - CdmContext* MojoCdm::GetCdmContext() { NOTIMPLEMENTED(); return nullptr; diff --git a/media/mojo/services/mojo_cdm.h b/media/mojo/services/mojo_cdm.h index 5e930b3..b865cac 100644 --- a/media/mojo/services/mojo_cdm.h +++ b/media/mojo/services/mojo_cdm.h @@ -52,8 +52,6 @@ class MojoCdm : public MediaKeys, public mojo::ContentDecryptionModuleClient { scoped_ptr<SimpleCdmPromise> promise) final; void RemoveSession(const std::string& session_id, scoped_ptr<SimpleCdmPromise> promise) final; - void GetUsableKeyIds(const std::string& session_id, - scoped_ptr<KeyIdsPromise> promise) final; CdmContext* GetCdmContext() final; private: diff --git a/media/mojo/services/mojo_cdm_promise.cc b/media/mojo/services/mojo_cdm_promise.cc index 84d2328..3257bd8 100644 --- a/media/mojo/services/mojo_cdm_promise.cc +++ b/media/mojo/services/mojo_cdm_promise.cc @@ -58,6 +58,5 @@ void MojoCdmPromise<T...>::reject(MediaKeys::Exception exception, template class MojoCdmPromise<>; template class MojoCdmPromise<std::string>; -template class MojoCdmPromise<std::vector<std::vector<uint8_t>>>; } // namespace media diff --git a/media/mojo/services/mojo_cdm_service.cc b/media/mojo/services/mojo_cdm_service.cc index ff8e5e1..eeada5d 100644 --- a/media/mojo/services/mojo_cdm_service.cc +++ b/media/mojo/services/mojo_cdm_service.cc @@ -97,15 +97,6 @@ void MojoCdmService::RemoveSession( scoped_ptr<SimpleCdmPromise>(new SimpleMojoCdmPromise(callback))); } -void MojoCdmService::GetUsableKeyIds( - const mojo::String& session_id, - const mojo::Callback<void(mojo::CdmPromiseResultPtr, - mojo::Array<mojo::Array<uint8_t>>)>& callback) { - cdm_->GetUsableKeyIds( - session_id.To<std::string>(), - scoped_ptr<KeyIdsPromise>(new KeyIdsMojoCdmPromise(callback))); -} - void MojoCdmService::GetCdmContext( int32_t cdm_id, mojo::InterfaceRequest<mojo::Decryptor> decryptor) { diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h index 6bbb77c..24db817 100644 --- a/media/mojo/services/mojo_cdm_service.h +++ b/media/mojo/services/mojo_cdm_service.h @@ -44,11 +44,6 @@ class MojoCdmService void RemoveSession( const mojo::String& session_id, const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; - void GetUsableKeyIds( - const mojo::String& session_id, - const mojo::Callback<void(mojo::CdmPromiseResultPtr, - mojo::Array<mojo::Array<uint8_t>>)>& callback) - final; void GetCdmContext(int32_t cdm_id, mojo::InterfaceRequest<mojo::Decryptor> decryptor) final; diff --git a/media/mojo/services/mojo_type_trait.h b/media/mojo/services/mojo_type_trait.h index e76264d..d041b76 100644 --- a/media/mojo/services/mojo_type_trait.h +++ b/media/mojo/services/mojo_type_trait.h @@ -21,12 +21,6 @@ struct MojoTypeTrait<std::string> { static MojoType DefaultValue() { return MojoType(); } }; -template <> -struct MojoTypeTrait<KeyIdsVector> { - typedef mojo::Array<mojo::Array<uint8_t>> MojoType; - static MojoType DefaultValue() { return MojoType(); } -}; - } // namespace media #endif // MEDIA_MOJO_SERVICES_MOJO_TYPE_TRAIT_H_ |