Commit 746f23b6 authored by jdduke's avatar jdduke Committed by Commit bot

Remove deprecated overload of didNavigateMainFrame

The WebContentsObserver.didNavigateMainFrame overload without an
http status code is deprecated. Stop using it, also fixing an issue
where the wrong overload was called by WebContentsObserverProxy.

BUG=440134
TBR=dtrainor@chromium.org

Review URL: https://codereview.chromium.org/962103003

Cr-Commit-Position: refs/heads/master@{#319189}
parent fe30254f
......@@ -60,7 +60,7 @@ public class AwWebContentsObserver extends WebContentsObserver {
@Override
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation) {
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
// This is here to emulate the Classic WebView firing onPageFinished for main frame
// navigations where only the hash fragment changes.
if (isFragmentNavigation) {
......
......@@ -87,15 +87,16 @@ public class AwWebContentsObserverTest extends AwTestBase {
String baseUrl = null;
boolean navigationToDifferentPage = true;
boolean fragmentNavigation = true;
int httpStatusCode = 200;
callCount = mContentsClient.getOnPageFinishedHelper().getCallCount();
mWebContentsObserver.didNavigateMainFrame(EXAMPLE_URL, baseUrl,
!navigationToDifferentPage, fragmentNavigation);
!navigationToDifferentPage, fragmentNavigation, httpStatusCode);
assertEquals("onPageFinished should be called for main frame fragment navigations.",
callCount + 1, mContentsClient.getOnPageFinishedHelper().getCallCount());
callCount = mContentsClient.getOnPageFinishedHelper().getCallCount();
mWebContentsObserver.didNavigateMainFrame(EXAMPLE_URL, baseUrl,
!navigationToDifferentPage, !fragmentNavigation);
!navigationToDifferentPage, !fragmentNavigation, httpStatusCode);
assertEquals("onPageFinished should be called only for main frame fragment navigations.",
callCount, mContentsClient.getOnPageFinishedHelper().getCallCount());
}
......
......@@ -316,7 +316,7 @@ public class ContentViewCore
@Override
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation) {
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
if (!isNavigationToDifferentPage) return;
resetPopupsAndInput();
}
......
......@@ -102,21 +102,15 @@ class WebContentsObserverProxy extends WebContentsObserver {
}
@Override
@CalledByNative
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation) {
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
for (mObserversIterator.rewind(); mObserversIterator.hasNext();) {
mObserversIterator.next().didNavigateMainFrame(
url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation);
url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation, statusCode);
}
}
@Override
@CalledByNative
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
didNavigateMainFrame(url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation);
}
@Override
@CalledByNative
public void didFirstVisuallyNonEmptyPaint() {
......
......@@ -50,18 +50,6 @@ public abstract class WebContentsObserver {
public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
String description, String failingUrl) {}
/**
* Called when the main frame of the page has committed.
* TODO(pedrosimonetti): Remove this method once downstream changes are landed.
* @param url The validated url for the page.
* @param baseUrl The validated base url for the page.
* @param isNavigationToDifferentPage Whether the main frame navigated to a different page.
* @param isFragmentNavigation Whether the main frame navigation did not cause changes to the
* document (for example scrolling to a named anchor or PopState).
*/
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation) {}
/**
* Called when the main frame of the page has committed.
* @param url The validated url for the page.
......@@ -72,9 +60,7 @@ public abstract class WebContentsObserver {
* @param statusCode The HTTP status code of the navigation.
*/
public void didNavigateMainFrame(String url, String baseUrl,
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {
didNavigateMainFrame(url, baseUrl, isNavigationToDifferentPage, isFragmentNavigation);
}
boolean isNavigationToDifferentPage, boolean isFragmentNavigation, int statusCode) {}
/**
* Called when the page had painted something non-empty.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment