| 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 "base/strings/utf_string_conversions.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // OnSessionCreated() should only be called once, and the second check can be | 64 // OnSessionCreated() should only be called once, and the second check can be |
| 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 GURL& destination_url) { |
| 75 client_->message(message.empty() ? NULL : &message[0], | 75 client_->message( |
| 76 message.size(), | 76 message.empty() ? NULL : &message[0], message.size(), destination_url); |
| 77 GURL(destination_url)); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { | 79 void WebContentDecryptionModuleSessionImpl::OnSessionReady() { |
| 81 client_->ready(); | 80 client_->ready(); |
| 82 } | 81 } |
| 83 | 82 |
| 84 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { | 83 void WebContentDecryptionModuleSessionImpl::OnSessionClosed() { |
| 85 client_->close(); | 84 client_->close(); |
| 86 } | 85 } |
| 87 | 86 |
| 88 void WebContentDecryptionModuleSessionImpl::OnSessionError( | 87 void WebContentDecryptionModuleSessionImpl::OnSessionError( |
| 89 media::MediaKeys::KeyError error_code, | 88 media::MediaKeys::KeyError error_code, |
| 90 uint32 system_code) { | 89 uint32 system_code) { |
| 91 client_->error(static_cast<Client::MediaKeyErrorCode>(error_code), | 90 client_->error(static_cast<Client::MediaKeyErrorCode>(error_code), |
| 92 system_code); | 91 system_code); |
| 93 } | 92 } |
| 94 | 93 |
| 95 } // namespace content | 94 } // namespace content |
| OLD | NEW |