Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NavigatorRequestMediaKeySystemAccess_h | |
| 6 #define NavigatorRequestMediaKeySystemAccess_h | |
| 7 | |
| 8 #include "bindings/core/v8/Dictionary.h" | |
| 9 #include "bindings/core/v8/ScriptPromise.h" | |
| 10 #include "bindings/core/v8/V8Binding.h" | |
| 11 #include "core/frame/Navigator.h" | |
| 12 #include "modules/encryptedmedia/MediaKeySystemOptions.h" | |
| 13 #include "platform/Supplementable.h" | |
| 14 #include "platform/heap/Handle.h" | |
| 15 #include "wtf/text/WTFString.h" | |
| 16 | |
| 17 namespace blink { | |
| 18 | |
| 19 class NavigatorRequestMediaKeySystemAccess : public NoBaseWillBeGarbageCollected <NavigatorRequestMediaKeySystemAccess>, public WillBeHeapSupplement<Navigator> { | |
| 20 public: | |
| 21 virtual ~NavigatorRequestMediaKeySystemAccess(); | |
| 22 | |
| 23 static NavigatorRequestMediaKeySystemAccess& from(Navigator&); | |
| 24 | |
| 25 static ScriptPromise requestMediaKeySystemAccess(ScriptState*, Navigator&, c onst 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. :)
| |
| 26 static ScriptPromise requestMediaKeySystemAccess( | |
| 27 ScriptState*, | |
| 28 Navigator&, | |
| 29 const String& keySystem, | |
| 30 const Vector<MediaKeySystemOptions>& supportedConfigurations); | |
| 31 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.
| |
| 32 ScriptState*, | |
| 33 const String& keySystem, | |
| 34 const Vector<MediaKeySystemOptions>& supportedConfigurations); | |
| 35 | |
| 36 virtual void trace(Visitor*) override; | |
| 37 | |
| 38 private: | |
| 39 NavigatorRequestMediaKeySystemAccess(); | |
| 40 static const char* supplementName(); | |
| 41 }; | |
| 42 | |
| 43 // 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.
| |
| 44 // this template is needed to convert the JavaScript object into a | |
| 45 // 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.
| |
| 46 // 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.
| |
| 47 // changes. | |
| 48 template <> | |
| 49 struct NativeValueTraits<MediaKeySystemOptions> { | |
| 50 static MediaKeySystemOptions nativeValue(const v8::Handle<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | |
| 51 { | |
| 52 Dictionary dict(value, isolate); | |
| 53 MediaKeySystemOptions result; | |
| 54 String itemValue; | |
| 55 if (DictionaryHelper::get(dict, "initDataType", itemValue)) | |
| 56 result.setInitDataType(itemValue); | |
| 57 if (DictionaryHelper::get(dict, "audioType", itemValue)) | |
| 58 result.setAudioType(itemValue); | |
| 59 if (DictionaryHelper::get(dict, "audioCapability", itemValue)) | |
| 60 result.setAudioCapability(itemValue); | |
| 61 if (DictionaryHelper::get(dict, "videoType", itemValue)) | |
| 62 result.setVideoType(itemValue); | |
| 63 if (DictionaryHelper::get(dict, "videoCapability", itemValue)) | |
| 64 result.setVideoCapability(itemValue); | |
| 65 if (DictionaryHelper::get(dict, "uniqueidentifier", itemValue)) | |
| 66 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
| |
| 67 if (DictionaryHelper::get(dict, "stateful", itemValue)) | |
| 68 result.setStateful(itemValue); | |
| 69 return result; | |
| 70 } | |
| 71 }; | |
| 72 | |
| 73 } // namespace blink | |
| 74 | |
| 75 #endif // NavigatorRequestMediaKeySystemAccess_h | |
| OLD | NEW |