OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.android_webview; | 5 package org.chromium.android_webview; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.ContentResolver; | 8 import android.content.ContentResolver; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.media.AudioManager; | 10 import android.media.AudioManager; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 mContentsClient.getCallbackHelper().postOnFormResubmission(dontResend, r
esend); | 218 mContentsClient.getCallbackHelper().postOnFormResubmission(dontResend, r
esend); |
219 } | 219 } |
220 | 220 |
221 @Override | 221 @Override |
222 public void runFileChooser(final int processId, final int renderId, final in
t modeFlags, | 222 public void runFileChooser(final int processId, final int renderId, final in
t modeFlags, |
223 String acceptTypes, String title, String defaultFilename, boolean ca
pture) { | 223 String acceptTypes, String title, String defaultFilename, boolean ca
pture) { |
224 AwContentsClient.FileChooserParamsImpl params = new AwContentsClient.Fil
eChooserParamsImpl( | 224 AwContentsClient.FileChooserParamsImpl params = new AwContentsClient.Fil
eChooserParamsImpl( |
225 modeFlags, acceptTypes, title, defaultFilename, capture); | 225 modeFlags, acceptTypes, title, defaultFilename, capture); |
226 | 226 |
227 mContentsClient.showFileChooser(new ValueCallback<String[]>() { | 227 mContentsClient.showFileChooser(new ValueCallback<String[]>() { |
228 boolean mCompleted = false; | 228 boolean mCompleted; |
229 @Override | 229 @Override |
230 public void onReceiveValue(String[] results) { | 230 public void onReceiveValue(String[] results) { |
231 if (mCompleted) { | 231 if (mCompleted) { |
232 throw new IllegalStateException("Duplicate showFileChooser r
esult"); | 232 throw new IllegalStateException("Duplicate showFileChooser r
esult"); |
233 } | 233 } |
234 mCompleted = true; | 234 mCompleted = true; |
235 if (results == null) { | 235 if (results == null) { |
236 nativeFilesSelectedInChooser( | 236 nativeFilesSelectedInChooser( |
237 processId, renderId, modeFlags, null, null); | 237 processId, renderId, modeFlags, null, null); |
238 return; | 238 return; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 * or an empty string otherwise. | 369 * or an empty string otherwise. |
370 */ | 370 */ |
371 private String resolveFileName(String filePath) { | 371 private String resolveFileName(String filePath) { |
372 if (mContentResolver == null || filePath == null) return ""; | 372 if (mContentResolver == null || filePath == null) return ""; |
373 Uri uri = Uri.parse(filePath); | 373 Uri uri = Uri.parse(filePath); |
374 return ContentUriUtils.getDisplayName( | 374 return ContentUriUtils.getDisplayName( |
375 uri, mContentResolver, MediaStore.MediaColumns.DISPLAY_NAME)
; | 375 uri, mContentResolver, MediaStore.MediaColumns.DISPLAY_NAME)
; |
376 } | 376 } |
377 } | 377 } |
378 } | 378 } |
OLD | NEW |