| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webcontentdecryptionmodulesession_impl.h" | 5 #include "webcontentdecryptionmodulesession_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 switch (status) { | 55 switch (status) { |
| 56 case media::CdmKeyInformation::USABLE: | 56 case media::CdmKeyInformation::USABLE: |
| 57 return blink::WebEncryptedMediaKeyInformation::KeyStatus::Usable; | 57 return blink::WebEncryptedMediaKeyInformation::KeyStatus::Usable; |
| 58 case media::CdmKeyInformation::INTERNAL_ERROR: | 58 case media::CdmKeyInformation::INTERNAL_ERROR: |
| 59 return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError; | 59 return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError; |
| 60 case media::CdmKeyInformation::EXPIRED: | 60 case media::CdmKeyInformation::EXPIRED: |
| 61 return blink::WebEncryptedMediaKeyInformation::KeyStatus::Expired; | 61 return blink::WebEncryptedMediaKeyInformation::KeyStatus::Expired; |
| 62 case media::CdmKeyInformation::OUTPUT_NOT_ALLOWED: | 62 case media::CdmKeyInformation::OUTPUT_NOT_ALLOWED: |
| 63 return blink::WebEncryptedMediaKeyInformation::KeyStatus:: | 63 return blink::WebEncryptedMediaKeyInformation::KeyStatus:: |
| 64 OutputNotAllowed; | 64 OutputNotAllowed; |
| 65 case media::CdmKeyInformation::OUTPUT_DOWNSCALED: |
| 66 return blink::WebEncryptedMediaKeyInformation::KeyStatus:: |
| 67 OutputDownscaled; |
| 68 case media::CdmKeyInformation::KEY_STATUS_PENDING: |
| 69 return blink::WebEncryptedMediaKeyInformation::KeyStatus::StatusPending; |
| 65 } | 70 } |
| 66 | 71 |
| 67 NOTREACHED(); | 72 NOTREACHED(); |
| 68 return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError; | 73 return blink::WebEncryptedMediaKeyInformation::KeyStatus::InternalError; |
| 69 } | 74 } |
| 70 | 75 |
| 71 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( | 76 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( |
| 72 const scoped_refptr<CdmSessionAdapter>& adapter) | 77 const scoped_refptr<CdmSessionAdapter>& adapter) |
| 73 : adapter_(adapter), is_closed_(false), weak_ptr_factory_(this) { | 78 : adapter_(adapter), is_closed_(false), weak_ptr_factory_(this) { |
| 74 } | 79 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return blink::WebContentDecryptionModuleResult::SessionNotFound; | 264 return blink::WebContentDecryptionModuleResult::SessionNotFound; |
| 260 | 265 |
| 261 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; | 266 DCHECK(session_id_.empty()) << "Session ID may not be changed once set."; |
| 262 session_id_ = session_id; | 267 session_id_ = session_id; |
| 263 return adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) | 268 return adapter_->RegisterSession(session_id_, weak_ptr_factory_.GetWeakPtr()) |
| 264 ? blink::WebContentDecryptionModuleResult::NewSession | 269 ? blink::WebContentDecryptionModuleResult::NewSession |
| 265 : blink::WebContentDecryptionModuleResult::SessionAlreadyExists; | 270 : blink::WebContentDecryptionModuleResult::SessionAlreadyExists; |
| 266 } | 271 } |
| 267 | 272 |
| 268 } // namespace media | 273 } // namespace media |
| OLD | NEW |