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..2fa7cb497a49e8f1a1a2616d71ef91b795d36144 |
--- /dev/null |
+++ b/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.h |
@@ -0,0 +1,75 @@ |
+// 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" |
+#include "wtf/text/WTFString.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); |
ddorwin
2014/10/22 22:18:55
nit: For consistency with the override below, plea
jrummell
2014/10/23 01:20:03
Done.
ddorwin
2014/10/23 18:02:30
s/override/overload/, but you got the idea. :)
|
+ static ScriptPromise requestMediaKeySystemAccess( |
+ ScriptState*, |
+ Navigator&, |
+ const String& keySystem, |
+ const Vector<MediaKeySystemOptions>& supportedConfigurations); |
+ ScriptPromise requestMediaKeySystemAccess( |
ddorwin
2014/10/22 22:18:54
I think we should probably have a different name r
jrummell
2014/10/23 01:20:03
This appears to be a standard pattern for Navigato
ddorwin
2014/10/23 18:02:30
Acknowledged.
|
+ ScriptState*, |
+ const String& keySystem, |
+ const Vector<MediaKeySystemOptions>& supportedConfigurations); |
+ |
+ virtual void trace(Visitor*) override; |
+ |
+private: |
+ NavigatorRequestMediaKeySystemAccess(); |
+ static const char* supplementName(); |
+}; |
+ |
+// For the generated code for Navigator to make a Vector<MediaKeySystemOptions> |
ddorwin
2014/10/22 22:18:55
nit: This is a bit hard to read. At least add a co
jrummell
2014/10/23 01:20:03
Done.
|
+// this template is needed to convert the JavaScript object into a |
+// MediaKeySystemOptions. MediaKeySystemOptions is also generated code, so |
ddorwin
2014/10/22 22:18:54
nit: Since MediaKeySystemOptions is also generated
jrummell
2014/10/23 01:20:03
Done.
|
+// including the code here. This needs to change if MediaKeySystemOptions.idl |
ddorwin
2014/10/22 22:18:55
The need to change this should be called out - pro
jrummell
2014/10/23 01:20:03
Done.
|
+// changes. |
+template <> |
+struct NativeValueTraits<MediaKeySystemOptions> { |
+ static MediaKeySystemOptions nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
+ { |
+ Dictionary dict(value, isolate); |
+ MediaKeySystemOptions result; |
+ String itemValue; |
+ if (DictionaryHelper::get(dict, "initDataType", itemValue)) |
+ result.setInitDataType(itemValue); |
+ if (DictionaryHelper::get(dict, "audioType", itemValue)) |
+ result.setAudioType(itemValue); |
+ if (DictionaryHelper::get(dict, "audioCapability", itemValue)) |
+ result.setAudioCapability(itemValue); |
+ if (DictionaryHelper::get(dict, "videoType", itemValue)) |
+ result.setVideoType(itemValue); |
+ if (DictionaryHelper::get(dict, "videoCapability", itemValue)) |
+ result.setVideoCapability(itemValue); |
+ if (DictionaryHelper::get(dict, "uniqueidentifier", itemValue)) |
+ result.setUniqueidentifier(itemValue); |
ddorwin
2014/10/22 22:18:54
Web IDL question: What is supposed to happen if an
jrummell
2014/10/23 01:20:03
Generated code for MediaKeySystemOptions has all f
|
+ if (DictionaryHelper::get(dict, "stateful", itemValue)) |
+ result.setStateful(itemValue); |
+ return result; |
+ } |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // NavigatorRequestMediaKeySystemAccess_h |