Index: base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java |
diff --git a/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java b/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..102787684a8b09e03e69d1e69339b738d096f15d |
--- /dev/null |
+++ b/base/test/android/java/src/org/chromium/base/FileDescriptorInfo.java |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.base; |
+ |
+import android.annotation.SuppressLint; |
+import android.os.Parcel; |
+import android.os.ParcelFileDescriptor; |
+import android.os.Parcelable; |
+ |
+/** |
+ * Parcelable class that contains file descriptor and an ID. |
+ * TODO(jcivelli): should be merged with |
+ * org.chromium.content.common.FileDescriptorInfo |
+ */ |
+@SuppressLint("ParcelClassLoader") |
+public final class FileDescriptorInfo implements Parcelable { |
+ public final int mId; |
+ public final ParcelFileDescriptor mFd; |
+ |
+ public FileDescriptorInfo(int id, ParcelFileDescriptor fd) { |
+ mId = id; |
+ mFd = fd; |
+ } |
+ |
+ FileDescriptorInfo(Parcel in) { |
+ mId = in.readInt(); |
+ mFd = in.readParcelable(null); |
+ } |
+ |
+ @Override |
+ public int describeContents() { |
+ return CONTENTS_FILE_DESCRIPTOR; |
+ } |
+ |
+ @Override |
+ public void writeToParcel(Parcel dest, int flags) { |
+ dest.writeInt(mId); |
+ dest.writeParcelable(mFd, CONTENTS_FILE_DESCRIPTOR); |
+ } |
+ |
+ public static final Parcelable.Creator<FileDescriptorInfo> CREATOR = |
+ new Parcelable.Creator<FileDescriptorInfo>() { |
+ @Override |
+ public FileDescriptorInfo createFromParcel(Parcel in) { |
+ return new FileDescriptorInfo(in); |
+ } |
+ |
+ @Override |
+ public FileDescriptorInfo[] newArray(int size) { |
+ return new FileDescriptorInfo[size]; |
+ } |
+ }; |
+} |