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