Chromium Code Reviews| 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.TargetApi; | 8 import android.annotation.TargetApi; |
| 9 import android.app.Activity; | 9 import android.app.Activity; |
| 10 import android.content.ClipData; | 10 import android.content.ClipData; |
| 11 import android.content.ContentResolver; | 11 import android.content.ContentResolver; |
| 12 import android.content.Context; | 12 import android.content.Context; |
| 13 import android.content.Intent; | 13 import android.content.Intent; |
| 14 import android.content.pm.PackageManager; | 14 import android.content.pm.PackageManager; |
| 15 import android.net.Uri; | 15 import android.net.Uri; |
| 16 import android.os.AsyncTask; | 16 import android.os.AsyncTask; |
| 17 import android.os.Build; | 17 import android.os.Build; |
| 18 import android.provider.MediaStore; | 18 import android.provider.MediaStore; |
| 19 import android.text.TextUtils; | 19 import android.text.TextUtils; |
| 20 import android.util.Log; | 20 import android.util.Log; |
| 21 | 21 |
| 22 import org.chromium.base.ApiCompatibilityUtils; | |
| 22 import org.chromium.base.ContentUriUtils; | 23 import org.chromium.base.ContentUriUtils; |
| 23 import org.chromium.base.ContextUtils; | 24 import org.chromium.base.ContextUtils; |
| 24 import org.chromium.base.ThreadUtils; | 25 import org.chromium.base.ThreadUtils; |
| 25 import org.chromium.base.VisibleForTesting; | 26 import org.chromium.base.VisibleForTesting; |
| 26 import org.chromium.base.annotations.CalledByNative; | 27 import org.chromium.base.annotations.CalledByNative; |
| 27 import org.chromium.base.annotations.JNINamespace; | 28 import org.chromium.base.annotations.JNINamespace; |
| 28 import org.chromium.base.annotations.MainDex; | 29 import org.chromium.base.annotations.MainDex; |
| 29 import org.chromium.ui.R; | 30 import org.chromium.ui.R; |
| 30 import org.chromium.ui.UiUtils; | 31 import org.chromium.ui.UiUtils; |
| 31 | 32 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 if (!mWindowAndroid.showIntent(chooser, this, R.string.low_memory_error) ) { | 213 if (!mWindowAndroid.showIntent(chooser, this, R.string.low_memory_error) ) { |
| 213 onFileNotSelected(); | 214 onFileNotSelected(); |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 | 217 |
| 217 private class GetCameraIntentTask extends AsyncTask<Void, Void, Uri> { | 218 private class GetCameraIntentTask extends AsyncTask<Void, Void, Uri> { |
| 218 @Override | 219 @Override |
| 219 public Uri doInBackground(Void...voids) { | 220 public Uri doInBackground(Void...voids) { |
| 220 try { | 221 try { |
| 221 Context context = mWindowAndroid.getApplicationContext(); | 222 Context context = mWindowAndroid.getApplicationContext(); |
| 222 return UiUtils.getUriForImageCaptureFile(context, getFileForImag eCapture(context)); | 223 return ApiCompatibilityUtils.getUriForImageCaptureFile(context, |
| 224 getFileForImageCapture(context)); | |
|
Ted C
2017/01/18 01:00:20
+4 indent
| |
| 223 } catch (IOException e) { | 225 } catch (IOException e) { |
| 224 Log.e(TAG, "Cannot retrieve content uri from file", e); | 226 Log.e(TAG, "Cannot retrieve content uri from file", e); |
| 225 return null; | 227 return null; |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 | 230 |
| 229 @Override | 231 @Override |
| 230 protected void onPostExecute(Uri result) { | 232 protected void onPostExecute(Uri result) { |
| 231 mCameraOutputUri = result; | 233 mCameraOutputUri = result; |
| 232 if (mCameraOutputUri == null && captureCamera()) { | 234 if (mCameraOutputUri == null && captureCamera()) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 private static SelectFileDialog create(long nativeSelectFileDialog) { | 457 private static SelectFileDialog create(long nativeSelectFileDialog) { |
| 456 return new SelectFileDialog(nativeSelectFileDialog); | 458 return new SelectFileDialog(nativeSelectFileDialog); |
| 457 } | 459 } |
| 458 | 460 |
| 459 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, | 461 private native void nativeOnFileSelected(long nativeSelectFileDialogImpl, |
| 460 String filePath, String displayName); | 462 String filePath, String displayName); |
| 461 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo gImpl, | 463 private native void nativeOnMultipleFilesSelected(long nativeSelectFileDialo gImpl, |
| 462 String[] filePathArray, String[] displayNameArray); | 464 String[] filePathArray, String[] displayNameArray); |
| 463 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl) ; | 465 private native void nativeOnFileNotSelected(long nativeSelectFileDialogImpl) ; |
| 464 } | 466 } |
| OLD | NEW |