Chromium Code Reviews| Index: third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp |
| diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp |
| index 104fd8030bdaf676787d7b9d2eb61d806ebb266b..fb8f9d8a000e25e6e43dbdcc96a19565694cfb67 100644 |
| --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp |
| +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.cpp |
| @@ -80,6 +80,33 @@ private: |
| const Member<DOMArrayBuffer> m_data; |
| }; |
| +// This class wraps the promise resolver used when setting the certificate |
| +// and is passed to Chromium to fullfill the promise. This implementation of |
| +// complete() will resolve the promise with true, while completeWithError() |
| +// will reject the promise with an exception. completeWithSession() |
| +// is not expected to be called, and will reject the promise. |
| +class SetCertificateResultPromise : public ContentDecryptionModuleResultPromise { |
| +public: |
| + SetCertificateResultPromise(ScriptState* scriptState) |
| + : ContentDecryptionModuleResultPromise(scriptState) |
| + { |
| + } |
| + |
| + ~SetCertificateResultPromise() override |
| + { |
| + } |
| + |
| + // ContentDecryptionModuleResult implementation. |
| + void complete() override |
| + { |
| + // TODO(jrummell): The EME spec specifies that "If the Key System |
| + // implementation does not support server certificates, return a |
| + // promise resolved with false." Need to have chromium return a bool |
| + // so that resolving with false is possible. http://crbug.com/618800. |
| + resolve(true); |
|
xhwang
2016/06/10 21:40:11
Can we translate completeWithError(NOT_SUPPORTED_E
jrummell
2016/06/10 23:01:15
Done. I checked all the calls for SetServerCertifi
|
| + } |
| +}; |
| + |
| MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm) |
| { |
| MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::move(cdm)); |
| @@ -155,7 +182,7 @@ ScriptPromise MediaKeys::setServerCertificate(ScriptState* scriptState, const DO |
| DOMArrayBuffer* serverCertificateBuffer = DOMArrayBuffer::create(serverCertificate.data(), serverCertificate.byteLength()); |
| // 4. Let promise be a new promise. |
| - SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryptionModuleResultPromise(scriptState); |
| + SetCertificateResultPromise* result = new SetCertificateResultPromise(scriptState); |
| ScriptPromise promise = result->promise(); |
| // 5. Run the following steps asynchronously (documented in timerFired()). |