OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 15 matching lines...) Expand all Loading... |
26 #ifndef MediaKeys_h | 26 #ifndef MediaKeys_h |
27 #define MediaKeys_h | 27 #define MediaKeys_h |
28 | 28 |
29 #include "bindings/core/v8/ScriptPromise.h" | 29 #include "bindings/core/v8/ScriptPromise.h" |
30 #include "bindings/core/v8/ScriptWrappable.h" | 30 #include "bindings/core/v8/ScriptWrappable.h" |
31 #include "core/dom/ContextLifecycleObserver.h" | 31 #include "core/dom/ContextLifecycleObserver.h" |
32 #include "wtf/Forward.h" | 32 #include "wtf/Forward.h" |
33 #include "wtf/text/WTFString.h" | 33 #include "wtf/text/WTFString.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 class WebContentDecryptionModule; | |
37 } | |
38 | |
39 namespace blink { | |
40 | 36 |
41 class ExceptionState; | 37 class ExceptionState; |
42 class ExecutionContext; | 38 class ExecutionContext; |
43 class HTMLMediaElement; | 39 class HTMLMediaElement; |
44 class ScriptState; | 40 class ScriptState; |
| 41 class WebContentDecryptionModule; |
45 | 42 |
46 // References are held by JS and HTMLMediaElement. | 43 // References are held by JS and HTMLMediaElement. |
47 // The WebContentDecryptionModule has the same lifetime as this object. | 44 // The WebContentDecryptionModule has the same lifetime as this object. |
48 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { | 45 class MediaKeys : public GarbageCollectedFinalized<MediaKeys>, public ContextLif
ecycleObserver, public ScriptWrappable { |
| 46 DEFINE_WRAPPERTYPEINFO(); |
49 public: | 47 public: |
50 static ScriptPromise create(ScriptState*, const String& keySystem); | 48 static ScriptPromise create(ScriptState*, const String& keySystem); |
51 virtual ~MediaKeys(); | 49 virtual ~MediaKeys(); |
52 | 50 |
53 const String& keySystem() const { return m_keySystem; } | 51 const String& keySystem() const { return m_keySystem; } |
54 | 52 |
55 ScriptPromise createSession(ScriptState*, const String& initDataType, ArrayB
uffer* initData, const String& sessionType); | 53 ScriptPromise createSession(ScriptState*, const String& initDataType, ArrayB
uffer* initData, const String& sessionType); |
56 ScriptPromise createSession(ScriptState*, const String& initDataType, ArrayB
ufferView* initData, const String& sessionType); | 54 ScriptPromise createSession(ScriptState*, const String& initDataType, ArrayB
ufferView* initData, const String& sessionType); |
57 | 55 |
58 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); | 56 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); |
59 | 57 |
60 blink::WebContentDecryptionModule* contentDecryptionModule(); | 58 blink::WebContentDecryptionModule* contentDecryptionModule(); |
61 | 59 |
62 void trace(Visitor*); | 60 void trace(Visitor*); |
63 | 61 |
64 // ContextLifecycleObserver | 62 // ContextLifecycleObserver |
65 virtual void contextDestroyed() OVERRIDE; | 63 virtual void contextDestroyed() OVERRIDE; |
66 | 64 |
67 private: | 65 private: |
68 friend class MediaKeysInitializer; | 66 friend class MediaKeysInitializer; |
69 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); | 67 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); |
70 | 68 |
71 ScriptPromise createSessionInternal(ScriptState*, const String& initDataType
, PassRefPtr<ArrayBuffer> initData, const String& sessionType); | 69 ScriptPromise createSessionInternal(ScriptState*, const String& initDataType
, PassRefPtr<ArrayBuffer> initData, const String& sessionType); |
72 | 70 |
73 const String m_keySystem; | 71 const String m_keySystem; |
74 OwnPtr<blink::WebContentDecryptionModule> m_cdm; | 72 OwnPtr<blink::WebContentDecryptionModule> m_cdm; |
75 }; | 73 }; |
76 | 74 |
77 } | 75 } // namespace blink |
78 | 76 |
79 #endif // MediaKeys_h | 77 #endif // MediaKeys_h |
OLD | NEW |