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 "content/renderer/media/webcontentdecryptionmodulesession_impl.h" | 5 #include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" |
10 #include "content/renderer/media/cdm_session_adapter.h" | 11 #include "content/renderer/media/cdm_session_adapter.h" |
11 #include "third_party/WebKit/public/platform/WebURL.h" | 12 #include "third_party/WebKit/public/platform/WebURL.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( | 16 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( |
16 uint32 session_id, | 17 uint32 session_id, |
17 Client* client, | 18 Client* client, |
18 const scoped_refptr<CdmSessionAdapter>& adapter) | 19 const scoped_refptr<CdmSessionAdapter>& adapter) |
19 : adapter_(adapter), | 20 : adapter_(adapter), |
(...skipping 15 matching lines...) Expand all Loading... |
35 const uint8* init_data, size_t init_data_length) { | 36 const uint8* init_data, size_t init_data_length) { |
36 // TODO(ddorwin): Guard against this in supported types check and remove this. | 37 // TODO(ddorwin): Guard against this in supported types check and remove this. |
37 // Chromium only supports ASCII MIME types. | 38 // Chromium only supports ASCII MIME types. |
38 if (!IsStringASCII(mime_type)) { | 39 if (!IsStringASCII(mime_type)) { |
39 NOTREACHED(); | 40 NOTREACHED(); |
40 OnSessionError(media::MediaKeys::kUnknownError, 0); | 41 OnSessionError(media::MediaKeys::kUnknownError, 0); |
41 return; | 42 return; |
42 } | 43 } |
43 | 44 |
44 adapter_->InitializeNewSession( | 45 adapter_->InitializeNewSession( |
45 session_id_, UTF16ToASCII(mime_type), init_data, init_data_length); | 46 session_id_, base::UTF16ToASCII(mime_type), init_data, init_data_length); |
46 } | 47 } |
47 | 48 |
48 void WebContentDecryptionModuleSessionImpl::update(const uint8* response, | 49 void WebContentDecryptionModuleSessionImpl::update(const uint8* response, |
49 size_t response_length) { | 50 size_t response_length) { |
50 DCHECK(response); | 51 DCHECK(response); |
51 adapter_->UpdateSession(session_id_, response, response_length); | 52 adapter_->UpdateSession(session_id_, response, response_length); |
52 } | 53 } |
53 | 54 |
54 void WebContentDecryptionModuleSessionImpl::release() { | 55 void WebContentDecryptionModuleSessionImpl::release() { |
55 adapter_->ReleaseSession(session_id_); | 56 adapter_->ReleaseSession(session_id_); |
(...skipping 29 matching lines...) Expand all Loading... |
85 } | 86 } |
86 | 87 |
87 void WebContentDecryptionModuleSessionImpl::OnSessionError( | 88 void WebContentDecryptionModuleSessionImpl::OnSessionError( |
88 media::MediaKeys::KeyError error_code, | 89 media::MediaKeys::KeyError error_code, |
89 uint32 system_code) { | 90 uint32 system_code) { |
90 client_->error(static_cast<Client::MediaKeyErrorCode>(error_code), | 91 client_->error(static_cast<Client::MediaKeyErrorCode>(error_code), |
91 system_code); | 92 system_code); |
92 } | 93 } |
93 | 94 |
94 } // namespace content | 95 } // namespace content |
OLD | NEW |