| 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 // 1. If mediaKeys and the mediaKeys attribute are the same object, | 347 // 1. If mediaKeys and the mediaKeys attribute are the same object, |
| 348 // return a resolved promise. | 348 // return a resolved promise. |
| 349 if (thisElement.m_mediaKeys == mediaKeys) | 349 if (thisElement.m_mediaKeys == mediaKeys) |
| 350 return ScriptPromise::castUndefined(scriptState); | 350 return ScriptPromise::castUndefined(scriptState); |
| 351 | 351 |
| 352 // 2. If this object's attaching media keys value is true, return a | 352 // 2. If this object's attaching media keys value is true, return a |
| 353 // promise rejected with an InvalidStateError. | 353 // promise rejected with an InvalidStateError. |
| 354 if (thisElement.m_isAttachingMediaKeys) { | 354 if (thisElement.m_isAttachingMediaKeys) { |
| 355 return ScriptPromise::rejectWithDOMException( | 355 return ScriptPromise::rejectWithDOMException( |
| 356 scriptState, DOMException::create(InvalidStateError, | 356 scriptState, |
| 357 "Another request is in progress.")); | 357 DOMException::create(InvalidStateError, |
| 358 "Another request is in progress.")); |
| 358 } | 359 } |
| 359 | 360 |
| 360 // 3. Let this object's attaching media keys value be true. | 361 // 3. Let this object's attaching media keys value be true. |
| 361 thisElement.m_isAttachingMediaKeys = true; | 362 thisElement.m_isAttachingMediaKeys = true; |
| 362 | 363 |
| 363 // 4. Let promise be a new promise. Remaining steps done in handler. | 364 // 4. Let promise be a new promise. Remaining steps done in handler. |
| 364 return SetMediaKeysHandler::create(scriptState, element, mediaKeys); | 365 return SetMediaKeysHandler::create(scriptState, element, mediaKeys); |
| 365 } | 366 } |
| 366 | 367 |
| 367 // Create a MediaEncryptedEvent for WD EME. | 368 // Create a MediaEncryptedEvent for WD EME. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 return m_mediaKeys ? m_mediaKeys->contentDecryptionModule() : 0; | 438 return m_mediaKeys ? m_mediaKeys->contentDecryptionModule() : 0; |
| 438 } | 439 } |
| 439 | 440 |
| 440 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) { | 441 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) { |
| 441 visitor->trace(m_mediaElement); | 442 visitor->trace(m_mediaElement); |
| 442 visitor->trace(m_mediaKeys); | 443 visitor->trace(m_mediaKeys); |
| 443 Supplement<HTMLMediaElement>::trace(visitor); | 444 Supplement<HTMLMediaElement>::trace(visitor); |
| 444 } | 445 } |
| 445 | 446 |
| 446 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |