OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CDM_INITIALIZED_PROMISE_H_ | 5 #ifndef MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ |
6 #define MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ | 6 #define MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "media/base/cdm_factory.h" | 11 #include "media/base/cdm_factory.h" |
12 #include "media/base/cdm_promise.h" | 12 #include "media/base/cdm_promise.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 | 14 |
15 namespace media { | 15 namespace media { |
16 | 16 |
17 class MediaKeys; | 17 class ContentDecryptionModule; |
18 | 18 |
19 // Promise to be resolved when the CDM is initialized. It owns the MediaKeys | 19 // Promise to be resolved when the CDM is initialized. It owns the |
20 // object until the initialization completes, which it then passes to | 20 // ContentDecryptionModule object until the initialization completes, which it |
21 // |cdm_created_cb|. | 21 // then passes to |cdm_created_cb|. |
22 class MEDIA_EXPORT CdmInitializedPromise : public SimpleCdmPromise { | 22 class MEDIA_EXPORT CdmInitializedPromise : public SimpleCdmPromise { |
23 public: | 23 public: |
24 CdmInitializedPromise(const CdmCreatedCB& cdm_created_cb, | 24 CdmInitializedPromise(const CdmCreatedCB& cdm_created_cb, |
25 const scoped_refptr<MediaKeys>& cdm); | 25 const scoped_refptr<ContentDecryptionModule>& cdm); |
26 ~CdmInitializedPromise() override; | 26 ~CdmInitializedPromise() override; |
27 | 27 |
28 // SimpleCdmPromise implementation. | 28 // SimpleCdmPromise implementation. |
29 void resolve() override; | 29 void resolve() override; |
30 void reject(CdmPromise::Exception exception_code, | 30 void reject(CdmPromise::Exception exception_code, |
31 uint32_t system_code, | 31 uint32_t system_code, |
32 const std::string& error_message) override; | 32 const std::string& error_message) override; |
33 | 33 |
34 private: | 34 private: |
35 CdmCreatedCB cdm_created_cb_; | 35 CdmCreatedCB cdm_created_cb_; |
36 | 36 |
37 // Holds a ref-count of the CDM. | 37 // Holds a ref-count of the CDM. |
38 scoped_refptr<MediaKeys> cdm_; | 38 scoped_refptr<ContentDecryptionModule> cdm_; |
39 }; | 39 }; |
40 | 40 |
41 } // namespace media | 41 } // namespace media |
42 | 42 |
43 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ | 43 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ |
OLD | NEW |