| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" | 6 #include "modules/encryptedmedia/HTMLMediaElementEncryptedMedia.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 // This class allows MediaKeys to be set asynchronously. | 49 // This class allows MediaKeys to be set asynchronously. |
| 50 class SetMediaKeysHandler : public ScriptPromiseResolver { | 50 class SetMediaKeysHandler : public ScriptPromiseResolver { |
| 51 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler); | 51 WTF_MAKE_NONCOPYABLE(SetMediaKeysHandler); |
| 52 | 52 |
| 53 public: | 53 public: |
| 54 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*); | 54 static ScriptPromise create(ScriptState*, HTMLMediaElement&, MediaKeys*); |
| 55 virtual ~SetMediaKeysHandler(); | 55 virtual ~SetMediaKeysHandler(); |
| 56 | 56 |
| 57 virtual void trace(Visitor*) override; | 57 DECLARE_VIRTUAL_TRACE(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 SetMediaKeysHandler(ScriptState*, HTMLMediaElement&, MediaKeys*); | 60 SetMediaKeysHandler(ScriptState*, HTMLMediaElement&, MediaKeys*); |
| 61 void timerFired(Timer<SetMediaKeysHandler>*); | 61 void timerFired(Timer<SetMediaKeysHandler>*); |
| 62 | 62 |
| 63 void clearExistingMediaKeys(); | 63 void clearExistingMediaKeys(); |
| 64 void setNewMediaKeys(); | 64 void setNewMediaKeys(); |
| 65 void finish(); | 65 void finish(); |
| 66 | 66 |
| 67 void reportSetFailed(ExceptionCode, const String& errorMessage); | 67 void reportSetFailed(ExceptionCode, const String& errorMessage); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 // 3.3.2 If the preceding step failed, run the following steps: | 233 // 3.3.2 If the preceding step failed, run the following steps: |
| 234 // 3.3.2.1 Set the mediaKeys attribute to null. | 234 // 3.3.2.1 Set the mediaKeys attribute to null. |
| 235 thisElement.m_mediaKeys.clear(); | 235 thisElement.m_mediaKeys.clear(); |
| 236 | 236 |
| 237 // 3.3.2.2 Reject promise with a new DOMException whose name is the | 237 // 3.3.2.2 Reject promise with a new DOMException whose name is the |
| 238 // appropriate error name and that has an appropriate message. | 238 // appropriate error name and that has an appropriate message. |
| 239 reject(DOMException::create(code, errorMessage)); | 239 reject(DOMException::create(code, errorMessage)); |
| 240 } | 240 } |
| 241 | 241 |
| 242 void SetMediaKeysHandler::trace(Visitor* visitor) | 242 DEFINE_TRACE(SetMediaKeysHandler) |
| 243 { | 243 { |
| 244 visitor->trace(m_element); | 244 visitor->trace(m_element); |
| 245 visitor->trace(m_newMediaKeys); | 245 visitor->trace(m_newMediaKeys); |
| 246 ScriptPromiseResolver::trace(visitor); | 246 ScriptPromiseResolver::trace(visitor); |
| 247 } | 247 } |
| 248 | 248 |
| 249 HTMLMediaElementEncryptedMedia::HTMLMediaElementEncryptedMedia() | 249 HTMLMediaElementEncryptedMedia::HTMLMediaElementEncryptedMedia() |
| 250 : m_emeMode(EmeModeNotSelected) | 250 : m_emeMode(EmeModeNotSelected) |
| 251 , m_isWaitingForKey(false) | 251 , m_isWaitingForKey(false) |
| 252 { | 252 { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 ASSERT(thisElement.m_emeMode == EmeModeUnprefixed); | 590 ASSERT(thisElement.m_emeMode == EmeModeUnprefixed); |
| 591 thisElement.m_mediaKeys.clear(); | 591 thisElement.m_mediaKeys.clear(); |
| 592 } | 592 } |
| 593 | 593 |
| 594 WebContentDecryptionModule* HTMLMediaElementEncryptedMedia::contentDecryptionMod
ule(HTMLMediaElement& element) | 594 WebContentDecryptionModule* HTMLMediaElementEncryptedMedia::contentDecryptionMod
ule(HTMLMediaElement& element) |
| 595 { | 595 { |
| 596 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia
::from(element); | 596 HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia
::from(element); |
| 597 return thisElement.contentDecryptionModule(); | 597 return thisElement.contentDecryptionModule(); |
| 598 } | 598 } |
| 599 | 599 |
| 600 void HTMLMediaElementEncryptedMedia::trace(Visitor* visitor) | 600 DEFINE_TRACE(HTMLMediaElementEncryptedMedia) |
| 601 { | 601 { |
| 602 visitor->trace(m_mediaKeys); | 602 visitor->trace(m_mediaKeys); |
| 603 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); | 603 WillBeHeapSupplement<HTMLMediaElement>::trace(visitor); |
| 604 } | 604 } |
| 605 | 605 |
| 606 } // namespace blink | 606 } // namespace blink |
| OLD | NEW |