| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "media/base/android/media_drm_bridge.h" | 5 #include "media/base/android/media_drm_bridge.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" | 
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" | 
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 466 } | 466 } | 
| 467 | 467 | 
| 468 void MediaDrmBridge::OnSessionMessage(JNIEnv* env, | 468 void MediaDrmBridge::OnSessionMessage(JNIEnv* env, | 
| 469                                       jobject j_media_drm, | 469                                       jobject j_media_drm, | 
| 470                                       jint j_session_id, | 470                                       jint j_session_id, | 
| 471                                       jbyteArray j_message, | 471                                       jbyteArray j_message, | 
| 472                                       jstring j_destination_url) { | 472                                       jstring j_destination_url) { | 
| 473   uint32 session_id = j_session_id; | 473   uint32 session_id = j_session_id; | 
| 474   std::vector<uint8> message; | 474   std::vector<uint8> message; | 
| 475   JavaByteArrayToByteVector(env, j_message, &message); | 475   JavaByteArrayToByteVector(env, j_message, &message); | 
| 476   std::string destination_url = ConvertJavaStringToUTF8(env, j_destination_url); | 476   GURL destination_gurl = GURL(ConvertJavaStringToUTF8(env, j_destination_url)); | 
| 477   session_message_cb_.Run(session_id, message, destination_url); | 477   if (!destination_gurl.is_valid() && !destination_gurl.is_empty()) { | 
|  | 478     DLOG(WARNING) << "SessionMessage destination_url is invalid : " | 
|  | 479                   << destination_gurl.possibly_invalid_spec(); | 
|  | 480     destination_gurl = GURL::EmptyGURL();  // Replace invalid destination_url. | 
|  | 481   } | 
|  | 482   session_message_cb_.Run(session_id, message, destination_gurl); | 
| 478 } | 483 } | 
| 479 | 484 | 
| 480 void MediaDrmBridge::OnSessionReady(JNIEnv* env, | 485 void MediaDrmBridge::OnSessionReady(JNIEnv* env, | 
| 481                                     jobject j_media_drm, | 486                                     jobject j_media_drm, | 
| 482                                     jint j_session_id) { | 487                                     jint j_session_id) { | 
| 483   uint32 session_id = j_session_id; | 488   uint32 session_id = j_session_id; | 
| 484   session_ready_cb_.Run(session_id); | 489   session_ready_cb_.Run(session_id); | 
| 485 } | 490 } | 
| 486 | 491 | 
| 487 void MediaDrmBridge::OnSessionClosed(JNIEnv* env, | 492 void MediaDrmBridge::OnSessionClosed(JNIEnv* env, | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 523   JNIEnv* env = AttachCurrentThread(); | 528   JNIEnv* env = AttachCurrentThread(); | 
| 524   Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); | 529   Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); | 
| 525 } | 530 } | 
| 526 | 531 | 
| 527 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( | 532 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( | 
| 528     JNIEnv* env, jobject, bool success) { | 533     JNIEnv* env, jobject, bool success) { | 
| 529   base::ResetAndReturn(&reset_credentials_cb_).Run(success); | 534   base::ResetAndReturn(&reset_credentials_cb_).Run(success); | 
| 530 } | 535 } | 
| 531 | 536 | 
| 532 }  // namespace media | 537 }  // namespace media | 
| OLD | NEW | 
|---|