Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / media / base / cdm_factory.h
blob4a5cfb7f880416907ebd700a39adca853fdcf83a
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_CDM_FACTORY_H_
6 #define MEDIA_BASE_CDM_FACTORY_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "media/base/media_export.h"
12 #include "media/base/media_keys.h"
14 class GURL;
16 namespace media {
18 // Callback used when CDM is created. |error_message| only used if
19 // MediaKeys is null (i.e. CDM can't be created).
20 using CdmCreatedCB = base::Callback<void(scoped_ptr<MediaKeys>,
21 const std::string& error_message)>;
23 struct CdmConfig;
25 class MEDIA_EXPORT CdmFactory {
26 public:
27 CdmFactory();
28 virtual ~CdmFactory();
30 // Creates a CDM for |key_system| and returns it through |cdm_created_cb|
31 // asynchronously.
32 virtual void Create(
33 const std::string& key_system,
34 const GURL& security_origin,
35 const CdmConfig& cdm_config,
36 const SessionMessageCB& session_message_cb,
37 const SessionClosedCB& session_closed_cb,
38 const LegacySessionErrorCB& legacy_session_error_cb,
39 const SessionKeysChangeCB& session_keys_change_cb,
40 const SessionExpirationUpdateCB& session_expiration_update_cb,
41 const CdmCreatedCB& cdm_created_cb) = 0;
43 private:
44 DISALLOW_COPY_AND_ASSIGN(CdmFactory);
47 } // namespace media
49 #endif // MEDIA_BASE_CDM_FACTORY_H_