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 29 matching lines...) Expand all Loading... |
40 #include "wtf/Uint8Array.h" | 40 #include "wtf/Uint8Array.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 class WebContentDecryptionModule; | 45 class WebContentDecryptionModule; |
46 } | 46 } |
47 | 47 |
48 namespace WebCore { | 48 namespace WebCore { |
49 | 49 |
50 class ContentDecryptionModule; | |
51 class HTMLMediaElement; | 50 class HTMLMediaElement; |
52 class ExceptionState; | 51 class ExceptionState; |
53 | 52 |
54 // References are held by JS and HTMLMediaElement. | 53 // References are held by JS and HTMLMediaElement. |
55 // The ContentDecryptionModule has the same lifetime as this object. | 54 // The WebContentDecryptionModule has the same lifetime as this object. |
56 class MediaKeys : public RefCountedWillBeGarbageCollectedFinalized<MediaKeys>, p
ublic ContextLifecycleObserver, public ScriptWrappable { | 55 class MediaKeys : public RefCountedWillBeGarbageCollectedFinalized<MediaKeys>, p
ublic ContextLifecycleObserver, public ScriptWrappable { |
57 public: | 56 public: |
58 static PassRefPtrWillBeRawPtr<MediaKeys> create(ExecutionContext*, const Str
ing& keySystem, ExceptionState&); | 57 static PassRefPtrWillBeRawPtr<MediaKeys> create(ExecutionContext*, const Str
ing& keySystem, ExceptionState&); |
59 ~MediaKeys(); | 58 ~MediaKeys(); |
60 | 59 |
61 const String& keySystem() const { return m_keySystem; } | 60 const String& keySystem() const { return m_keySystem; } |
62 | 61 |
63 PassRefPtrWillBeRawPtr<MediaKeySession> createSession(ExecutionContext*, con
st String& contentType, Uint8Array* initData, ExceptionState&); | 62 PassRefPtrWillBeRawPtr<MediaKeySession> createSession(ExecutionContext*, con
st String& contentType, Uint8Array* initData, ExceptionState&); |
64 | 63 |
65 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); | 64 static bool isTypeSupported(const String& keySystem, const String& contentTy
pe); |
66 | 65 |
67 void setMediaElement(HTMLMediaElement*); | 66 void setMediaElement(HTMLMediaElement*); |
68 | 67 |
69 blink::WebContentDecryptionModule* contentDecryptionModule(); | 68 blink::WebContentDecryptionModule* contentDecryptionModule(); |
70 | 69 |
71 void trace(Visitor*); | 70 void trace(Visitor*); |
72 | 71 |
73 // ContextLifecycleObserver | 72 // ContextLifecycleObserver |
74 virtual void contextDestroyed() OVERRIDE; | 73 virtual void contextDestroyed() OVERRIDE; |
75 | 74 |
76 protected: | 75 protected: |
77 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<ContentDecr
yptionModule>); | 76 MediaKeys(ExecutionContext*, const String& keySystem, PassOwnPtr<blink::WebC
ontentDecryptionModule>); |
78 void initializeNewSessionTimerFired(Timer<MediaKeys>*); | 77 void initializeNewSessionTimerFired(Timer<MediaKeys>*); |
79 | 78 |
80 HTMLMediaElement* m_mediaElement; | 79 HTMLMediaElement* m_mediaElement; |
81 const String m_keySystem; | 80 const String m_keySystem; |
82 OwnPtr<ContentDecryptionModule> m_cdm; | 81 OwnPtr<blink::WebContentDecryptionModule> m_cdm; |
83 | 82 |
84 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. | 83 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. |
85 struct InitializeNewSessionData { | 84 struct InitializeNewSessionData { |
86 InitializeNewSessionData(PassRefPtrWillBeRawPtr<MediaKeySession> session
, const String& contentType, PassRefPtr<Uint8Array> initData) | 85 InitializeNewSessionData(PassRefPtrWillBeRawPtr<MediaKeySession> session
, const String& contentType, PassRefPtr<Uint8Array> initData) |
87 : session(session) | 86 : session(session) |
88 , contentType(contentType) | 87 , contentType(contentType) |
89 , initData(initData) { } | 88 , initData(initData) { } |
90 | 89 |
91 void trace(Visitor*); | 90 void trace(Visitor*); |
92 | 91 |
93 RefPtrWillBeMember<MediaKeySession> session; | 92 RefPtrWillBeMember<MediaKeySession> session; |
94 String contentType; | 93 String contentType; |
95 RefPtr<Uint8Array> initData; | 94 RefPtr<Uint8Array> initData; |
96 }; | 95 }; |
97 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | 96 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; |
98 Timer<MediaKeys> m_initializeNewSessionTimer; | 97 Timer<MediaKeys> m_initializeNewSessionTimer; |
99 | 98 |
100 WeakPtrFactory<MediaKeys> m_weakFactory; | 99 WeakPtrFactory<MediaKeys> m_weakFactory; |
101 }; | 100 }; |
102 | 101 |
103 } | 102 } |
104 | 103 |
105 #endif // MediaKeys_h | 104 #endif // MediaKeys_h |
OLD | NEW |