| 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/NavigatorRequestMediaKeySystemAccess.h" | 6 #include "modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| 11 #include "core/dom/ExceptionCode.h" | 11 #include "core/dom/ExceptionCode.h" |
| 12 #include "modules/encryptedmedia/MediaKeySystemAccess.h" | 12 #include "modules/encryptedmedia/MediaKeySystemAccess.h" |
| 13 #include "platform/ContentType.h" | 13 #include "platform/ContentType.h" |
| 14 #include "platform/Logging.h" | 14 #include "platform/Logging.h" |
| 15 #include "platform/MIMETypeRegistry.h" | 15 #include "platform/MIMETypeRegistry.h" |
| 16 #include "platform/heap/Handle.h" |
| 16 #include "wtf/text/WTFString.h" | 17 #include "wtf/text/WTFString.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) | 21 static bool isKeySystemSupportedWithContentType(const String& keySystem, const S
tring& contentType) |
| 21 { | 22 { |
| 22 ASSERT(!keySystem.isEmpty()); | 23 ASSERT(!keySystem.isEmpty()); |
| 23 | 24 |
| 24 blink::ContentType type(contentType); | 25 blink::ContentType type(contentType); |
| 25 String codecs = type.parameter("codecs"); | 26 String codecs = type.parameter("codecs"); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 MediaKeySystemAccessInitializer(blink::ScriptState*, const String& keySystem
, const Vector<blink::MediaKeySystemConfiguration>& supportedConfigurations); | 40 MediaKeySystemAccessInitializer(blink::ScriptState*, const String& keySystem
, const Vector<blink::MediaKeySystemConfiguration>& supportedConfigurations); |
| 40 void timerFired(blink::Timer<MediaKeySystemAccessInitializer>*); | 41 void timerFired(blink::Timer<MediaKeySystemAccessInitializer>*); |
| 41 | 42 |
| 42 const String m_keySystem; | 43 const String m_keySystem; |
| 43 const Vector<blink::MediaKeySystemConfiguration> m_supportedConfigurations; | 44 const Vector<blink::MediaKeySystemConfiguration> m_supportedConfigurations; |
| 44 blink::Timer<MediaKeySystemAccessInitializer> m_timer; | 45 blink::Timer<MediaKeySystemAccessInitializer> m_timer; |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 blink::ScriptPromise MediaKeySystemAccessInitializer::create(blink::ScriptState*
scriptState, const String& keySystem, const Vector<blink::MediaKeySystemConfigu
ration>& supportedConfigurations) | 48 blink::ScriptPromise MediaKeySystemAccessInitializer::create(blink::ScriptState*
scriptState, const String& keySystem, const Vector<blink::MediaKeySystemConfigu
ration>& supportedConfigurations) |
| 48 { | 49 { |
| 49 RefPtr<MediaKeySystemAccessInitializer> initializer = adoptRef(new MediaKeyS
ystemAccessInitializer(scriptState, keySystem, supportedConfigurations)); | 50 RefPtrWillBeRawPtr<MediaKeySystemAccessInitializer> initializer = blink::ado
ptRefWillBeNoop(new MediaKeySystemAccessInitializer(scriptState, keySystem, supp
ortedConfigurations)); |
| 50 initializer->suspendIfNeeded(); | 51 initializer->suspendIfNeeded(); |
| 51 initializer->keepAliveWhilePending(); | 52 initializer->keepAliveWhilePending(); |
| 52 return initializer->promise(); | 53 return initializer->promise(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 MediaKeySystemAccessInitializer::MediaKeySystemAccessInitializer(blink::ScriptSt
ate* scriptState, const String& keySystem, const Vector<blink::MediaKeySystemCon
figuration>& supportedConfigurations) | 56 MediaKeySystemAccessInitializer::MediaKeySystemAccessInitializer(blink::ScriptSt
ate* scriptState, const String& keySystem, const Vector<blink::MediaKeySystemCon
figuration>& supportedConfigurations) |
| 56 : blink::ScriptPromiseResolver(scriptState) | 57 : blink::ScriptPromiseResolver(scriptState) |
| 57 , m_keySystem(keySystem) | 58 , m_keySystem(keySystem) |
| 58 , m_supportedConfigurations(supportedConfigurations) | 59 , m_supportedConfigurations(supportedConfigurations) |
| 59 , m_timer(this, &MediaKeySystemAccessInitializer::timerFired) | 60 , m_timer(this, &MediaKeySystemAccessInitializer::timerFired) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 { | 222 { |
| 222 return "RequestMediaKeySystemAccess"; | 223 return "RequestMediaKeySystemAccess"; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void NavigatorRequestMediaKeySystemAccess::trace(Visitor* visitor) | 226 void NavigatorRequestMediaKeySystemAccess::trace(Visitor* visitor) |
| 226 { | 227 { |
| 227 WillBeHeapSupplement<Navigator>::trace(visitor); | 228 WillBeHeapSupplement<Navigator>::trace(visitor); |
| 228 } | 229 } |
| 229 | 230 |
| 230 } // namespace blink | 231 } // namespace blink |
| OLD | NEW |