| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 if (client) { | 340 if (client) { |
| 341 MediaDrmBridgeDelegate* delegate = | 341 MediaDrmBridgeDelegate* delegate = |
| 342 client->GetMediaDrmBridgeDelegate(scheme_uuid_); | 342 client->GetMediaDrmBridgeDelegate(scheme_uuid_); |
| 343 if (delegate) { | 343 if (delegate) { |
| 344 std::vector<uint8_t> init_data_from_delegate; | 344 std::vector<uint8_t> init_data_from_delegate; |
| 345 std::vector<std::string> optional_parameters_from_delegate; | 345 std::vector<std::string> optional_parameters_from_delegate; |
| 346 if (!delegate->OnCreateSession(init_data_type, init_data, | 346 if (!delegate->OnCreateSession(init_data_type, init_data, |
| 347 &init_data_from_delegate, | 347 &init_data_from_delegate, |
| 348 &optional_parameters_from_delegate)) { | 348 &optional_parameters_from_delegate)) { |
| 349 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); | 349 promise->reject(INVALID_ACCESS_ERROR, 0, "Invalid init data."); |
| 350 return; |
| 350 } | 351 } |
| 351 if (!init_data_from_delegate.empty()) { | 352 if (!init_data_from_delegate.empty()) { |
| 352 j_init_data = | 353 j_init_data = |
| 353 base::android::ToJavaByteArray(env, init_data_from_delegate.data(), | 354 base::android::ToJavaByteArray(env, init_data_from_delegate.data(), |
| 354 init_data_from_delegate.size()); | 355 init_data_from_delegate.size()); |
| 355 } | 356 } |
| 356 if (!optional_parameters_from_delegate.empty()) { | 357 if (!optional_parameters_from_delegate.empty()) { |
| 357 j_optional_parameters = base::android::ToJavaArrayOfStrings( | 358 j_optional_parameters = base::android::ToJavaArrayOfStrings( |
| 358 env, optional_parameters_from_delegate); | 359 env, optional_parameters_from_delegate); |
| 359 } | 360 } |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 JNIEnv* env = AttachCurrentThread(); | 831 JNIEnv* env = AttachCurrentThread(); |
| 831 | 832 |
| 832 ScopedJavaLocalRef<jbyteArray> j_response = base::android::ToJavaByteArray( | 833 ScopedJavaLocalRef<jbyteArray> j_response = base::android::ToJavaByteArray( |
| 833 env, reinterpret_cast<const uint8_t*>(response.data()), response.size()); | 834 env, reinterpret_cast<const uint8_t*>(response.data()), response.size()); |
| 834 | 835 |
| 835 Java_MediaDrmBridge_processProvisionResponse(env, j_media_drm_.obj(), success, | 836 Java_MediaDrmBridge_processProvisionResponse(env, j_media_drm_.obj(), success, |
| 836 j_response.obj()); | 837 j_response.obj()); |
| 837 } | 838 } |
| 838 | 839 |
| 839 } // namespace media | 840 } // namespace media |
| OLD | NEW |