| OLD | NEW |
| 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 "webcontentdecryptionmodule_impl.h" | 5 #include "webcontentdecryptionmodule_impl.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // TODO(ddorwin): Guard against this in supported types check and remove this. | 33 // TODO(ddorwin): Guard against this in supported types check and remove this. |
| 34 // Chromium only supports ASCII key systems. | 34 // Chromium only supports ASCII key systems. |
| 35 if (!base::IsStringASCII(key_system)) { | 35 if (!base::IsStringASCII(key_system)) { |
| 36 NOTREACHED(); | 36 NOTREACHED(); |
| 37 result.completeWithError( | 37 result.completeWithError( |
| 38 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 38 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
| 39 "Invalid keysystem."); | 39 "Invalid keysystem."); |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 | 42 |
| 43 // TODO(ddorwin): This should be a DCHECK. |
| 43 std::string key_system_ascii = base::UTF16ToASCII(key_system); | 44 std::string key_system_ascii = base::UTF16ToASCII(key_system); |
| 44 if (!media::IsConcreteSupportedKeySystem(key_system_ascii)) { | 45 if (!media::IsSupportedKeySystem(key_system_ascii)) { |
| 45 std::string message = | 46 std::string message = |
| 46 "Keysystem '" + key_system_ascii + "' is not supported."; | 47 "Keysystem '" + key_system_ascii + "' is not supported."; |
| 47 result.completeWithError( | 48 result.completeWithError( |
| 48 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 49 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
| 49 blink::WebString::fromUTF8(message)); | 50 blink::WebString::fromUTF8(message)); |
| 50 return; | 51 return; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // If unique security origin, don't try to create the CDM. | 54 // If unique security origin, don't try to create the CDM. |
| 54 if (security_origin.isUnique() || security_origin.toString() == "null") { | 55 if (security_origin.isUnique() || security_origin.toString() == "null") { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::saturated_cast<int>(server_certificate_length), | 100 base::saturated_cast<int>(server_certificate_length), |
| 100 scoped_ptr<SimpleCdmPromise>( | 101 scoped_ptr<SimpleCdmPromise>( |
| 101 new CdmResultPromise<>(result, std::string()))); | 102 new CdmResultPromise<>(result, std::string()))); |
| 102 } | 103 } |
| 103 | 104 |
| 104 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { | 105 CdmContext* WebContentDecryptionModuleImpl::GetCdmContext() { |
| 105 return adapter_->GetCdmContext(); | 106 return adapter_->GetCdmContext(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 } // namespace media | 109 } // namespace media |
| OLD | NEW |