1 // Copyright 2014 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_BASE_BROWSER_CDM_FACTORY_H_
6 #define MEDIA_BASE_BROWSER_CDM_FACTORY_H_
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "media/base/browser_cdm.h"
13 #include "media/base/media_export.h"
17 class MEDIA_EXPORT BrowserCdmFactory
{
19 BrowserCdmFactory() {}
20 virtual ~BrowserCdmFactory() {}
22 virtual scoped_ptr
<BrowserCdm
> CreateBrowserCdm(
23 const std::string
& key_system
,
24 bool use_hw_secure_codecs
,
25 const SessionMessageCB
& session_message_cb
,
26 const SessionClosedCB
& session_closed_cb
,
27 const LegacySessionErrorCB
& legacy_session_error_cb
,
28 const SessionKeysChangeCB
& session_keys_change_cb
,
29 const SessionExpirationUpdateCB
& session_expiration_update_cb
) = 0;
32 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory
);
35 // Provides a factory for creating BrowserCdm instances. There is only one
36 // BrowserCdmFactory per process.
37 void SetBrowserCdmFactory(BrowserCdmFactory
* factory
);
39 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be
41 // |use_hw_secure_codecs| indicates that the CDM should be configured to use
42 // hardware-secure codecs (for platforms that support it).
43 // TODO(xhwang): Add ifdef for IPC based CDM.
44 scoped_ptr
<BrowserCdm
> MEDIA_EXPORT
45 CreateBrowserCdm(const std::string
& key_system
,
46 bool use_hw_secure_codecs
,
47 const SessionMessageCB
& session_message_cb
,
48 const SessionClosedCB
& session_closed_cb
,
49 const LegacySessionErrorCB
& legacy_session_error_cb
,
50 const SessionKeysChangeCB
& session_keys_change_cb
,
51 const SessionExpirationUpdateCB
& session_expiration_update_cb
);
55 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_