Chromium Code Reviews| 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/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
|
jrummell
2015/10/29 21:05:17
Should be base/memory/ref_counted.h now.
xhwang
2015/10/30 16:20:59
Done.
| |
| 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 scoped_ptr<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 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 scoped_ptr<MediaKeys> cdm_; | 33 |
| 34 // Holds a ref-count of the CDM. | |
| 35 scoped_refptr<MediaKeys> cdm_; | |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 } // namespace media | 38 } // namespace media |
| 37 | 39 |
| 38 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ | 40 #endif // MEDIA_BASE_CDM_INITIALIZED_PROMISE_H_ |
| OLD | NEW |