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" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // removed. | 65 // removed. |
66 blink::WebString id = blink::WebString::fromUTF8(web_session_id); | 66 blink::WebString id = blink::WebString::fromUTF8(web_session_id); |
67 DCHECK(web_session_id_.isEmpty() || web_session_id_ == id) | 67 DCHECK(web_session_id_.isEmpty() || web_session_id_ == id) |
68 << "Session ID may not be changed once set."; | 68 << "Session ID may not be changed once set."; |
69 web_session_id_ = id; | 69 web_session_id_ = id; |
70 } | 70 } |
71 | 71 |
72 void WebContentDecryptionModuleSessionImpl::OnSessionMessage( | 72 void WebContentDecryptionModuleSessionImpl::OnSessionMessage( |
73 const std::vector<uint8>& message, | 73 const std::vector<uint8>& message, |
74 const std::string& destination_url) { | 74 const std::string& destination_url) { |
75 client_->keyMessage(message.empty() ? NULL : &message[0], | 75 client_->message(message.empty() ? NULL : &message[0], |
76 message.size(), | 76 message.size(), |
77 GURL(destination_url)); | 77 GURL(destination_url)); |
78 } | 78 } |
79 | 79 |
80 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { | 80 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { |
81 // TODO(jrummell): Blink APIs need to be updated to the new EME API. For now, | 81 client_->ready(); |
82 // convert the response to the old v0.1b API. | |
83 client_->keyAdded(); | |
84 } | 82 } |
85 | 83 |
86 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { | 84 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { |
| 85 client_->close(); |
87 if (!session_closed_cb_.is_null()) | 86 if (!session_closed_cb_.is_null()) |
88 base::ResetAndReturn(&session_closed_cb_).Run(session_id_); | 87 base::ResetAndReturn(&session_closed_cb_).Run(session_id_); |
89 } | 88 } |
90 | 89 |
91 void WebContentDecryptionModuleSessionImpl::OnSessionError( | 90 void WebContentDecryptionModuleSessionImpl::OnSessionError( |
92 media::MediaKeys::KeyError error_code, | 91 media::MediaKeys::KeyError error_code, |
93 int system_code) { | 92 int system_code) { |
94 client_->keyError(static_cast<Client::MediaKeyErrorCode>(error_code), | 93 client_->error(static_cast<Client::MediaKeyErrorCode>(error_code), |
95 system_code); | 94 system_code); |
96 } | 95 } |
97 | 96 |
98 } // namespace content | 97 } // namespace content |
OLD | NEW |