Revert of Revert of Roll android_tools f6e2370:2a860d8 (patchset #1 id:1 of https...
[chromium-blink-merge.git] / media / base / browser_cdm_factory.h
blobf2bd29c32a4dfde18bb43db0edbf8962a70925d2
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_
8 #include <string>
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"
15 namespace media {
17 class MEDIA_EXPORT BrowserCdmFactory {
18 public:
19 BrowserCdmFactory() {}
20 virtual ~BrowserCdmFactory() {}
22 virtual scoped_ptr<BrowserCdm> CreateBrowserCdm(
23 const std::string& key_system,
24 const SessionMessageCB& session_message_cb,
25 const SessionClosedCB& session_closed_cb,
26 const SessionErrorCB& session_error_cb,
27 const SessionKeysChangeCB& session_keys_change_cb,
28 const SessionExpirationUpdateCB& session_expiration_update_cb) = 0;
30 private:
31 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory);
34 // Provides a factory for creating BrowserCdm instances. There is only one
35 // BrowserCdmFactory per process.
36 void SetBrowserCdmFactory(BrowserCdmFactory* factory);
38 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be
39 // created.
40 // TODO(xhwang): Add ifdef for IPC based CDM.
41 scoped_ptr<BrowserCdm> MEDIA_EXPORT
42 CreateBrowserCdm(const std::string& key_system,
43 const SessionMessageCB& session_message_cb,
44 const SessionClosedCB& session_closed_cb,
45 const SessionErrorCB& session_error_cb,
46 const SessionKeysChangeCB& session_keys_change_cb,
47 const SessionExpirationUpdateCB& session_expiration_update_cb);
49 } // namespace media
51 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_