| 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 #include "content/renderer/media/crypto/cdm_initialized_promise.h" | 5 #include "media/base/cdm_initialized_promise.h" |
| 6 | 6 |
| 7 namespace content { | 7 namespace media { |
| 8 | 8 |
| 9 CdmInitializedPromise::CdmInitializedPromise( | 9 CdmInitializedPromise::CdmInitializedPromise(const CdmCreatedCB& cdm_created_cb, |
| 10 const media::CdmCreatedCB& cdm_created_cb, | 10 scoped_ptr<MediaKeys> cdm) |
| 11 scoped_ptr<media::MediaKeys> cdm) | |
| 12 : cdm_created_cb_(cdm_created_cb), cdm_(cdm.Pass()) { | 11 : cdm_created_cb_(cdm_created_cb), cdm_(cdm.Pass()) { |
| 13 } | 12 } |
| 14 | 13 |
| 15 CdmInitializedPromise::~CdmInitializedPromise() { | 14 CdmInitializedPromise::~CdmInitializedPromise() { |
| 16 } | 15 } |
| 17 | 16 |
| 18 void CdmInitializedPromise::resolve() { | 17 void CdmInitializedPromise::resolve() { |
| 19 MarkPromiseSettled(); | 18 MarkPromiseSettled(); |
| 20 cdm_created_cb_.Run(cdm_.Pass(), ""); | 19 cdm_created_cb_.Run(cdm_.Pass(), ""); |
| 21 } | 20 } |
| 22 | 21 |
| 23 void CdmInitializedPromise::reject(media::MediaKeys::Exception exception_code, | 22 void CdmInitializedPromise::reject(MediaKeys::Exception exception_code, |
| 24 uint32 system_code, | 23 uint32 system_code, |
| 25 const std::string& error_message) { | 24 const std::string& error_message) { |
| 26 MarkPromiseSettled(); | 25 MarkPromiseSettled(); |
| 27 cdm_created_cb_.Run(nullptr, error_message); | 26 cdm_created_cb_.Run(nullptr, error_message); |
| 27 // Usually after this |this| (and the |cdm_| within it) will be destroyed. |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace content | 30 } // namespace media |
| OLD | NEW |