| 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 #include "media/mojo/clients/mojo_cdm.h" | 5 #include "media/mojo/clients/mojo_cdm.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "media/base/cdm_context.h" | 16 #include "media/base/cdm_context.h" |
| 17 #include "media/base/cdm_key_information.h" | 17 #include "media/base/cdm_key_information.h" |
| 18 #include "media/base/cdm_promise.h" | 18 #include "media/base/cdm_promise.h" |
| 19 #include "media/mojo/clients/mojo_decryptor.h" | 19 #include "media/mojo/clients/mojo_decryptor.h" |
| 20 #include "media/mojo/common/media_type_converters.h" | 20 #include "media/mojo/common/media_type_converters.h" |
| 21 #include "media/mojo/interfaces/decryptor.mojom.h" | 21 #include "media/mojo/interfaces/decryptor.mojom.h" |
| 22 #include "services/shell/public/cpp/connect.h" | 22 #include "services/service_manager/public/cpp/connect.h" |
| 23 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 23 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 namespace media { | 26 namespace media { |
| 27 | 27 |
| 28 template <typename PromiseType> | 28 template <typename PromiseType> |
| 29 static void RejectPromise(std::unique_ptr<PromiseType> promise, | 29 static void RejectPromise(std::unique_ptr<PromiseType> promise, |
| 30 mojom::CdmPromiseResultPtr result) { | 30 mojom::CdmPromiseResultPtr result) { |
| 31 promise->reject(static_cast<MediaKeys::Exception>(result->exception), | 31 promise->reject(static_cast<MediaKeys::Exception>(result->exception), |
| 32 result->system_code, result->error_message); | 32 result->system_code, result->error_message); |
| 33 } | 33 } |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 std::unique_ptr<NewSessionCdmPromise> promise, | 335 std::unique_ptr<NewSessionCdmPromise> promise, |
| 336 mojom::CdmPromiseResultPtr result, | 336 mojom::CdmPromiseResultPtr result, |
| 337 const std::string& session_id) { | 337 const std::string& session_id) { |
| 338 if (result->success) | 338 if (result->success) |
| 339 promise->resolve(session_id); | 339 promise->resolve(session_id); |
| 340 else | 340 else |
| 341 RejectPromise(std::move(promise), std::move(result)); | 341 RejectPromise(std::move(promise), std::move(result)); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace media | 344 } // namespace media |
| OLD | NEW |