Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: media/base/android/media_drm_bridge.cc

Issue 297703002: Using GURL in place of std::string for destination_url (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comments, adding checks Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 426 }
427 427
428 void MediaDrmBridge::OnSessionMessage(JNIEnv* env, 428 void MediaDrmBridge::OnSessionMessage(JNIEnv* env,
429 jobject j_media_drm, 429 jobject j_media_drm,
430 jint j_session_id, 430 jint j_session_id,
431 jbyteArray j_message, 431 jbyteArray j_message,
432 jstring j_destination_url) { 432 jstring j_destination_url) {
433 uint32 session_id = j_session_id; 433 uint32 session_id = j_session_id;
434 std::vector<uint8> message; 434 std::vector<uint8> message;
435 JavaByteArrayToByteVector(env, j_message, &message); 435 JavaByteArrayToByteVector(env, j_message, &message);
436 std::string destination_url = ConvertJavaStringToUTF8(env, j_destination_url); 436 GURL destination_gurl = GURL(ConvertJavaStringToUTF8(env, j_destination_url));
437 session_message_cb_.Run(session_id, message, destination_url); 437 if (!destination_gurl.is_valid() && !destination_gurl.is_empty()) {
438 DLOG(WARNING) << "SessionMessage destination_url is invalid : "
439 << destination_gurl.possibly_invalid_spec();
440 destination_gurl = GURL::EmptyGURL(); // Replace invalid destination_url.
441 }
442 session_message_cb_.Run(session_id, message, destination_gurl);
438 } 443 }
439 444
440 void MediaDrmBridge::OnSessionReady(JNIEnv* env, 445 void MediaDrmBridge::OnSessionReady(JNIEnv* env,
441 jobject j_media_drm, 446 jobject j_media_drm,
442 jint j_session_id) { 447 jint j_session_id) {
443 uint32 session_id = j_session_id; 448 uint32 session_id = j_session_id;
444 session_ready_cb_.Run(session_id); 449 session_ready_cb_.Run(session_id);
445 } 450 }
446 451
447 void MediaDrmBridge::OnSessionClosed(JNIEnv* env, 452 void MediaDrmBridge::OnSessionClosed(JNIEnv* env,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 JNIEnv* env = AttachCurrentThread(); 488 JNIEnv* env = AttachCurrentThread();
484 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj()); 489 Java_MediaDrmBridge_resetDeviceCredentials(env, j_media_drm_.obj());
485 } 490 }
486 491
487 void MediaDrmBridge::OnResetDeviceCredentialsCompleted( 492 void MediaDrmBridge::OnResetDeviceCredentialsCompleted(
488 JNIEnv* env, jobject, bool success) { 493 JNIEnv* env, jobject, bool success) {
489 base::ResetAndReturn(&reset_credentials_cb_).Run(success); 494 base::ResetAndReturn(&reset_credentials_cb_).Run(success);
490 } 495 }
491 496
492 } // namespace media 497 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698