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

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

Issue 2796843002: [Clank] Load/Remove persistent license (Closed)
Patch Set: nit Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/android_util.h" 5 #include "media/base/android/android_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_array.h" 11 #include "base/android/jni_array.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 std::string JavaBytesToString(JNIEnv* env, jbyteArray j_byte_array) { 15 std::string JavaBytesToString(JNIEnv* env, jbyteArray j_byte_array) {
16 std::vector<uint8_t> byte_vector; 16 std::vector<uint8_t> byte_vector;
17 base::android::JavaByteArrayToByteVector(env, j_byte_array, &byte_vector); 17 base::android::JavaByteArrayToByteVector(env, j_byte_array, &byte_vector);
18 return std::string(byte_vector.begin(), byte_vector.end()); 18 return std::string(byte_vector.begin(), byte_vector.end());
19 } 19 }
20 20
21 base::android::ScopedJavaLocalRef<jbyteArray> StringToJavaBytes(
22 JNIEnv* env,
23 const std::string& str) {
24 return base::android::ToJavaByteArray(
25 env, reinterpret_cast<const uint8_t*>(str.data()), str.size());
26 }
27
21 JavaObjectPtr CreateJavaObjectPtr(jobject object) { 28 JavaObjectPtr CreateJavaObjectPtr(jobject object) {
22 JavaObjectPtr j_object_ptr(new base::android::ScopedJavaGlobalRef<jobject>()); 29 JavaObjectPtr j_object_ptr(new base::android::ScopedJavaGlobalRef<jobject>());
23 j_object_ptr->Reset(base::android::AttachCurrentThread(), object); 30 j_object_ptr->Reset(base::android::AttachCurrentThread(), object);
24 return j_object_ptr; 31 return j_object_ptr;
25 } 32 }
26 33
27 } // namespace media 34 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/android_util.h ('k') | media/base/android/java/src/org/chromium/media/MediaDrmBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698