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 #include "media/base/media_keys.h" | |
15 | 14 |
16 namespace media { | 15 namespace media { |
17 | 16 |
| 17 class MediaKeys; |
| 18 |
18 // 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 MediaKeys |
19 // object until the initialization completes, which it then passes to | 20 // object until the initialization completes, which it then passes to |
20 // |cdm_created_cb|. | 21 // |cdm_created_cb|. |
21 class MEDIA_EXPORT CdmInitializedPromise : public SimpleCdmPromise { | 22 class MEDIA_EXPORT CdmInitializedPromise : public SimpleCdmPromise { |
22 public: | 23 public: |
23 CdmInitializedPromise(const CdmCreatedCB& cdm_created_cb, | 24 CdmInitializedPromise(const CdmCreatedCB& cdm_created_cb, |
24 const scoped_refptr<MediaKeys>& cdm); | 25 const scoped_refptr<MediaKeys>& cdm); |
25 ~CdmInitializedPromise() override; | 26 ~CdmInitializedPromise() override; |
26 | 27 |
27 // SimpleCdmPromise implementation. | 28 // SimpleCdmPromise implementation. |
28 void resolve() override; | 29 void resolve() override; |
29 void reject(MediaKeys::Exception exception_code, | 30 void reject(CdmPromise::Exception exception_code, |
30 uint32_t system_code, | 31 uint32_t system_code, |
31 const std::string& error_message) override; | 32 const std::string& error_message) override; |
32 | 33 |
33 private: | 34 private: |
34 CdmCreatedCB cdm_created_cb_; | 35 CdmCreatedCB cdm_created_cb_; |
35 | 36 |
36 // Holds a ref-count of the CDM. | 37 // Holds a ref-count of the CDM. |
37 scoped_refptr<MediaKeys> cdm_; | 38 scoped_refptr<MediaKeys> cdm_; |
38 }; | 39 }; |
39 | 40 |
40 } // namespace media | 41 } // namespace media |
41 | 42 |
42 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ | 43 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ |
OLD | NEW |