1 // Copyright 2013 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.
5 #ifndef CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string16.h"
12 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
21 class WebContentDecryptionModuleSessionImpl
;
22 class SessionIdAdapter
;
24 class WebContentDecryptionModuleImpl
25 : public blink::WebContentDecryptionModule
{
27 static WebContentDecryptionModuleImpl
* Create(
28 const base::string16
& key_system
);
30 virtual ~WebContentDecryptionModuleImpl();
32 // Returns the Decryptor associated with this CDM. May be NULL if no
33 // Decryptor associated with the MediaKeys object.
34 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor
35 // after WebContentDecryptionModule is freed. http://crbug.com/330324
36 media::Decryptor
* GetDecryptor();
38 // blink::WebContentDecryptionModule implementation.
39 virtual blink::WebContentDecryptionModuleSession
* createSession(
40 blink::WebContentDecryptionModuleSession::Client
* client
);
43 // Takes ownership of |media_keys| and |adapter|.
44 WebContentDecryptionModuleImpl(scoped_ptr
<media::MediaKeys
> media_keys
,
45 scoped_ptr
<SessionIdAdapter
> adapter
);
47 // Called when a WebContentDecryptionModuleSessionImpl is closed.
48 void OnSessionClosed(uint32 session_id
);
50 scoped_ptr
<media::MediaKeys
> media_keys_
;
51 scoped_ptr
<SessionIdAdapter
> adapter_
;
53 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl
);
56 // Allow typecasting from blink type as this is the only implementation.
57 inline WebContentDecryptionModuleImpl
* ToWebContentDecryptionModuleImpl(
58 blink::WebContentDecryptionModule
* cdm
) {
59 return static_cast<WebContentDecryptionModuleImpl
*>(cdm
);
62 } // namespace content
64 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_