| Index: android_webview/java/src/org/chromium/android_webview/AwViewAndroidDelegate.java
|
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwViewAndroidDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwViewAndroidDelegate.java
|
| index 80753a42d759693bfee599c44e4f3551e5c60f2b..3fc1ba3ee002f32884ff11668a29e1ed1b4629bf 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwViewAndroidDelegate.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwViewAndroidDelegate.java
|
| @@ -4,15 +4,18 @@
|
|
|
| package org.chromium.android_webview;
|
|
|
| +import android.content.Intent;
|
| import android.view.View;
|
| import android.view.ViewGroup;
|
| import android.widget.FrameLayout;
|
|
|
| +import org.chromium.base.Log;
|
| import org.chromium.base.VisibleForTesting;
|
| import org.chromium.content.browser.RenderCoordinates;
|
| import org.chromium.ui.base.ViewAndroidDelegate;
|
| import org.chromium.ui.display.DisplayAndroid;
|
|
|
| +import java.net.URISyntaxException;
|
| import java.util.LinkedHashMap;
|
| import java.util.Map;
|
| import java.util.Map.Entry;
|
| @@ -21,6 +24,9 @@ import java.util.Map.Entry;
|
| * Implementation of the abstract class {@link ViewAndroidDelegate} for WebView.
|
| */
|
| public class AwViewAndroidDelegate extends ViewAndroidDelegate {
|
| + /** Used for logging. */
|
| + private static final String TAG = "AwVAD";
|
| +
|
| /**
|
| * The current container view. This view can be updated with
|
| * {@link #updateCurrentContainerView()}.
|
| @@ -33,6 +39,7 @@ public class AwViewAndroidDelegate extends ViewAndroidDelegate {
|
| */
|
| private final Map<View, Position> mAnchorViews = new LinkedHashMap<>();
|
|
|
| + private final AwContentsClient mContentsClient;
|
| private final RenderCoordinates mRenderCoordinates;
|
|
|
| /**
|
| @@ -59,8 +66,10 @@ public class AwViewAndroidDelegate extends ViewAndroidDelegate {
|
| }
|
|
|
| @VisibleForTesting
|
| - public AwViewAndroidDelegate(ViewGroup containerView, RenderCoordinates renderCoordinates) {
|
| + public AwViewAndroidDelegate(ViewGroup containerView, AwContentsClient contentsClient,
|
| + RenderCoordinates renderCoordinates) {
|
| mContainerView = containerView;
|
| + mContentsClient = contentsClient;
|
| mRenderCoordinates = renderCoordinates;
|
| }
|
|
|
| @@ -137,6 +146,33 @@ public class AwViewAndroidDelegate extends ViewAndroidDelegate {
|
| }
|
|
|
| @Override
|
| + public void onBackgroundColorChanged(int color) {
|
| + mContentsClient.onBackgroundColorChanged(color);
|
| + }
|
| +
|
| + @Override
|
| + public void onStartContentIntent(String contentUrl, boolean isMainFrame) {
|
| + // Make sure that this URL is a valid scheme for this callback if interpreted as an intent,
|
| + // even though we don't dispatch it as an intent here, because many WebView apps will once
|
| + // it reaches them.
|
| + String scheme = null;
|
| + try {
|
| + Intent intent = Intent.parseUri(contentUrl, Intent.URI_INTENT_SCHEME);
|
| + scheme = intent.getScheme();
|
| + } catch (URISyntaxException e) {
|
| + // Just don't set the scheme, it will be rejected.
|
| + }
|
| + if (!isAcceptableContentIntentScheme(scheme)) {
|
| + Log.w(TAG, "Invalid scheme for URI %s", contentUrl);
|
| + return;
|
| + }
|
| + // Comes from WebViewImpl::detectContentOnTouch in Blink, so must be user-initiated, and
|
| + // isn't a redirect.
|
| + mContentsClient.shouldIgnoreNavigation(mContainerView.getContext(), contentUrl,
|
| + isMainFrame, true, false);
|
| + }
|
| +
|
| + @Override
|
| public ViewGroup getContainerView() {
|
| return mContainerView;
|
| }
|
|
|