Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1560)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java

Issue 2694273002: Revert of Refactor ContentViewClient (4/6) (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
index c258f92a25ab5697f10a7c74694ac84419d6ea18..ff33c778a41001192b5aaa9c66067f102079413a 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentViewClient.java
@@ -4,9 +4,14 @@
package org.chromium.android_webview;
+import android.content.Context;
+import android.content.Intent;
import android.view.KeyEvent;
+import org.chromium.base.Log;
import org.chromium.content.browser.ContentViewClient;
+
+import java.net.URISyntaxException;
/**
* ContentViewClient implementation for WebView
@@ -17,12 +22,40 @@
private final AwContentsClient mAwContentsClient;
private final AwSettings mAwSettings;
private final AwContents mAwContents;
+ private final Context mContext;
public AwContentViewClient(AwContentsClient awContentsClient, AwSettings awSettings,
- AwContents awContents) {
+ AwContents awContents, Context context) {
mAwContentsClient = awContentsClient;
mAwSettings = awSettings;
mAwContents = awContents;
+ mContext = context;
+ }
+
+ @Override
+ public void onBackgroundColorChanged(int color) {
+ mAwContentsClient.onBackgroundColorChanged(color);
+ }
+
+ @Override
+ public void onStartContentIntent(Context context, 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.
+ mAwContentsClient.shouldIgnoreNavigation(context, contentUrl, isMainFrame, true, false);
}
@Override
@@ -30,7 +63,7 @@
if (mAwContentsClient.hasWebViewClient()) {
// The check below is reflecting Chrome's behavior and is a workaround for
// http://b/7697782.
- if (!shouldPropagateKey(event.getKeyCode())) return true;
+ if (!ContentViewClient.shouldPropagateKey(event.getKeyCode())) return true;
return mAwContentsClient.shouldOverrideKeyEvent(event);
}
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698