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.content.browser.WebContentsObserver; | 7 import org.chromium.content.browser.WebContentsObserver; |
8 import org.chromium.content_public.browser.WebContents; | 8 import org.chromium.content_public.browser.WebContents; |
9 import org.chromium.net.NetError; | 9 import org.chromium.net.NetError; |
10 | 10 |
11 /** | 11 /** |
12 * Routes notifications from WebContents to AwContentsClient and other listeners
. | 12 * Routes notifications from WebContents to AwContentsClient and other listeners
. |
13 */ | 13 */ |
14 public class AwWebContentsObserver extends WebContentsObserver { | 14 public class AwWebContentsObserver extends WebContentsObserver { |
15 private final AwContentsClient mAwContentsClient; | 15 private final AwContentsClient mAwContentsClient; |
| 16 private boolean mHasStartedAnyProvisionalLoad = false; |
16 | 17 |
17 public AwWebContentsObserver(WebContents webContents, AwContentsClient awCon
tentsClient) { | 18 public AwWebContentsObserver(WebContents webContents, AwContentsClient awCon
tentsClient) { |
18 super(webContents); | 19 super(webContents); |
19 mAwContentsClient = awContentsClient; | 20 mAwContentsClient = awContentsClient; |
20 } | 21 } |
21 | 22 |
| 23 boolean hasStartedAnyProvisionalLoad() { |
| 24 return mHasStartedAnyProvisionalLoad; |
| 25 } |
| 26 |
22 @Override | 27 @Override |
23 public void didFinishLoad(long frameId, String validatedUrl, boolean isMainF
rame) { | 28 public void didFinishLoad(long frameId, String validatedUrl, boolean isMainF
rame) { |
24 String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUr
l(); | 29 String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUr
l(); |
25 boolean isErrorUrl = | 30 boolean isErrorUrl = |
26 unreachableWebDataUrl != null && unreachableWebDataUrl.equals(va
lidatedUrl); | 31 unreachableWebDataUrl != null && unreachableWebDataUrl.equals(va
lidatedUrl); |
27 if (isMainFrame && !isErrorUrl) { | 32 if (isMainFrame && !isErrorUrl) { |
28 mAwContentsClient.onPageFinished(validatedUrl); | 33 mAwContentsClient.onPageFinished(validatedUrl); |
29 } | 34 } |
30 } | 35 } |
31 | 36 |
(...skipping 28 matching lines...) Expand all Loading... |
60 // navigations where only the hash fragment changes. | 65 // navigations where only the hash fragment changes. |
61 if (isFragmentNavigation) { | 66 if (isFragmentNavigation) { |
62 mAwContentsClient.onPageFinished(url); | 67 mAwContentsClient.onPageFinished(url); |
63 } | 68 } |
64 } | 69 } |
65 | 70 |
66 @Override | 71 @Override |
67 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload
) { | 72 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload
) { |
68 mAwContentsClient.doUpdateVisitedHistory(url, isReload); | 73 mAwContentsClient.doUpdateVisitedHistory(url, isReload); |
69 } | 74 } |
| 75 |
| 76 @Override |
| 77 public void didStartProvisionalLoadForFrame( |
| 78 long frameId, |
| 79 long parentFrameId, |
| 80 boolean isMainFrame, |
| 81 String validatedUrl, |
| 82 boolean isErrorPage, |
| 83 boolean isIframeSrcdoc) { |
| 84 mHasStartedAnyProvisionalLoad = true; |
| 85 } |
70 } | 86 } |
OLD | NEW |