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/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h"
13 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
17 class WebSecurityOrigin;
27 class CdmSessionAdapter;
28 class WebContentDecryptionModuleSessionImpl;
30 class WebContentDecryptionModuleImpl
31 : public blink::WebContentDecryptionModule {
33 static WebContentDecryptionModuleImpl* Create(
34 blink::WebLocalFrame* frame,
35 const blink::WebSecurityOrigin& security_origin,
36 const base::string16& key_system);
38 virtual ~WebContentDecryptionModuleImpl();
40 // Returns the Decryptor associated with this CDM. May be NULL if no
41 // Decryptor associated with the MediaKeys object.
42 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor
43 // after WebContentDecryptionModule is freed. http://crbug.com/330324
44 media::Decryptor* GetDecryptor();
46 #if defined(OS_ANDROID)
47 // Returns the CDM ID associated with this object. May be kInvalidCdmId if no
48 // CDM ID is associated, such as when Clear Key is used.
50 #endif // defined(OS_ANDROID)
52 // blink::WebContentDecryptionModule implementation.
53 virtual blink::WebContentDecryptionModuleSession* createSession(
54 blink::WebContentDecryptionModuleSession::Client* client);
57 // Takes reference to |adapter|.
58 WebContentDecryptionModuleImpl(scoped_refptr<CdmSessionAdapter> adapter);
60 scoped_refptr<CdmSessionAdapter> adapter_;
62 DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleImpl);
65 // Allow typecasting from blink type as this is the only implementation.
66 inline WebContentDecryptionModuleImpl* ToWebContentDecryptionModuleImpl(
67 blink::WebContentDecryptionModule* cdm) {
68 return static_cast<WebContentDecryptionModuleImpl*>(cdm);
71 } // namespace content
73 #endif // CONTENT_RENDERER_MEDIA_WEBCONTENTDECRYPTIONMODULE_IMPL_H_