OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" | 5 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 case WebContentDecryptionModuleExceptionUnknownError: | 26 case WebContentDecryptionModuleExceptionUnknownError: |
27 return UnknownError; | 27 return UnknownError; |
28 case WebContentDecryptionModuleExceptionClientError: | 28 case WebContentDecryptionModuleExceptionClientError: |
29 case WebContentDecryptionModuleExceptionOutputError: | 29 case WebContentDecryptionModuleExceptionOutputError: |
30 // Currently no matching DOMException for these 2 errors. | 30 // Currently no matching DOMException for these 2 errors. |
31 // FIXME: Update DOMException to handle these if actually added to | 31 // FIXME: Update DOMException to handle these if actually added to |
32 // the EME spec. | 32 // the EME spec. |
33 return UnknownError; | 33 return UnknownError; |
34 } | 34 } |
35 | 35 |
36 ASSERT_NOT_REACHED(); | 36 NOTREACHED(); |
37 return UnknownError; | 37 return UnknownError; |
38 } | 38 } |
39 | 39 |
40 ContentDecryptionModuleResultPromise::ContentDecryptionModuleResultPromise(Scrip
tState* scriptState) | 40 ContentDecryptionModuleResultPromise::ContentDecryptionModuleResultPromise(Scrip
tState* scriptState) |
41 : m_resolver(ScriptPromiseResolver::create(scriptState)) | 41 : m_resolver(ScriptPromiseResolver::create(scriptState)) |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
45 ContentDecryptionModuleResultPromise::~ContentDecryptionModuleResultPromise() | 45 ContentDecryptionModuleResultPromise::~ContentDecryptionModuleResultPromise() |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 void ContentDecryptionModuleResultPromise::complete() | 49 void ContentDecryptionModuleResultPromise::complete() |
50 { | 50 { |
51 ASSERT_NOT_REACHED(); | 51 NOTREACHED(); |
52 reject(InvalidStateError, "Unexpected completion."); | 52 reject(InvalidStateError, "Unexpected completion."); |
53 } | 53 } |
54 | 54 |
55 void ContentDecryptionModuleResultPromise::completeWithContentDecryptionModule(W
ebContentDecryptionModule* cdm) | 55 void ContentDecryptionModuleResultPromise::completeWithContentDecryptionModule(W
ebContentDecryptionModule* cdm) |
56 { | 56 { |
57 ASSERT_NOT_REACHED(); | 57 NOTREACHED(); |
58 reject(InvalidStateError, "Unexpected completion."); | 58 reject(InvalidStateError, "Unexpected completion."); |
59 } | 59 } |
60 | 60 |
61 void ContentDecryptionModuleResultPromise::completeWithSession(WebContentDecrypt
ionModuleResult::SessionStatus status) | 61 void ContentDecryptionModuleResultPromise::completeWithSession(WebContentDecrypt
ionModuleResult::SessionStatus status) |
62 { | 62 { |
63 ASSERT_NOT_REACHED(); | 63 NOTREACHED(); |
64 reject(InvalidStateError, "Unexpected completion."); | 64 reject(InvalidStateError, "Unexpected completion."); |
65 } | 65 } |
66 | 66 |
67 void ContentDecryptionModuleResultPromise::completeWithError(WebContentDecryptio
nModuleException exceptionCode, unsigned long systemCode, const WebString& error
Message) | 67 void ContentDecryptionModuleResultPromise::completeWithError(WebContentDecryptio
nModuleException exceptionCode, unsigned long systemCode, const WebString& error
Message) |
68 { | 68 { |
69 // Non-zero |systemCode| is appended to the |errorMessage|. If the | 69 // Non-zero |systemCode| is appended to the |errorMessage|. If the |
70 // |errorMessage| is empty, we'll report "Rejected with system code | 70 // |errorMessage| is empty, we'll report "Rejected with system code |
71 // (systemCode)". | 71 // (systemCode)". |
72 String errorString = errorMessage; | 72 String errorString = errorMessage; |
73 if (systemCode != 0) { | 73 if (systemCode != 0) { |
(...skipping 20 matching lines...) Expand all Loading... |
94 return m_resolver->getExecutionContext(); | 94 return m_resolver->getExecutionContext(); |
95 } | 95 } |
96 | 96 |
97 DEFINE_TRACE(ContentDecryptionModuleResultPromise) | 97 DEFINE_TRACE(ContentDecryptionModuleResultPromise) |
98 { | 98 { |
99 visitor->trace(m_resolver); | 99 visitor->trace(m_resolver); |
100 ContentDecryptionModuleResult::trace(visitor); | 100 ContentDecryptionModuleResult::trace(visitor); |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
OLD | NEW |