OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/remoting/rpc/proto_utils.h" | 5 #include "media/remoting/rpc/proto_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/big_endian.h" | 9 #include "base/big_endian.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 CdmPromiseResult* result) { | 409 CdmPromiseResult* result) { |
410 if (!promise_message.has_success()) | 410 if (!promise_message.has_success()) |
411 return false; | 411 return false; |
412 | 412 |
413 bool success = promise_message.success(); | 413 bool success = promise_message.success(); |
414 if (success) { | 414 if (success) { |
415 *result = CdmPromiseResult::SuccessResult(); | 415 *result = CdmPromiseResult::SuccessResult(); |
416 return true; | 416 return true; |
417 } | 417 } |
418 | 418 |
419 ::media::MediaKeys::Exception exception = ::media::MediaKeys::UNKNOWN_ERROR; | 419 ::media::CdmPromise::Exception exception = ::media::CdmPromise::UNKNOWN_ERROR; |
420 uint32_t system_code = 0; | 420 uint32_t system_code = 0; |
421 std::string error_message; | 421 std::string error_message; |
422 | 422 |
423 exception = ToMediaMediaKeysException(promise_message.exception()).value(); | 423 exception = ToCdmPromiseException(promise_message.exception()).value(); |
424 system_code = promise_message.system_code(); | 424 system_code = promise_message.system_code(); |
425 error_message = promise_message.error_message(); | 425 error_message = promise_message.error_message(); |
426 *result = CdmPromiseResult(exception, system_code, error_message); | 426 *result = CdmPromiseResult(exception, system_code, error_message); |
427 return true; | 427 return true; |
428 } | 428 } |
429 | 429 |
430 bool ConvertProtoToCdmPromiseWithCdmIdSessionId(const pb::RpcMessage& message, | 430 bool ConvertProtoToCdmPromiseWithCdmIdSessionId(const pb::RpcMessage& message, |
431 CdmPromiseResult* result, | 431 CdmPromiseResult* result, |
432 int* cdm_id, | 432 int* cdm_id, |
433 std::string* session_id) { | 433 std::string* session_id) { |
434 if (!message.has_cdm_promise_rpc()) | 434 if (!message.has_cdm_promise_rpc()) |
435 return false; | 435 return false; |
436 | 436 |
437 const auto& promise_message = message.cdm_promise_rpc(); | 437 const auto& promise_message = message.cdm_promise_rpc(); |
438 if (!ConvertProtoToCdmPromise(promise_message, result)) | 438 if (!ConvertProtoToCdmPromise(promise_message, result)) |
439 return false; | 439 return false; |
440 | 440 |
441 if (cdm_id) | 441 if (cdm_id) |
442 *cdm_id = promise_message.cdm_id(); | 442 *cdm_id = promise_message.cdm_id(); |
443 if (session_id) | 443 if (session_id) |
444 *session_id = promise_message.session_id(); | 444 *session_id = promise_message.session_id(); |
445 | 445 |
446 return true; | 446 return true; |
447 } | 447 } |
448 | 448 |
449 //============================================================================== | 449 //============================================================================== |
450 CdmPromiseResult::CdmPromiseResult() | 450 CdmPromiseResult::CdmPromiseResult() |
451 : CdmPromiseResult(::media::MediaKeys::UNKNOWN_ERROR, 0, "") {} | 451 : CdmPromiseResult(::media::CdmPromise::UNKNOWN_ERROR, 0, "") {} |
452 | 452 |
453 CdmPromiseResult::CdmPromiseResult(::media::MediaKeys::Exception exception, | 453 CdmPromiseResult::CdmPromiseResult(::media::CdmPromise::Exception exception, |
454 uint32_t system_code, | 454 uint32_t system_code, |
455 std::string error_message) | 455 std::string error_message) |
456 : success_(false), | 456 : success_(false), |
457 exception_(exception), | 457 exception_(exception), |
458 system_code_(system_code), | 458 system_code_(system_code), |
459 error_message_(error_message) {} | 459 error_message_(error_message) {} |
460 | 460 |
461 CdmPromiseResult::CdmPromiseResult(const CdmPromiseResult& other) = default; | 461 CdmPromiseResult::CdmPromiseResult(const CdmPromiseResult& other) = default; |
462 | 462 |
463 CdmPromiseResult::~CdmPromiseResult() = default; | 463 CdmPromiseResult::~CdmPromiseResult() = default; |
464 | 464 |
465 CdmPromiseResult CdmPromiseResult::SuccessResult() { | 465 CdmPromiseResult CdmPromiseResult::SuccessResult() { |
466 CdmPromiseResult result(static_cast<::media::MediaKeys::Exception>(0), 0, ""); | 466 CdmPromiseResult result(static_cast<::media::CdmPromise::Exception>(0), 0, |
| 467 ""); |
467 result.success_ = true; | 468 result.success_ = true; |
468 return result; | 469 return result; |
469 } | 470 } |
470 | 471 |
471 } // namespace remoting | 472 } // namespace remoting |
472 } // namespace media | 473 } // namespace media |
OLD | NEW |