| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 if (client) { | 383 if (client) { |
| 384 MediaDrmBridgeDelegate* delegate = | 384 MediaDrmBridgeDelegate* delegate = |
| 385 client->GetMediaDrmBridgeDelegate(scheme_uuid_); | 385 client->GetMediaDrmBridgeDelegate(scheme_uuid_); |
| 386 if (delegate) { | 386 if (delegate) { |
| 387 std::vector<uint8_t> init_data_from_delegate; | 387 std::vector<uint8_t> init_data_from_delegate; |
| 388 std::vector<std::string> optional_parameters_from_delegate; | 388 std::vector<std::string> optional_parameters_from_delegate; |
| 389 if (!delegate->OnCreateSession(init_data_type, init_data, | 389 if (!delegate->OnCreateSession(init_data_type, init_data, |
| 390 &init_data_from_delegate, | 390 &init_data_from_delegate, |
| 391 &optional_parameters_from_delegate)) { | 391 &optional_parameters_from_delegate)) { |
| 392 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); | 392 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); |
| 393 return; |
| 393 } | 394 } |
| 394 if (!init_data_from_delegate.empty()) { | 395 if (!init_data_from_delegate.empty()) { |
| 395 j_init_data = | 396 j_init_data = |
| 396 base::android::ToJavaByteArray(env, init_data_from_delegate.data(), | 397 base::android::ToJavaByteArray(env, init_data_from_delegate.data(), |
| 397 init_data_from_delegate.size()); | 398 init_data_from_delegate.size()); |
| 398 } | 399 } |
| 399 if (!optional_parameters_from_delegate.empty()) { | 400 if (!optional_parameters_from_delegate.empty()) { |
| 400 j_optional_parameters = base::android::ToJavaArrayOfStrings( | 401 j_optional_parameters = base::android::ToJavaArrayOfStrings( |
| 401 env, optional_parameters_from_delegate); | 402 env, optional_parameters_from_delegate); |
| 402 } | 403 } |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 JNIEnv* env = AttachCurrentThread(); | 881 JNIEnv* env = AttachCurrentThread(); |
| 881 | 882 |
| 882 ScopedJavaLocalRef<jbyteArray> j_response = base::android::ToJavaByteArray( | 883 ScopedJavaLocalRef<jbyteArray> j_response = base::android::ToJavaByteArray( |
| 883 env, reinterpret_cast<const uint8_t*>(response.data()), response.size()); | 884 env, reinterpret_cast<const uint8_t*>(response.data()), response.size()); |
| 884 | 885 |
| 885 Java_MediaDrmBridge_processProvisionResponse(env, j_media_drm_.obj(), success, | 886 Java_MediaDrmBridge_processProvisionResponse(env, j_media_drm_.obj(), success, |
| 886 j_response.obj()); | 887 j_response.obj()); |
| 887 } | 888 } |
| 888 | 889 |
| 889 } // namespace media | 890 } // namespace media |
| OLD | NEW |