| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOJO_SERVICES_MOJO_CDM_H_ | 5 #ifndef MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
| 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_H_ | 6 #define MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "media/base/cdm_context.h" | 15 #include "media/base/cdm_context.h" |
| 16 #include "media/base/cdm_initialized_promise.h" | 16 #include "media/base/cdm_initialized_promise.h" |
| 17 #include "media/base/media_keys.h" | 17 #include "media/base/media_keys.h" |
| 18 #include "media/mojo/interfaces/content_decryption_module.mojom.h" | 18 #include "media/mojo/interfaces/content_decryption_module.mojom.h" |
| 19 #include "media/mojo/services/mojo_type_trait.h" | 19 #include "media/mojo/services/mojo_type_trait.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // We have to inline this method, since MS VS 2013 compiler fails to compile | 114 // We have to inline this method, since MS VS 2013 compiler fails to compile |
| 115 // it when this method is not inlined. It fails with error C2244 | 115 // it when this method is not inlined. It fails with error C2244 |
| 116 // "unable to match function definition to an existing declaration". | 116 // "unable to match function definition to an existing declaration". |
| 117 template <typename... T> | 117 template <typename... T> |
| 118 void OnPromiseResult(scoped_ptr<CdmPromiseTemplate<T...>> promise, | 118 void OnPromiseResult(scoped_ptr<CdmPromiseTemplate<T...>> promise, |
| 119 interfaces::CdmPromiseResultPtr result, | 119 interfaces::CdmPromiseResultPtr result, |
| 120 typename MojoTypeTrait<T>::MojoType... args) { | 120 typename MojoTypeTrait<T>::MojoType... args) { |
| 121 if (result->success) | 121 if (result->success) |
| 122 promise->resolve(args.template To<T>()...); // See ISO C++03 14.2/4. | 122 promise->resolve(args.template To<T>()...); // See ISO C++03 14.2/4. |
| 123 else | 123 else |
| 124 RejectPromise(promise.Pass(), result.Pass()); | 124 RejectPromise(std::move(promise), std::move(result)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 interfaces::ContentDecryptionModulePtr remote_cdm_; | 127 interfaces::ContentDecryptionModulePtr remote_cdm_; |
| 128 mojo::Binding<ContentDecryptionModuleClient> binding_; | 128 mojo::Binding<ContentDecryptionModuleClient> binding_; |
| 129 int cdm_id_; | 129 int cdm_id_; |
| 130 | 130 |
| 131 // Keep track of the DecryptorPtr in order to do lazy initialization of | 131 // Keep track of the DecryptorPtr in order to do lazy initialization of |
| 132 // MojoDecryptor. | 132 // MojoDecryptor. |
| 133 interfaces::DecryptorPtr decryptor_ptr_; | 133 interfaces::DecryptorPtr decryptor_ptr_; |
| 134 scoped_ptr<MojoDecryptor> decryptor_; | 134 scoped_ptr<MojoDecryptor> decryptor_; |
| 135 | 135 |
| 136 // Callbacks for firing session events. | 136 // Callbacks for firing session events. |
| 137 SessionMessageCB session_message_cb_; | 137 SessionMessageCB session_message_cb_; |
| 138 SessionClosedCB session_closed_cb_; | 138 SessionClosedCB session_closed_cb_; |
| 139 LegacySessionErrorCB legacy_session_error_cb_; | 139 LegacySessionErrorCB legacy_session_error_cb_; |
| 140 SessionKeysChangeCB session_keys_change_cb_; | 140 SessionKeysChangeCB session_keys_change_cb_; |
| 141 SessionExpirationUpdateCB session_expiration_update_cb_; | 141 SessionExpirationUpdateCB session_expiration_update_cb_; |
| 142 | 142 |
| 143 base::WeakPtrFactory<MojoCdm> weak_factory_; | 143 base::WeakPtrFactory<MojoCdm> weak_factory_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(MojoCdm); | 145 DISALLOW_COPY_AND_ASSIGN(MojoCdm); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace media | 148 } // namespace media |
| 149 | 149 |
| 150 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_H_ | 150 #endif // MEDIA_MOJO_SERVICES_MOJO_CDM_H_ |
| OLD | NEW |