| 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/HTMLMediaElementEncryptedMedia.h" | 5 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void completeWithSession(WebContentDecryptionModuleResult::SessionStatus sta
tus) override | 82 void completeWithSession(WebContentDecryptionModuleResult::SessionStatus sta
tus) override |
| 83 { | 83 { |
| 84 NOTREACHED(); | 84 NOTREACHED(); |
| 85 (*m_failureCallback)(InvalidStateError, "Unexpected completion."); | 85 (*m_failureCallback)(InvalidStateError, "Unexpected completion."); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void completeWithError(WebContentDecryptionModuleException code, unsigned lo
ng systemCode, const WebString& message) override | 88 void completeWithError(WebContentDecryptionModuleException code, unsigned lo
ng systemCode, const WebString& message) override |
| 89 { | 89 { |
| 90 // Non-zero |systemCode| is appended to the |message|. If the |message| | 90 // Non-zero |systemCode| is appended to the |message|. If the |message| |
| 91 // is empty, we'll report "Rejected with system code (systemCode)". | 91 // is empty, we'll report "Rejected with system code (systemCode)". |
| 92 String errorString = message; | 92 StringBuilder result; |
| 93 result.append(message); |
| 93 if (systemCode != 0) { | 94 if (systemCode != 0) { |
| 94 if (errorString.isEmpty()) | 95 if (result.isEmpty()) |
| 95 errorString.append("Rejected with system code"); | 96 result.append("Rejected with system code"); |
| 96 errorString.append(" (" + String::number(systemCode) + ")"); | 97 result.append(" ("); |
| 98 result.appendNumber(systemCode); |
| 99 result.append(')'); |
| 97 } | 100 } |
| 98 (*m_failureCallback)(WebCdmExceptionToExceptionCode(code), errorString); | 101 (*m_failureCallback)(WebCdmExceptionToExceptionCode(code), result.toStri
ng()); |
| 99 } | 102 } |
| 100 | 103 |
| 101 private: | 104 private: |
| 102 std::unique_ptr<SuccessCallback> m_successCallback; | 105 std::unique_ptr<SuccessCallback> m_successCallback; |
| 103 std::unique_ptr<FailureCallback> m_failureCallback; | 106 std::unique_ptr<FailureCallback> m_failureCallback; |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 ScriptPromise SetMediaKeysHandler::create(ScriptState* scriptState, HTMLMediaEle
ment& element, MediaKeys* mediaKeys) | 109 ScriptPromise SetMediaKeysHandler::create(ScriptState* scriptState, HTMLMediaEle
ment& element, MediaKeys* mediaKeys) |
| 107 { | 110 { |
| 108 SetMediaKeysHandler* handler = new SetMediaKeysHandler(scriptState, element,
mediaKeys); | 111 SetMediaKeysHandler* handler = new SetMediaKeysHandler(scriptState, element,
mediaKeys); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 411 } |
| 409 | 412 |
| 410 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) | 413 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) |
| 411 { | 414 { |
| 412 visitor->trace(m_mediaElement); | 415 visitor->trace(m_mediaElement); |
| 413 visitor->trace(m_mediaKeys); | 416 visitor->trace(m_mediaKeys); |
| 414 Supplement<HTMLMediaElement>::trace(visitor); | 417 Supplement<HTMLMediaElement>::trace(visitor); |
| 415 } | 418 } |
| 416 | 419 |
| 417 } // namespace blink | 420 } // namespace blink |
| OLD | NEW |