OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 org.chromium.android_webview.AwContents.VisualStateCallback; | 7 import org.chromium.android_webview.AwContents.VisualStateCallback; |
8 import org.chromium.base.ThreadUtils; | 8 import org.chromium.base.ThreadUtils; |
9 import org.chromium.content_public.browser.WebContents; | 9 import org.chromium.content_public.browser.WebContents; |
10 import org.chromium.content_public.browser.WebContentsObserver; | 10 import org.chromium.content_public.browser.WebContentsObserver; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 @Override | 48 @Override |
49 public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int
errorCode, | 49 public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int
errorCode, |
50 String description, String failingUrl, boolean wasIgnoredByHandler)
{ | 50 String description, String failingUrl, boolean wasIgnoredByHandler)
{ |
51 AwContentsClient client = mAwContentsClient.get(); | 51 AwContentsClient client = mAwContentsClient.get(); |
52 if (client == null) return; | 52 if (client == null) return; |
53 String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUr
l(); | 53 String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUr
l(); |
54 boolean isErrorUrl = | 54 boolean isErrorUrl = |
55 unreachableWebDataUrl != null && unreachableWebDataUrl.equals(fa
ilingUrl); | 55 unreachableWebDataUrl != null && unreachableWebDataUrl.equals(fa
ilingUrl); |
56 if (isMainFrame && !isErrorUrl && errorCode == NetError.ERR_ABORTED) { | 56 if (isMainFrame && !isErrorUrl && errorCode == NetError.ERR_ABORTED |
| 57 && !wasIgnoredByHandler) { |
57 // Need to call onPageFinished for backwards compatibility with the
classic webview. | 58 // Need to call onPageFinished for backwards compatibility with the
classic webview. |
58 // See also AwContents.IoThreadClientImpl.onReceivedError. | 59 // See also AwContents.IoThreadClientImpl.onReceivedError. |
| 60 // If the navigation was ignored because of shouldOverrideUrlLoading
we have already |
| 61 // called onPageFinished in |
| 62 // AwContents.InterceptNavigationDelegateImpl.shouldIgnoreNavigation
instead. |
59 client.getCallbackHelper().postOnPageFinished(failingUrl); | 63 client.getCallbackHelper().postOnPageFinished(failingUrl); |
60 } | 64 } |
61 } | 65 } |
62 | 66 |
63 @Override | 67 @Override |
64 public void didNavigateMainFrame(final String url, String baseUrl, | 68 public void didNavigateMainFrame(final String url, String baseUrl, |
65 boolean isNavigationToDifferentPage, boolean isFragmentNavigation, i
nt statusCode) { | 69 boolean isNavigationToDifferentPage, boolean isFragmentNavigation, i
nt statusCode) { |
66 // Only invoke the onPageCommitVisible callback when navigating to a dif
ferent page, | 70 // Only invoke the onPageCommitVisible callback when navigating to a dif
ferent page, |
67 // but not when navigating to a different fragment within the same page. | 71 // but not when navigating to a different fragment within the same page. |
68 if (isNavigationToDifferentPage) { | 72 if (isNavigationToDifferentPage) { |
(...skipping 30 matching lines...) Expand all Loading... |
99 mCommittedNavigation = true; | 103 mCommittedNavigation = true; |
100 final AwContentsClient client = mAwContentsClient.get(); | 104 final AwContentsClient client = mAwContentsClient.get(); |
101 if (client == null) return; | 105 if (client == null) return; |
102 client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload); | 106 client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload); |
103 } | 107 } |
104 | 108 |
105 public boolean didEverCommitNavigation() { | 109 public boolean didEverCommitNavigation() { |
106 return mCommittedNavigation; | 110 return mCommittedNavigation; |
107 } | 111 } |
108 } | 112 } |
OLD | NEW |