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

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

Issue 2598163002: WebContentsObserver update for PlzNavigate methods (Closed)
Patch Set: Revert back a state CHECK Created 3 years, 11 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 | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 @Override 82 @Override
83 public void titleWasSet(String title) { 83 public void titleWasSet(String title) {
84 AwContentsClient client = mAwContentsClient.get(); 84 AwContentsClient client = mAwContentsClient.get();
85 if (client == null) return; 85 if (client == null) return;
86 client.updateTitle(title, true); 86 client.updateTitle(title, true);
87 } 87 }
88 88
89 @Override 89 @Override
90 public void didNavigateMainFrame(final String url, String baseUrl, 90 public void didFinishNavigation(final String url, boolean isInMainFrame, boo lean isErrorPage,
91 boolean isNavigationToDifferentPage, boolean isFragmentNavigation, i nt statusCode) { 91 boolean hasCommitted, boolean isSamePage, boolean isReload) {
92 mCommittedNavigation = true;
93 AwContentsClient client = mAwContentsClient.get();
94 if (client != null) {
95 client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload) ;
96 }
97
92 // Only invoke the onPageCommitVisible callback when navigating to a dif ferent page, 98 // Only invoke the onPageCommitVisible callback when navigating to a dif ferent page,
93 // but not when navigating to a different fragment within the same page. 99 // but not when navigating to a different fragment within the same page.
94 if (isNavigationToDifferentPage) { 100 if (isInMainFrame && !isSamePage) {
95 ThreadUtils.postOnUiThread(new Runnable() { 101 ThreadUtils.postOnUiThread(new Runnable() {
96 @Override 102 @Override
97 public void run() { 103 public void run() {
98 AwContents awContents = mAwContents.get(); 104 AwContents awContents = mAwContents.get();
99 if (awContents != null) { 105 if (awContents != null) {
100 awContents.insertVisualStateCallbackIfNotDestroyed( 106 awContents.insertVisualStateCallbackIfNotDestroyed(
101 0, new VisualStateCallback() { 107 0, new VisualStateCallback() {
102 @Override 108 @Override
103 public void onComplete(long requestId) { 109 public void onComplete(long requestId) {
104 AwContentsClient client = mAwContentsCli ent.get(); 110 AwContentsClient client = mAwContentsCli ent.get();
105 if (client == null) return; 111 if (client == null) return;
106 client.onPageCommitVisible(url); 112 client.onPageCommitVisible(url);
107 } 113 }
108 }); 114 });
109 } 115 }
110 } 116 }
111 }); 117 });
112 } 118 }
113 119
114 // This is here to emulate the Classic WebView firing onPageFinished for main frame 120 // This is here to emulate the Classic WebView firing onPageFinished for main frame
115 // navigations where only the hash fragment changes. 121 // navigations where only the hash fragment changes.
116 if (isFragmentNavigation) { 122 if (isSamePage && client != null) {
117 AwContentsClient client = mAwContentsClient.get();
118 if (client == null) return;
119 client.getCallbackHelper().postOnPageFinished(url); 123 client.getCallbackHelper().postOnPageFinished(url);
120 } 124 }
121 } 125 }
122 126
123 @Override
124 public void didNavigateAnyFrame(String url, String baseUrl, boolean isReload ) {
125 mCommittedNavigation = true;
126 final AwContentsClient client = mAwContentsClient.get();
127 if (client == null) return;
128 client.getCallbackHelper().postDoUpdateVisitedHistory(url, isReload);
129 }
130
131 public boolean didEverCommitNavigation() { 127 public boolean didEverCommitNavigation() {
132 return mCommittedNavigation; 128 return mCommittedNavigation;
133 } 129 }
134 } 130 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698