Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: Source/modules/encryptedmedia/MediaKeys.h

Issue 16387015: Make unprefixed EME APIs use platform and Chromium. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef MediaKeys_h 26 #ifndef MediaKeys_h
27 #define MediaKeys_h 27 #define MediaKeys_h
28 28
29 #if ENABLE(ENCRYPTED_MEDIA_V2) 29 #if ENABLE(ENCRYPTED_MEDIA_V2)
30 30
31 #include "bindings/v8/ScriptWrappable.h" 31 #include "bindings/v8/ScriptWrappable.h"
32 #include "core/dom/EventTarget.h" 32 #include "core/dom/EventTarget.h"
33 #include "core/dom/ExceptionCode.h" 33 #include "core/dom/ExceptionCode.h"
34 #include "modules/encryptedmedia/CDM.h"
35 #include "wtf/OwnPtr.h" 34 #include "wtf/OwnPtr.h"
36 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefCounted.h" 36 #include "wtf/RefCounted.h"
38 #include "wtf/Uint8Array.h" 37 #include "wtf/Uint8Array.h"
39 #include "wtf/Vector.h" 38 #include "wtf/Vector.h"
40 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
41 40
42 namespace WebCore { 41 namespace WebCore {
43 42
43 class CDM;
44 class MediaKeySession; 44 class MediaKeySession;
45 class HTMLMediaElement; 45 class HTMLMediaElement;
46 46
47 class MediaKeys : public RefCounted<MediaKeys>, public ScriptWrappable, public C DMClient { 47 // References are held by JS and HTMLMediaElement.
48 // The CDM has the same lifetime as this object.
49 // Maintains a reference to all MediaKeySessions created to ensure they live as
50 // long as this object unless explicitly close()'d.
51 class MediaKeys : public RefCounted<MediaKeys>, public ScriptWrappable {
48 public: 52 public:
49 static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionCode&) ; 53 static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionCode&) ;
50 ~MediaKeys(); 54 ~MediaKeys();
51 55
52 PassRefPtr<MediaKeySession> createSession(ScriptExecutionContext*, const Str ing& mimeType, Uint8Array* initData, ExceptionCode&); 56 PassRefPtr<MediaKeySession> createSession(ScriptExecutionContext*, const Str ing& mimeType, Uint8Array* initData, ExceptionCode&);
53 57
54 const String& keySystem() const { return m_keySystem; } 58 const String& keySystem() const { return m_keySystem; }
55 CDM* cdm() { return m_cdm.get(); }
56 59
57 HTMLMediaElement* mediaElement() const { return m_mediaElement; }
58 void setMediaElement(HTMLMediaElement*); 60 void setMediaElement(HTMLMediaElement*);
59 61
60 protected: 62 protected:
61 // CDMClient:
62 virtual MediaPlayer* cdmMediaPlayer(const CDM*) const OVERRIDE;
63
64 MediaKeys(const String& keySystem, PassOwnPtr<CDM>); 63 MediaKeys(const String& keySystem, PassOwnPtr<CDM>);
65 64
66 Vector<RefPtr<MediaKeySession> > m_sessions; 65 Vector<RefPtr<MediaKeySession> > m_sessions;
67 66
68 HTMLMediaElement* m_mediaElement; 67 HTMLMediaElement* m_mediaElement;
69 String m_keySystem; 68 const String m_keySystem;
70 OwnPtr<CDM> m_cdm; 69 OwnPtr<CDM> m_cdm;
71 }; 70 };
72 71
73 } 72 }
74 73
75 #endif // ENABLE(ENCRYPTED_MEDIA_V2) 74 #endif // ENABLE(ENCRYPTED_MEDIA_V2)
76 75
77 #endif // MediaKeys_h 76 #endif // MediaKeys_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698