Commit 5c0d0363 authored by Alex Chu's avatar Alex Chu Committed by Commit Bot

Remove references to WebChromeClient.FileChooserParams from non-glue

layers.

Change-Id: I9e3119a11f8949f1452eeca19da45bbd9775222e
Bug: 736726
Reviewed-on: https://chromium-review.googlesource.com/651755
Commit-Queue: Alex Chu <alexchu@google.com>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#502783}
parent 7b2f6fee
...@@ -7,6 +7,7 @@ package com.android.webview.chromium; ...@@ -7,6 +7,7 @@ package com.android.webview.chromium;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
...@@ -1105,7 +1106,8 @@ class WebViewContentsClientAdapter extends AwContentsClient { ...@@ -1105,7 +1106,8 @@ class WebViewContentsClientAdapter extends AwContentsClient {
// Invoke the new callback introduced in Lollipop. If the app handles // Invoke the new callback introduced in Lollipop. If the app handles
// it, we're done here. // it, we're done here.
if (mWebChromeClient.onShowFileChooser(mWebView, callbackAdapter, fileChooserParams)) { if (mWebChromeClient.onShowFileChooser(
mWebView, callbackAdapter, fromAwFileChooserParams(fileChooserParams))) {
return; return;
} }
...@@ -1352,6 +1354,44 @@ class WebViewContentsClientAdapter extends AwContentsClient { ...@@ -1352,6 +1354,44 @@ class WebViewContentsClientAdapter extends AwContentsClient {
} }
} }
public static WebChromeClient.FileChooserParams fromAwFileChooserParams(
final AwContentsClient.FileChooserParamsImpl value) {
if (value == null) {
return null;
}
return new WebChromeClient.FileChooserParams() {
@Override
public int getMode() {
return value.getMode();
}
@Override
public String[] getAcceptTypes() {
return value.getAcceptTypes();
}
@Override
public boolean isCaptureEnabled() {
return value.isCaptureEnabled();
}
@Override
public CharSequence getTitle() {
return value.getTitle();
}
@Override
public String getFilenameHint() {
return value.getFilenameHint();
}
@Override
public Intent createIntent() {
return value.createIntent();
}
};
}
private static ConsoleMessage fromAwConsoleMessage(AwConsoleMessage value) { private static ConsoleMessage fromAwConsoleMessage(AwConsoleMessage value) {
if (value == null) { if (value == null) {
return null; return null;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
package org.chromium.android_webview; package org.chromium.android_webview;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
...@@ -19,7 +18,6 @@ import android.provider.Browser; ...@@ -19,7 +18,6 @@ import android.provider.Browser;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.webkit.WebChromeClient;
import org.chromium.android_webview.permission.AwPermissionRequest; import org.chromium.android_webview.permission.AwPermissionRequest;
import org.chromium.base.Callback; import org.chromium.base.Callback;
...@@ -238,10 +236,9 @@ public abstract class AwContentsClient { ...@@ -238,10 +236,9 @@ public abstract class AwContentsClient {
} }
/** /**
* Type adaptation class for FileChooserParams. * Type adaptation class for {@link android.webkit.FileChooserParams}.
*/ */
@SuppressLint("NewApi") // WebChromeClient.FileChooserParams requires API level 21. public static class FileChooserParamsImpl {
public static class FileChooserParamsImpl extends WebChromeClient.FileChooserParams {
private int mMode; private int mMode;
private String mAcceptTypes; private String mAcceptTypes;
private String mTitle; private String mTitle;
...@@ -261,12 +258,10 @@ public abstract class AwContentsClient { ...@@ -261,12 +258,10 @@ public abstract class AwContentsClient {
return mAcceptTypes; return mAcceptTypes;
} }
@Override
public int getMode() { public int getMode() {
return mMode; return mMode;
} }
@Override
public String[] getAcceptTypes() { public String[] getAcceptTypes() {
if (mAcceptTypes == null) { if (mAcceptTypes == null) {
return new String[0]; return new String[0];
...@@ -274,22 +269,18 @@ public abstract class AwContentsClient { ...@@ -274,22 +269,18 @@ public abstract class AwContentsClient {
return mAcceptTypes.split(";"); return mAcceptTypes.split(";");
} }
@Override
public boolean isCaptureEnabled() { public boolean isCaptureEnabled() {
return mCapture; return mCapture;
} }
@Override
public CharSequence getTitle() { public CharSequence getTitle() {
return mTitle; return mTitle;
} }
@Override
public String getFilenameHint() { public String getFilenameHint() {
return mDefaultFilename; return mDefaultFilename;
} }
@Override
public Intent createIntent() { public Intent createIntent() {
String mimeType = "*/*"; String mimeType = "*/*";
if (mAcceptTypes != null && !mAcceptTypes.trim().isEmpty()) { if (mAcceptTypes != null && !mAcceptTypes.trim().isEmpty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment