| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 package org.chromium.ui.base; | 5 package org.chromium.ui.base; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; |
| 7 import android.app.Activity; | 8 import android.app.Activity; |
| 8 import android.content.ClipData; | 9 import android.content.ClipData; |
| 9 import android.content.ContentResolver; | 10 import android.content.ContentResolver; |
| 10 import android.content.Intent; | 11 import android.content.Intent; |
| 11 import android.database.Cursor; | 12 import android.database.Cursor; |
| 12 import android.net.Uri; | 13 import android.net.Uri; |
| 13 import android.os.Build; | 14 import android.os.Build; |
| 14 import android.os.Environment; | 15 import android.os.Environment; |
| 15 import android.provider.MediaStore; | 16 import android.provider.MediaStore; |
| 16 import android.text.TextUtils; | 17 import android.text.TextUtils; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 164 } |
| 164 | 165 |
| 165 /** | 166 /** |
| 166 * Callback method to handle the intent results and pass on the path to the
native | 167 * Callback method to handle the intent results and pass on the path to the
native |
| 167 * SelectFileDialog. | 168 * SelectFileDialog. |
| 168 * @param window The window that has access to the application activity. | 169 * @param window The window that has access to the application activity. |
| 169 * @param resultCode The result code whether the intent returned successfull
y. | 170 * @param resultCode The result code whether the intent returned successfull
y. |
| 170 * @param contentResolver The content resolver used to extract the path of t
he selected file. | 171 * @param contentResolver The content resolver used to extract the path of t
he selected file. |
| 171 * @param results The results of the requested intent. | 172 * @param results The results of the requested intent. |
| 172 */ | 173 */ |
| 174 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) |
| 173 @Override | 175 @Override |
| 174 public void onIntentCompleted(WindowAndroid window, int resultCode, | 176 public void onIntentCompleted(WindowAndroid window, int resultCode, |
| 175 ContentResolver contentResolver, Intent results) { | 177 ContentResolver contentResolver, Intent results) { |
| 176 if (resultCode != Activity.RESULT_OK) { | 178 if (resultCode != Activity.RESULT_OK) { |
| 177 onFileNotSelected(); | 179 onFileNotSelected(); |
| 178 return; | 180 return; |
| 179 } | 181 } |
| 180 | 182 |
| 181 if (results == null) { | 183 if (results == null) { |
| 182 // If we have a successful return but no data, then assume this is t
he camera returning | 184 // If we have a successful return but no data, then assume this is t
he camera returning |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 private static SelectFileDialog create(long nativeSelectFileDialog) { | 298 private static SelectFileDialog create(long nativeSelectFileDialog) { |
| 297 return new SelectFileDialog(nativeSelectFileDialog); | 299 return new SelectFileDialog(nativeSelectFileDialog); |
| 298 } | 300 } |
| 299 | 301 |
| 300 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, | 302 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, |
| 301 String filePath, String displayName); | 303 String filePath, String displayName); |
| 302 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo
gImpl, | 304 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo
gImpl, |
| 303 String[] filePathArray, String[] displayNameArray); | 305 String[] filePathArray, String[] displayNameArray); |
| 304 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl)
; | 306 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl)
; |
| 305 } | 307 } |
| OLD | NEW |