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

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

Issue 13136002: AwContentClient no longer extends ContentViewClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing onScaleChanged call Created 7 years, 8 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
Index: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
index 8f9f0f9b929f01188f51e1293b6ceb04e356b6e1..70cd68cf60c0d321ed3ff0b35cad242921930436 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java
@@ -5,6 +5,7 @@
package org.chromium.android_webview;
import android.content.pm.ActivityInfo;
+import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Picture;
import android.graphics.Rect;
@@ -36,7 +37,7 @@ import org.chromium.net.NetError;
* new abstract methods that the our own client must implement.
* i.e.: all methods in this class should either be final, or abstract.
*/
-public abstract class AwContentsClient extends ContentViewClient {
+public abstract class AwContentsClient {
private static final String TAG = "AwContentsClient";
private final AwContentsClientCallbackHelper mCallbackHelper =
@@ -44,6 +45,8 @@ public abstract class AwContentsClient extends ContentViewClient {
private AwWebContentsObserver mWebContentsObserver;
+ private AwContentViewClient mContentViewClient = new AwContentViewClient();
+
private double mDIPScale;
class AwWebContentsObserver extends WebContentsObserverAndroid {
@@ -62,7 +65,7 @@ public abstract class AwContentsClient extends ContentViewClient {
if (errorCode == NetError.ERR_ABORTED) {
// This error code is generated for the following reasons:
// - WebView.stopLoading is called,
- // - the navigation is intercepted by the embedder via shouldIgnoreNavigation.
+ // - the navigation is intercepted by the embedder via shouldOverrideNavigation.
//
// The Android WebView does not notify the embedder of these situations using this
// error code with the WebViewClient.onReceivedError callback.
@@ -83,14 +86,46 @@ public abstract class AwContentsClient extends ContentViewClient {
}
- void installWebContentsObserver(ContentViewCore contentViewCore) {
+ private class AwContentViewClient extends ContentViewClient {
+
+ @Override
+ public void onScaleChanged(float oldScale, float newScale) {
+ AwContentsClient.this.onScaleChangedScaled((float)(oldScale * mDIPScale),
+ (float)(newScale * mDIPScale));
+ }
+
+ @Override
+ public void onStartContentIntent(Context context, String contentUrl) {
+ // Callback when detecting a click on a content link.
+ AwContentsClient.this.shouldOverrideUrlLoading(contentUrl);
+ }
+
+ @Override
+ public void onTabCrash() {
+ // This is not possible so long as the webview is run single process!
+ throw new RuntimeException("Renderer crash reported.");
+ }
+
+ @Override
+ public void onUpdateTitle(String title) {
+ AwContentsClient.this.onReceivedTitle(title);
+ }
+
+ @Override
+ public boolean shouldOverrideKeyEvent(KeyEvent event) {
+ return AwContentsClient.this.shouldOverrideKeyEvent(event);
+ }
+
+ }
+
+ final void installWebContentsObserver(ContentViewCore contentViewCore) {
if (mWebContentsObserver != null) {
mWebContentsObserver.detachFromWebContents();
}
mWebContentsObserver = new AwWebContentsObserver(contentViewCore);
}
- void setDIPScale(double dipScale) {
+ final void setDIPScale(double dipScale) {
mDIPScale = dipScale;
}
@@ -98,6 +133,10 @@ public abstract class AwContentsClient extends ContentViewClient {
return mCallbackHelper;
}
+ final ContentViewClient getContentViewClient() {
+ return mContentViewClient;
+ }
+
//--------------------------------------------------------------------------------------------
// WebView specific methods that map directly to WebViewClient / WebChromeClient
//--------------------------------------------------------------------------------------------
@@ -110,9 +149,11 @@ public abstract class AwContentsClient extends ContentViewClient {
public abstract InterceptedRequestData shouldInterceptRequest(String url);
- public abstract void onLoadResource(String url);
+ public abstract boolean shouldOverrideKeyEvent(KeyEvent event);
- public abstract boolean shouldIgnoreNavigation(String url);
+ public abstract boolean shouldOverrideUrlLoading(String url);
+
+ public abstract void onLoadResource(String url);
public abstract void onUnhandledKeyEvent(KeyEvent event);
@@ -135,10 +176,6 @@ public abstract class AwContentsClient extends ContentViewClient {
public abstract void onGeolocationPermissionsHidePrompt();
- public final void onScaleChanged(float oldScale, float newScale) {
- onScaleChangedScaled((float)(oldScale * mDIPScale), (float)(newScale * mDIPScale));
- }
-
public abstract void onScaleChangedScaled(float oldScale, float newScale);
protected abstract void handleJsAlert(String url, String message, JsResultReceiver receiver);
@@ -159,6 +196,8 @@ public abstract class AwContentsClient extends ContentViewClient {
public abstract void onReceivedIcon(Bitmap bitmap);
+ public abstract void onReceivedTitle(String title);
+
protected abstract void onRequestFocus();
protected abstract View getVideoLoadingProgressView();
@@ -198,21 +237,4 @@ public abstract class AwContentsClient extends ContentViewClient {
*/
public abstract void onNewPicture(Picture picture);
- //--------------------------------------------------------------------------------------------
- // Stuff that we ignore since it only makes sense for Chrome browser
- //--------------------------------------------------------------------------------------------
- //
-
- @Override
- final public boolean shouldOverrideScroll(float dx, float dy, float scrollX, float scrollY) {
- return false;
- }
-
- @Override
- final public void onContextualActionBarShown() {
- }
-
- @Override
- final public void onContextualActionBarHidden() {
- }
}

Powered by Google App Engine
This is Rietveld 408576698