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