OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 5 #ifndef MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
6 #define MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 6 #define MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "media/base/browser_cdm.h" | 12 #include "media/base/browser_cdm.h" |
12 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
13 | 14 |
14 namespace media { | 15 namespace media { |
15 | 16 |
| 17 class MEDIA_EXPORT BrowserCdmFactory { |
| 18 public: |
| 19 BrowserCdmFactory() {} |
| 20 virtual ~BrowserCdmFactory() {} |
| 21 |
| 22 virtual scoped_ptr<BrowserCdm> CreateBrowserCdm( |
| 23 const std::string& key_system, |
| 24 const BrowserCdm::SessionCreatedCB& session_created_cb, |
| 25 const BrowserCdm::SessionMessageCB& session_message_cb, |
| 26 const BrowserCdm::SessionReadyCB& session_ready_cb, |
| 27 const BrowserCdm::SessionClosedCB& session_closed_cb, |
| 28 const BrowserCdm::SessionErrorCB& session_error_cb) = 0; |
| 29 |
| 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(BrowserCdmFactory); |
| 32 }; |
| 33 |
| 34 // Provides a factory for creating BrowserCdm instances. There is only one |
| 35 // BrowserCdmFactory per process. |
| 36 void SetBrowserCdmFactory(BrowserCdmFactory* factory); |
| 37 |
16 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be | 38 // Creates a BrowserCdm for |key_system|. Returns NULL if the CDM cannot be |
17 // created. | 39 // created. |
18 // TODO(xhwang): Add ifdef for IPC based CDM. | 40 // TODO(xhwang): Add ifdef for IPC based CDM. |
19 scoped_ptr<BrowserCdm> MEDIA_EXPORT | 41 scoped_ptr<BrowserCdm> MEDIA_EXPORT |
20 CreateBrowserCdm(const std::string& key_system, | 42 CreateBrowserCdm(const std::string& key_system, |
21 const BrowserCdm::SessionCreatedCB& session_created_cb, | 43 const BrowserCdm::SessionCreatedCB& session_created_cb, |
22 const BrowserCdm::SessionMessageCB& session_message_cb, | 44 const BrowserCdm::SessionMessageCB& session_message_cb, |
23 const BrowserCdm::SessionReadyCB& session_ready_cb, | 45 const BrowserCdm::SessionReadyCB& session_ready_cb, |
24 const BrowserCdm::SessionClosedCB& session_closed_cb, | 46 const BrowserCdm::SessionClosedCB& session_closed_cb, |
25 const BrowserCdm::SessionErrorCB& session_error_cb); | 47 const BrowserCdm::SessionErrorCB& session_error_cb); |
26 | 48 |
27 } // namespace media | 49 } // namespace media |
28 | 50 |
29 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ | 51 #endif // MEDIA_BASE_BROWSER_CDM_FACTORY_H_ |
OLD | NEW |