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_CRYPTO_RENDER_CDM_FACTORY_H_
6 #define CONTENT_RENDERER_MEDIA_CRYPTO_RENDER_CDM_FACTORY_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/thread_checker.h"
12 #include "media/base/cdm_factory.h"
13 #include "media/base/media_keys.h"
15 #if defined(ENABLE_PEPPER_CDMS)
16 #include "content/renderer/media/crypto/pepper_cdm_wrapper.h"
27 #if defined(ENABLE_BROWSER_CDMS)
28 class RendererCdmManager
;
31 // CdmFactory implementation in content/renderer. This class is not thread safe
32 // and should only be used on one thread.
33 class RenderCdmFactory
: public media::CdmFactory
{
35 #if defined(ENABLE_PEPPER_CDMS)
36 explicit RenderCdmFactory(const CreatePepperCdmCB
& create_pepper_cdm_cb
);
37 #elif defined(ENABLE_BROWSER_CDMS)
38 explicit RenderCdmFactory(RendererCdmManager
* manager
);
41 #endif // defined(ENABLE_PEPPER_CDMS)
43 ~RenderCdmFactory() override
;
45 // CdmFactory implementation.
47 const std::string
& key_system
,
48 const GURL
& security_origin
,
49 const media::CdmConfig
& cdm_config
,
50 const media::SessionMessageCB
& session_message_cb
,
51 const media::SessionClosedCB
& session_closed_cb
,
52 const media::LegacySessionErrorCB
& legacy_session_error_cb
,
53 const media::SessionKeysChangeCB
& session_keys_change_cb
,
54 const media::SessionExpirationUpdateCB
& session_expiration_update_cb
,
55 const media::CdmCreatedCB
& cdm_created_cb
) override
;
58 #if defined(ENABLE_PEPPER_CDMS)
59 CreatePepperCdmCB create_pepper_cdm_cb_
;
60 #elif defined(ENABLE_BROWSER_CDMS)
61 // The |manager_| is a per render frame object owned by RenderFrameImpl.
62 RendererCdmManager
* manager_
;
65 base::ThreadChecker thread_checker_
;
67 DISALLOW_COPY_AND_ASSIGN(RenderCdmFactory
);
70 } // namespace content
72 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_RENDER_CDM_FACTORY_H_