Chromium Code Reviews| Index: media/blink/webcontentdecryptionmodulesession_impl.cc |
| diff --git a/media/blink/webcontentdecryptionmodulesession_impl.cc b/media/blink/webcontentdecryptionmodulesession_impl.cc |
| index 9cb8610b3af39d1e195299c9b68ace28066ac7d5..4da443f7d07afdfd965c74f4f561c268d4bfe619 100644 |
| --- a/media/blink/webcontentdecryptionmodulesession_impl.cc |
| +++ b/media/blink/webcontentdecryptionmodulesession_impl.cc |
| @@ -31,12 +31,6 @@ const char kLoadSessionUMAName[] = "LoadSession"; |
| const char kRemoveSessionUMAName[] = "RemoveSession"; |
| const char kUpdateSessionUMAName[] = "UpdateSession"; |
| -// TODO(jrummell): Pass an enum from blink. http://crbug.com/418239. |
| -const char kTemporarySessionType[] = "temporary"; |
| -const char kPersistentLicenseSessionType[] = "persistent-license"; |
| -const char kPersistentReleaseMessageSessionType[] = |
| - "persistent-release-message"; |
| - |
| static blink::WebContentDecryptionModuleSession::Client::MessageType |
| convertMessageType(MediaKeys::MessageType message_type) { |
| switch (message_type) { |
| @@ -94,31 +88,30 @@ blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { |
| } |
| void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
| - const blink::WebString& init_data_type, |
| - const uint8* init_data, |
| + blink::WebEncryptedMediaInitDataType init_data_type, |
| + const unsigned char* init_data, |
| size_t init_data_length, |
| - const blink::WebString& session_type, |
| + blink::WebEncryptedMediaSessionType session_type, |
| blink::WebContentDecryptionModuleResult result) { |
| DCHECK(session_id_.empty()); |
| - // TODO(ddorwin): Guard against this in supported types check and remove this. |
| - // Chromium only supports ASCII MIME types. |
| - if (!base::IsStringASCII(init_data_type)) { |
| - NOTREACHED(); |
| - std::string message = "The initialization data type " + |
| - init_data_type.utf8() + |
| - " is not supported by the key system."; |
| - result.completeWithError( |
| - blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
| - blink::WebString::fromUTF8(message)); |
| - return; |
| + std::string init_data_type_as_ascii; |
|
sandersd (OOO until July 31)
2015/02/25 22:41:46
Should probably set this to "unknown" (in case no
jrummell
2015/02/25 23:34:32
Done.
|
| + switch (init_data_type) { |
| + case blink::WebEncryptedMediaInitDataType::Cenc: |
| + init_data_type_as_ascii = "cenc"; |
|
sandersd (OOO until July 31)
2015/02/25 22:41:46
Since these constants are spreading, perhaps creat
jrummell
2015/02/25 23:34:32
Done.
|
| + break; |
| + case blink::WebEncryptedMediaInitDataType::Keyids: |
| + init_data_type_as_ascii = "keyids"; |
| + break; |
| + case blink::WebEncryptedMediaInitDataType::Webm: |
| + init_data_type_as_ascii = "webm"; |
| + break; |
| + case blink::WebEncryptedMediaInitDataType::Unknown: |
| + NOTREACHED() << "unexpected init_data_type"; |
| + init_data_type_as_ascii = "unknown"; |
| + break; |
| } |
| - std::string init_data_type_as_ascii = base::UTF16ToASCII(init_data_type); |
| - DLOG_IF(WARNING, init_data_type_as_ascii.find('/') != std::string::npos) |
| - << "init_data_type '" << init_data_type_as_ascii |
| - << "' may be a MIME type"; |
| - |
| // Step 5 from https://w3c.github.io/encrypted-media/#generateRequest. |
| // 5. If the Key System implementation represented by this object's cdm |
| // implementation value does not support initDataType as an Initialization |
| @@ -136,13 +129,20 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
| } |
| MediaKeys::SessionType session_type_enum; |
|
sandersd (OOO until July 31)
2015/02/25 22:41:46
Set to TEMPORARY.
jrummell
2015/02/25 23:34:32
Done.
|
| - if (session_type == kPersistentLicenseSessionType) { |
| - session_type_enum = MediaKeys::PERSISTENT_LICENSE_SESSION; |
| - } else if (session_type == kPersistentReleaseMessageSessionType) { |
| - session_type_enum = MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION; |
| - } else { |
| - DCHECK(session_type == kTemporarySessionType); |
| - session_type_enum = MediaKeys::TEMPORARY_SESSION; |
| + switch (session_type) { |
| + case blink::WebEncryptedMediaSessionType::Temporary: |
| + session_type_enum = MediaKeys::TEMPORARY_SESSION; |
| + break; |
| + case blink::WebEncryptedMediaSessionType::PersistentLicense: |
| + session_type_enum = MediaKeys::PERSISTENT_LICENSE_SESSION; |
| + break; |
| + case blink::WebEncryptedMediaSessionType::PersistentReleaseMessage: |
| + session_type_enum = MediaKeys::PERSISTENT_RELEASE_MESSAGE_SESSION; |
| + break; |
| + case blink::WebEncryptedMediaSessionType::Unknown: |
| + NOTREACHED() << "unexpected session_type"; |
| + session_type_enum = MediaKeys::TEMPORARY_SESSION; |
| + break; |
| } |
| adapter_->InitializeNewSession( |
| @@ -155,6 +155,16 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
| base::Unretained(this))))); |
| } |
| +// TODO(jrummell): Remove this. http://crbug.com/418239. |
| +void WebContentDecryptionModuleSessionImpl::initializeNewSession( |
| + const blink::WebString& init_data_type, |
| + const uint8* init_data, |
| + size_t init_data_length, |
| + const blink::WebString& session_type, |
| + blink::WebContentDecryptionModuleResult result) { |
| + NOTREACHED(); |
| +} |
| + |
| void WebContentDecryptionModuleSessionImpl::load( |
| const blink::WebString& session_id, |
| blink::WebContentDecryptionModuleResult result) { |