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..f180165f32b30af18761a15ecd107d02bea0e3bc |
| --- /dev/null |
| +++ b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h |
| @@ -0,0 +1,61 @@ |
| +// 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> { |
|
haraken
2014/10/24 01:06:42
Add final.
jrummell
2014/10/24 22:43:22
Done.
|
| +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 by the generated code for Navigator to convert a JavaScript |
| +// object into a MediaKeySystemOptions object. |
| +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); |
|
bashi
2014/10/24 01:15:15
You can remove ConvertDictionaryIntoMediaKeySystem
jrummell
2014/10/24 22:43:22
Great. It even does the enum value checking.
|
| + return ConvertDictionaryIntoMediaKeySystemOptions(dictionary, exceptionState); |
| + } |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // NavigatorRequestMediaKeySystemAccess_h |