Chromium Code Reviews| Index: Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h |
| diff --git a/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..878549ed85b85f0b8e2f9f07e3b4510210b910e2 |
| --- /dev/null |
| +++ b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NavigatorRequestMediaKeySystemAccess_h |
| +#define NavigatorRequestMediaKeySystemAccess_h |
| + |
| +#include "bindings/core/v8/Dictionary.h" |
| +#include "bindings/core/v8/ScriptPromise.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| +#include "core/frame/Navigator.h" |
| +#include "modules/encryptedmedia/MediaKeySystemOptions.h" |
| +#include "platform/Supplementable.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class NavigatorRequestMediaKeySystemAccess : public NoBaseWillBeGarbageCollected<NavigatorRequestMediaKeySystemAccess>, public WillBeHeapSupplement<Navigator> { |
| +public: |
| + virtual ~NavigatorRequestMediaKeySystemAccess(); |
| + |
| + static NavigatorRequestMediaKeySystemAccess& from(Navigator&); |
| + |
| + static ScriptPromise requestMediaKeySystemAccess( |
| + ScriptState*, |
| + Navigator&, |
| + const String& keySystem); |
| + static ScriptPromise requestMediaKeySystemAccess( |
| + ScriptState*, |
| + Navigator&, |
| + const String& keySystem, |
| + const Vector<MediaKeySystemOptions>& supportedConfigurations); |
| + |
| + ScriptPromise requestMediaKeySystemAccess( |
| + ScriptState*, |
| + const String& keySystem, |
| + const Vector<MediaKeySystemOptions>& supportedConfigurations); |
| + |
| + virtual void trace(Visitor*) override; |
| + |
| +private: |
| + NavigatorRequestMediaKeySystemAccess(); |
| + static const char* supplementName(); |
| +}; |
| + |
| +// This is needed to convert a JavaScript object into a MediaKeySystemOptions |
|
ddorwin
2014/10/23 18:02:31
nit: How about this?
... needed by the generated c
jrummell
2014/10/23 22:13:16
Done.
|
| +// object by the generated code for Navigator (when creating |
| +// Vector<MediaKeySystemOptions>). Since MediaKeySystemOptions is also |
| +// generated code, this is defined here so that it will be included by the |
| +// generated code. |
| +// |
| +// This needs to change if MediaKeySystemOptions.idl changes. |
| + |
| +MediaKeySystemOptions ConvertDictionaryIntoMediaKeySystemOptions(Dictionary&, ExceptionState&); |
| + |
| +template <> |
| +struct NativeValueTraits<MediaKeySystemOptions> { |
| + static inline MediaKeySystemOptions nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
| + { |
| + Dictionary dictionary(value, isolate); |
| + return ConvertDictionaryIntoMediaKeySystemOptions(dictionary, exceptionState); |
| + } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // NavigatorRequestMediaKeySystemAccess_h |