| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SimpleContentDecryptionModuleResult_h | |
| 6 #define SimpleContentDecryptionModuleResult_h | |
| 7 | |
| 8 #include "core/dom/ExceptionCode.h" | |
| 9 #include "platform/ContentDecryptionModuleResult.h" | |
| 10 #include "wtf/Forward.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class ScriptPromise; | |
| 15 class ScriptPromiseResolver; | |
| 16 class ScriptState; | |
| 17 class WebString; | |
| 18 | |
| 19 ExceptionCode WebCdmExceptionToExceptionCode(WebContentDecryptionModuleException
); | |
| 20 | |
| 21 // This class wraps the promise resolver and is passed (indirectly) to Chromium | |
| 22 // to fullfill the promise. This implementation of complete() will resolve the | |
| 23 // promise with undefined, while completeWithError() reject the promise with an | |
| 24 // exception. completeWithSession() is not expected to be called, and will | |
| 25 // reject the promise. | |
| 26 class SimpleContentDecryptionModuleResult : public ContentDecryptionModuleResult
{ | |
| 27 public: | |
| 28 explicit SimpleContentDecryptionModuleResult(ScriptState*); | |
| 29 virtual ~SimpleContentDecryptionModuleResult(); | |
| 30 | |
| 31 // ContentDecryptionModuleResult implementation. | |
| 32 virtual void complete() override; | |
| 33 virtual void completeWithSession(WebContentDecryptionModuleResult::SessionSt
atus) override; | |
| 34 virtual void completeWithError(WebContentDecryptionModuleException, unsigned
long systemCode, const WebString&) override; | |
| 35 | |
| 36 // It is only valid to call this before completion. | |
| 37 ScriptPromise promise(); | |
| 38 | |
| 39 private: | |
| 40 // Reject the promise with a DOMException. | |
| 41 void completeWithDOMException(ExceptionCode, const String& errorMessage); | |
| 42 | |
| 43 RefPtr<ScriptPromiseResolver> m_resolver; | |
| 44 }; | |
| 45 | |
| 46 } // namespace blink | |
| 47 | |
| 48 #endif // SimpleContentDecryptionModuleResult_h | |
| OLD | NEW |