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.Manifest; | 7 import android.Manifest; |
8 import android.annotation.SuppressLint; | 8 import android.annotation.SuppressLint; |
9 import android.annotation.TargetApi; | 9 import android.annotation.TargetApi; |
10 import android.app.Activity; | 10 import android.app.Activity; |
(...skipping 20 matching lines...) Expand all Loading... |
31 import org.chromium.base.metrics.RecordHistogram; | 31 import org.chromium.base.metrics.RecordHistogram; |
32 import org.chromium.ui.PhotoPickerListener; | 32 import org.chromium.ui.PhotoPickerListener; |
33 import org.chromium.ui.R; | 33 import org.chromium.ui.R; |
34 import org.chromium.ui.UiUtils; | 34 import org.chromium.ui.UiUtils; |
35 | 35 |
36 import java.io.File; | 36 import java.io.File; |
37 import java.io.IOException; | 37 import java.io.IOException; |
38 import java.util.ArrayList; | 38 import java.util.ArrayList; |
39 import java.util.Arrays; | 39 import java.util.Arrays; |
40 import java.util.List; | 40 import java.util.List; |
41 import java.util.Map; | |
42 import java.util.concurrent.TimeUnit; | 41 import java.util.concurrent.TimeUnit; |
43 | 42 |
44 /** | 43 /** |
45 * A dialog that is triggered from a file input field that allows a user to sele
ct a file based on | 44 * A dialog that is triggered from a file input field that allows a user to sele
ct a file based on |
46 * a set of accepted file types. The path of the selected file is passed to the
native dialog. | 45 * a set of accepted file types. The path of the selected file is passed to the
native dialog. |
47 */ | 46 */ |
48 @JNINamespace("ui") | 47 @JNINamespace("ui") |
49 @MainDex | 48 @MainDex |
50 public class SelectFileDialog implements WindowAndroid.IntentCallback, | 49 public class SelectFileDialog implements WindowAndroid.IntentCallback, |
51 WindowAndroid.PermissionCallback, Photo
PickerListener { | 50 WindowAndroid.PermissionCallback, Photo
PickerListener { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 311 } |
313 break; | 312 break; |
314 | 313 |
315 case LAUNCH_CAMERA: | 314 case LAUNCH_CAMERA: |
316 new GetCameraIntentTask(true, mWindowAndroid, this) | 315 new GetCameraIntentTask(true, mWindowAndroid, this) |
317 .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); | 316 .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |
318 break; | 317 break; |
319 } | 318 } |
320 } | 319 } |
321 | 320 |
322 @Override | |
323 public Map<String, Long> getFilesForTesting() { | |
324 return null; | |
325 } | |
326 | |
327 private class GetCameraIntentTask extends AsyncTask<Void, Void, Uri> { | 321 private class GetCameraIntentTask extends AsyncTask<Void, Void, Uri> { |
328 private Boolean mDirectToCamera; | 322 private Boolean mDirectToCamera; |
329 private WindowAndroid mWindow; | 323 private WindowAndroid mWindow; |
330 private WindowAndroid.IntentCallback mCallback; | 324 private WindowAndroid.IntentCallback mCallback; |
331 | 325 |
332 public GetCameraIntentTask(Boolean directToCamera, WindowAndroid window, | 326 public GetCameraIntentTask(Boolean directToCamera, WindowAndroid window, |
333 WindowAndroid.IntentCallback callback) { | 327 WindowAndroid.IntentCallback callback) { |
334 mDirectToCamera = directToCamera; | 328 mDirectToCamera = directToCamera; |
335 mWindow = window; | 329 mWindow = window; |
336 mCallback = callback; | 330 mCallback = callback; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 static SelectFileDialog create(long nativeSelectFileDialog) { | 646 static SelectFileDialog create(long nativeSelectFileDialog) { |
653 return new SelectFileDialog(nativeSelectFileDialog); | 647 return new SelectFileDialog(nativeSelectFileDialog); |
654 } | 648 } |
655 | 649 |
656 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, | 650 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, |
657 String filePath, String displayName); | 651 String filePath, String displayName); |
658 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo
gImpl, | 652 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo
gImpl, |
659 String[] filePathArray, String[] displayNameArray); | 653 String[] filePathArray, String[] displayNameArray); |
660 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl)
; | 654 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl)
; |
661 } | 655 } |
OLD | NEW |