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

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: call onReceivedError before onPageFinished 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 if (errorCode != NetError.ERR_ABORTED) {
70 // - WebView.stopLoading is called, 71 // This error code is generated for the following reasons:
71 // - the navigation is intercepted by the embedder via shouldOve rrideNavigation. 72 // - WebView.stopLoading is called,
72 // 73 // - the navigation is intercepted by the embedder via shoul dOverrideNavigation.
73 // The Android WebView does not notify the embedder of these sit uations using this 74 //
74 // error code with the WebViewClient.onReceivedError callback. 75 // The Android WebView does not notify the embedder of these situations using
75 return; 76 // this error code with the WebViewClient.onReceivedError ca llback.
77 AwContentsClient.this.onReceivedError(
78 ErrorCodeConversionHelper.convertErrorCode(errorCode ), description,
79 failingUrl);
80 }
81 AwContentsClient.this.onPageFinished(failingUrl);
boliu 2014/02/12 01:07:07 Definitely add a comment about the ordering. Even
76 } 82 }
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 } 83 }
84 84
85 @Override 85 @Override
86 public void didNavigateMainFrame(String url, String baseUrl, 86 public void didNavigateMainFrame(String url, String baseUrl,
87 boolean isNavigationToDifferentPage, boolean isNavigationInPage) { 87 boolean isNavigationToDifferentPage, boolean isNavigationInPage) {
88 // This is here to emulate the Classic WebView firing onPageFinished for main frame 88 // This is here to emulate the Classic WebView firing onPageFinished for main frame
89 // navigations where only the hash fragment changes. 89 // navigations where only the hash fragment changes.
90 if (isNavigationInPage) { 90 if (isNavigationInPage) {
91 AwContentsClient.this.onPageFinished(url); 91 AwContentsClient.this.onPageFinished(url);
92 } 92 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 public abstract void onFindResultReceived(int activeMatchOrdinal, int number OfMatches, 234 public abstract void onFindResultReceived(int activeMatchOrdinal, int number OfMatches,
235 boolean isDoneCounting); 235 boolean isDoneCounting);
236 236
237 /** 237 /**
238 * Called whenever there is a new content picture available. 238 * Called whenever there is a new content picture available.
239 * @param picture New picture. 239 * @param picture New picture.
240 */ 240 */
241 public abstract void onNewPicture(Picture picture); 241 public abstract void onNewPicture(Picture picture);
242 242
243 } 243 }
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