Remove INJECT_EVENTS permissions from test APKs.
[chromium-blink-merge.git] / media / blink / webcontentdecryptionmodule_impl.h
blobfefc1db6171d42ba49997f0255dd92228ef7c175
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 MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
6 #define MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h"
11 #include "media/base/media_export.h"
12 #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
13 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h"
15 namespace blink {
16 #if defined(ENABLE_PEPPER_CDMS)
17 class WebLocalFrame;
18 #endif
19 class WebSecurityOrigin;
22 namespace media {
24 struct CdmConfig;
25 class CdmContext;
26 class CdmFactory;
27 class CdmSessionAdapter;
28 class WebContentDecryptionModuleSessionImpl;
30 class MEDIA_EXPORT WebContentDecryptionModuleImpl
31 : public blink::WebContentDecryptionModule {
32 public:
33 static void Create(CdmFactory* cdm_factory,
34 const base::string16& key_system,
35 const blink::WebSecurityOrigin& security_origin,
36 const CdmConfig& cdm_config,
37 blink::WebContentDecryptionModuleResult result);
39 virtual ~WebContentDecryptionModuleImpl();
41 // blink::WebContentDecryptionModule implementation.
42 virtual blink::WebContentDecryptionModuleSession* createSession();
44 virtual void setServerCertificate(
45 const uint8* server_certificate,
46 size_t server_certificate_length,
47 blink::WebContentDecryptionModuleResult result);
49 // Returns the CdmContext associated with this CDM, which must not be nullptr.
50 // TODO(jrummell): Figure out lifetimes, as WMPI may still use the decryptor
51 // after WebContentDecryptionModule is freed. http://crbug.com/330324
52 CdmContext* GetCdmContext();
54 private:
55 friend CdmSessionAdapter;
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 media
73 #endif // MEDIA_BLINK_WEBCONTENTDECRYPTIONMODULE_IMPL_H_