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 "third_party/WebKit/public/platform/WebURL.h" | 10 #include "third_party/WebKit/public/platform/WebURL.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( | 14 WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl( |
15 media::MediaKeys* media_keys, | 15 media::MediaKeys* media_keys, |
16 Client* client, | 16 Client* client, |
17 const SessionClosedCB& session_closed_cb) | 17 const SessionClosedCB& session_closed_cb) |
18 : media_keys_(media_keys), | 18 : media_keys_(media_keys), |
19 client_(client), | 19 client_(client), |
20 session_closed_cb_(session_closed_cb) { | 20 session_closed_cb_(session_closed_cb) { |
21 DCHECK(media_keys_); | 21 DCHECK(media_keys_); |
22 // TODO(ddorwin): Populate session_id_ from the real implementation. | 22 // TODO(ddorwin): Populate session_id_ from the real implementation. |
23 } | 23 } |
24 | 24 |
25 WebContentDecryptionModuleSessionImpl:: | 25 WebContentDecryptionModuleSessionImpl:: |
26 ~WebContentDecryptionModuleSessionImpl() { | 26 ~WebContentDecryptionModuleSessionImpl() { |
27 } | 27 } |
28 | 28 |
29 WebKit::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { | 29 blink::WebString WebContentDecryptionModuleSessionImpl::sessionId() const { |
30 return WebKit::WebString::fromUTF8(session_id_); | 30 return blink::WebString::fromUTF8(session_id_); |
31 } | 31 } |
32 | 32 |
33 void WebContentDecryptionModuleSessionImpl::generateKeyRequest( | 33 void WebContentDecryptionModuleSessionImpl::generateKeyRequest( |
34 const WebKit::WebString& mime_type, | 34 const blink::WebString& mime_type, |
35 const uint8* init_data, size_t init_data_length) { | 35 const uint8* init_data, size_t init_data_length) { |
36 // TODO(ddorwin): Guard against this in supported types check and remove this. | 36 // TODO(ddorwin): Guard against this in supported types check and remove this. |
37 // Chromium only supports ASCII MIME types. | 37 // Chromium only supports ASCII MIME types. |
38 if (!IsStringASCII(mime_type)) { | 38 if (!IsStringASCII(mime_type)) { |
39 NOTREACHED(); | 39 NOTREACHED(); |
40 KeyError(media::MediaKeys::kUnknownError, 0); | 40 KeyError(media::MediaKeys::kUnknownError, 0); |
41 return; | 41 return; |
42 } | 42 } |
43 | 43 |
44 media_keys_->GenerateKeyRequest(UTF16ToASCII(mime_type), | 44 media_keys_->GenerateKeyRequest(UTF16ToASCII(mime_type), |
(...skipping 27 matching lines...) Expand all Loading... |
72 | 72 |
73 void WebContentDecryptionModuleSessionImpl::KeyMessage( | 73 void WebContentDecryptionModuleSessionImpl::KeyMessage( |
74 const std::vector<uint8>& message, | 74 const std::vector<uint8>& message, |
75 const std::string& destination_url) { | 75 const std::string& destination_url) { |
76 client_->keyMessage(message.empty() ? NULL : &message[0], | 76 client_->keyMessage(message.empty() ? NULL : &message[0], |
77 message.size(), | 77 message.size(), |
78 GURL(destination_url)); | 78 GURL(destination_url)); |
79 } | 79 } |
80 | 80 |
81 } // namespace content | 81 } // namespace content |
OLD | NEW |