| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void setError(MediaKeyError*); | 64 void setError(MediaKeyError*); |
| 65 MediaKeyError* error() { return m_error.get(); } | 65 MediaKeyError* error() { return m_error.get(); } |
| 66 | 66 |
| 67 void initializeNewSession(const String& mimeType, Uint8Array* initData); | 67 void initializeNewSession(const String& mimeType, Uint8Array* initData); |
| 68 void update(Uint8Array* response, ExceptionState&); | 68 void update(Uint8Array* response, ExceptionState&); |
| 69 void release(ExceptionState&); | 69 void release(ExceptionState&); |
| 70 | 70 |
| 71 void enqueueEvent(PassRefPtr<Event>); | 71 void enqueueEvent(PassRefPtr<Event>); |
| 72 | 72 |
| 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyadded); | |
| 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeyerror); | |
| 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(webkitkeymessage); | |
| 76 | |
| 77 virtual const AtomicString& interfaceName() const OVERRIDE; | 73 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 78 virtual ExecutionContext* executionContext() const OVERRIDE; | 74 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 79 | 75 |
| 80 private: | 76 private: |
| 81 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); | 77 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); |
| 82 void initializeNewSessionTimerFired(Timer<MediaKeySession>*); | 78 void initializeNewSessionTimerFired(Timer<MediaKeySession>*); |
| 83 void updateTimerFired(Timer<MediaKeySession>*); | 79 void updateTimerFired(Timer<MediaKeySession>*); |
| 84 | 80 |
| 85 // ContentDecryptionModuleSessionClient | 81 // ContentDecryptionModuleSessionClient |
| 86 virtual void keyAdded() OVERRIDE; | 82 virtual void message(const unsigned char* message, size_t messageLength, con
st KURL& destinationURL) OVERRIDE; |
| 87 virtual void keyError(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 83 virtual void ready() OVERRIDE; |
| 88 virtual void keyMessage(const unsigned char* message, size_t messageLength,
const KURL& destinationURL) OVERRIDE; | 84 virtual void close() OVERRIDE; |
| 85 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
| 89 | 86 |
| 90 String m_keySystem; | 87 String m_keySystem; |
| 91 RefPtr<MediaKeyError> m_error; | 88 RefPtr<MediaKeyError> m_error; |
| 92 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 89 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 93 OwnPtr<ContentDecryptionModuleSession> m_session; | 90 OwnPtr<ContentDecryptionModuleSession> m_session; |
| 94 // Used to remove the reference from the parent MediaKeys when close()'d. | 91 // Used to remove the reference from the parent MediaKeys when close()'d. |
| 95 MediaKeys* m_keys; | 92 MediaKeys* m_keys; |
| 96 | 93 |
| 97 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. | 94 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not
pass it as a pointer. |
| 98 // FIXME: Move the queue and timer to MediaKeys. | 95 // FIXME: Move the queue and timer to MediaKeys. |
| 99 struct InitializeNewSessionData { | 96 struct InitializeNewSessionData { |
| 100 InitializeNewSessionData(const String& mimeType, Uint8Array* initData) :
mimeType(mimeType), initData(initData) { } | 97 InitializeNewSessionData(const String& mimeType, Uint8Array* initData) :
mimeType(mimeType), initData(initData) { } |
| 101 String mimeType; | 98 String mimeType; |
| 102 RefPtr<Uint8Array> initData; | 99 RefPtr<Uint8Array> initData; |
| 103 }; | 100 }; |
| 104 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | 101 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; |
| 105 Timer<MediaKeySession> m_initializeNewSessionTimer; | 102 Timer<MediaKeySession> m_initializeNewSessionTimer; |
| 106 | 103 |
| 107 Deque<RefPtr<Uint8Array> > m_pendingKeys; | 104 Deque<RefPtr<Uint8Array> > m_pendingKeys; |
| 108 Timer<MediaKeySession> m_updateTimer; | 105 Timer<MediaKeySession> m_updateTimer; |
| 109 }; | 106 }; |
| 110 | 107 |
| 111 } | 108 } |
| 112 | 109 |
| 113 #endif // MediaKeySession_h | 110 #endif // MediaKeySession_h |
| OLD | NEW |