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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContentsClient.java

Issue 144283007: Call WebViewClient#onPageFinished when a main frame fails to load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.content.pm.ActivityInfo; 7 import android.content.pm.ActivityInfo;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.graphics.Picture; 9 import android.graphics.Picture;
10 import android.net.http.SslError; 10 import android.net.http.SslError;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 mCallbackHelper = new AwContentsClientCallbackHelper(looper, this); 51 mCallbackHelper = new AwContentsClientCallbackHelper(looper, this);
52 } 52 }
53 53
54 class AwWebContentsObserver extends WebContentsObserverAndroid { 54 class AwWebContentsObserver extends WebContentsObserverAndroid {
55 public AwWebContentsObserver(ContentViewCore contentViewCore) { 55 public AwWebContentsObserver(ContentViewCore contentViewCore) {
56 super(contentViewCore); 56 super(contentViewCore);
57 } 57 }
58 58
59 @Override 59 @Override
60 public void didFinishLoad(long frameId, String validatedUrl, boolean isM ainFrame) { 60 public void didFinishLoad(long frameId, String validatedUrl, boolean isM ainFrame) {
61 if (isMainFrame) 61 if (isMainFrame) {
62 AwContentsClient.this.onPageFinished(validatedUrl); 62 AwContentsClient.this.onPageFinished(validatedUrl);
63 }
63 } 64 }
64 65
65 @Override 66 @Override
66 public void didFailLoad(boolean isProvisionalLoad, 67 public void didFailLoad(boolean isProvisionalLoad,
67 boolean isMainFrame, int errorCode, String description, String f ailingUrl) { 68 boolean isMainFrame, int errorCode, String description, String f ailingUrl) {
68 if (errorCode == NetError.ERR_ABORTED) { 69 if (isMainFrame) {
69 // This error code is generated for the following reasons: 70 AwContentsClient.this.onPageFinished(failingUrl);
boliu 2014/02/11 23:40:03 Check what the ordering of onPageFinished vs onRec
70 // - WebView.stopLoading is called, 71 if (errorCode == NetError.ERR_ABORTED) {
71 // - the navigation is intercepted by the embedder via shouldOve rrideNavigation. 72 // This error code is generated for the following reasons:
72 // 73 // - WebView.stopLoading is called,
73 // The Android WebView does not notify the embedder of these sit uations using this 74 // - the navigation is intercepted by the embedder via shoul dOverrideNavigation.
74 // error code with the WebViewClient.onReceivedError callback. 75 //
75 return; 76 // The Android WebView does not notify the embedder of these situations using
77 // this error code with the WebViewClient.onReceivedError ca llback.
78 return;
79 }
80 AwContentsClient.this.onReceivedError(
81 ErrorCodeConversionHelper.convertErrorCode(errorCode), d escription,
82 failingUrl);
76 } 83 }
77 if (!isMainFrame) {
78 // The Android WebView does not notify the embedder of sub-frame failures.
79 return;
80 }
81 AwContentsClient.this.onReceivedError(
82 ErrorCodeConversionHelper.convertErrorCode(errorCode), descr iption, failingUrl);
83 } 84 }
84 85
85 @Override 86 @Override
86 public void didNavigateMainFrame(String url, String baseUrl, 87 public void didNavigateMainFrame(String url, String baseUrl,
87 boolean isNavigationToDifferentPage, boolean isNavigationInPage) { 88 boolean isNavigationToDifferentPage, boolean isNavigationInPage) {
88 // This is here to emulate the Classic WebView firing onPageFinished for main frame 89 // This is here to emulate the Classic WebView firing onPageFinished for main frame
89 // navigations where only the hash fragment changes. 90 // navigations where only the hash fragment changes.
90 if (isNavigationInPage) { 91 if (isNavigationInPage) {
91 AwContentsClient.this.onPageFinished(url); 92 AwContentsClient.this.onPageFinished(url);
92 } 93 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 public abstract void onFindResultReceived(int activeMatchOrdinal, int number OfMatches, 235 public abstract void onFindResultReceived(int activeMatchOrdinal, int number OfMatches,
235 boolean isDoneCounting); 236 boolean isDoneCounting);
236 237
237 /** 238 /**
238 * Called whenever there is a new content picture available. 239 * Called whenever there is a new content picture available.
239 * @param picture New picture. 240 * @param picture New picture.
240 */ 241 */
241 public abstract void onNewPicture(Picture picture); 242 public abstract void onNewPicture(Picture picture);
242 243
243 } 244 }
OLDNEW
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698