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 b933a6e48439a23d25ee45f4c4269c903f540f82..e239b3f2fbad505f76f17d435ced4164db40992a 100644 |
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java |
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClient.java |
@@ -11,6 +11,8 @@ import android.view.KeyEvent; |
import android.webkit.ConsoleMessage; |
import org.chromium.content.browser.ContentViewClient; |
+import org.chromium.content.browser.ContentViewCore; |
+import org.chromium.content.browser.WebContentsObserverAndroid; |
/** |
* Base-class that an AwContents embedder derives from to receive callbacks. |
@@ -102,6 +104,29 @@ public abstract class AwContentsClient extends ContentViewClient { |
} |
} |
+ class WebContentsObserverAdapter extends WebContentsObserverAndroid { |
+ public WebContentsObserverAdapter(ContentViewCore contentViewCore) { |
+ super(contentViewCore); |
+ } |
+ |
+ @Override |
+ public void didStartLoading(String url) { |
+ AwContentsClient.this.onPageStarted(url); |
+ } |
+ |
+ @Override |
+ public void didStopLoading(String url) { |
+ AwContentsClient.this.onPageFinished(url); |
+ } |
+ |
+ @Override |
+ public void didFailLoad(boolean isProvisionalLoad, |
+ boolean isMainFrame, int errorCode, String description, String failingUrl) { |
+ AwContentsClient.this.onReceivedError( |
+ ErrorCodeConversionHelper.convertErrorCode(errorCode), description, failingUrl); |
+ } |
+ } |
+ |
final AwWebContentsDelegate getWebContentsDelegate() { |
return mWebContentsDelegateAdapter; |
} |
@@ -140,16 +165,18 @@ public abstract class AwContentsClient extends ContentViewClient { |
public abstract void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, |
boolean isDoneCounting); |
+ public abstract void onPageStarted(String url); |
+ |
+ public abstract void onPageFinished(String url); |
+ |
+ public abstract void onReceivedError(int errorCode, String description, String failingUrl); |
+ |
//-------------------------------------------------------------------------------------------- |
// Stuff that we ignore since it only makes sense for Chrome browser |
//-------------------------------------------------------------------------------------------- |
// |
@Override |
- final public void onMainFrameCommitted(String url, String baseUrl) { |
- } |
- |
- @Override |
final public boolean shouldOverrideScroll(float dx, float dy, float scrollX, float scrollY) { |
return false; |
} |