Bug 1443660 - Rename NavigationDelegate.onLoadUri() to onLoadRequest() r=jchen,esawin

MozReview-Commit-ID: o5NHVH6BMo
This commit is contained in:
James Willcox 2018-02-28 16:17:09 -05:00
parent 51b9d6b539
commit 8120c9ba80
7 changed files with 21 additions and 21 deletions

View File

@ -652,7 +652,7 @@ public class CustomTabsActivity extends AppCompatActivity
@Override
public void onNewSession(final GeckoSession session, final String uri,
final GeckoSession.Response<GeckoSession> response) {
// We should never get here because we abort loads that need a new session in onLoadUri()
// We should never get here because we abort loads that need a new session in onLoadRequest()
throw new IllegalStateException("Unexpected new session");
}

View File

@ -379,8 +379,8 @@ public class WebAppActivity extends AppCompatActivity
}
@Override
public boolean onLoadUri(final GeckoSession session, final String urlStr,
final int target) {
public boolean onLoadRequest(final GeckoSession session, final String urlStr,
final int target) {
final Uri uri = Uri.parse(urlStr);
if (uri == null) {
// We can't really handle this, so deny it?
@ -430,7 +430,7 @@ public class WebAppActivity extends AppCompatActivity
@Override
public void onNewSession(final GeckoSession session, final String uri,
final GeckoSession.Response<GeckoSession> response) {
// We should never get here because we abort loads that need a new session in onLoadUri()
// We should never get here because we abort loads that need a new session in onLoadRequest()
throw new IllegalStateException("Unexpected new session");
}

View File

@ -43,8 +43,8 @@ class NavigationDelegateTest {
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
@AssertCalled(count = 1, order = intArrayOf(1))
override fun onLoadUri(session: GeckoSession, uri: String,
where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String,
where: Int): Boolean {
assertThat("Session should not be null", session, notNullValue())
assertThat("URI should not be null", uri, notNullValue())
assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
@ -89,8 +89,8 @@ class NavigationDelegateTest {
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
@AssertCalled(count = 1, order = intArrayOf(1))
override fun onLoadUri(session: GeckoSession, uri: String,
where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String,
where: Int): Boolean {
assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
assertThat("Where should match", where,
equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
@ -138,8 +138,8 @@ class NavigationDelegateTest {
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
@AssertCalled(count = 1, order = intArrayOf(1))
override fun onLoadUri(session: GeckoSession, uri: String,
where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String,
where: Int): Boolean {
assertThat("URI should match", uri, endsWith(HELLO_HTML_PATH))
assertThat("Where should match", where,
equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
@ -172,8 +172,8 @@ class NavigationDelegateTest {
sessionRule.forCallbacksDuringWait(object : Callbacks.NavigationDelegate {
@AssertCalled(count = 1, order = intArrayOf(1))
override fun onLoadUri(session: GeckoSession, uri: String,
where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String,
where: Int): Boolean {
assertThat("URI should match", uri, endsWith(HELLO2_HTML_PATH))
assertThat("Where should match", where,
equalTo(GeckoSession.NavigationDelegate.TARGET_WINDOW_CURRENT))
@ -205,8 +205,8 @@ class NavigationDelegateTest {
@Test fun onLoadUri_returnTrueCancelsLoad() {
sessionRule.delegateDuringNextWait(object : Callbacks.NavigationDelegate {
@AssertCalled(count = 2)
override fun onLoadUri(session: GeckoSession, uri: String,
where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String,
where: Int): Boolean {
return uri.endsWith(HELLO_HTML_PATH)
}
})

View File

@ -40,7 +40,7 @@ public class TestRunnerActivity extends Activity {
}
@Override
public boolean onLoadUri(GeckoSession session, String uri, int target) {
public boolean onLoadRequest(GeckoSession session, String uri, int target) {
// Allow Gecko to load all URIs
return false;
}

View File

@ -40,7 +40,7 @@ class Callbacks private constructor() {
override fun onCanGoForward(session: GeckoSession, canGoForward: Boolean) {
}
override fun onLoadUri(session: GeckoSession, uri: String, where: Int): Boolean {
override fun onLoadRequest(session: GeckoSession, uri: String, where: Int): Boolean {
return false;
}

View File

@ -154,7 +154,7 @@ public class GeckoSession extends LayerSession
final String uri = message.getString("uri");
final int where = convertGeckoTarget(message.getInt("where"));
final boolean result =
delegate.onLoadUri(GeckoSession.this, uri, where);
delegate.onLoadRequest(GeckoSession.this, uri, where);
callback.sendSuccess(result);
} else if ("GeckoView:OnNewSession".equals(event)) {
final String uri = message.getString("uri");
@ -1422,7 +1422,7 @@ public class GeckoSession extends LayerSession
* @return Whether or not the load was handled. Returning false will allow Gecko
* to continue the load as normal.
*/
boolean onLoadUri(GeckoSession session, String uri, int target);
boolean onLoadRequest(GeckoSession session, String uri, int target);
/**
* A request has been made to open a new session. The URI is provided only for

View File

@ -348,9 +348,9 @@ public class GeckoViewActivity extends Activity {
}
@Override
public boolean onLoadUri(final GeckoSession session, final String uri,
final int target) {
Log.d(LOGTAG, "onLoadUri=" + uri + " where=" + target);
public boolean onLoadRequest(final GeckoSession session, final String uri,
final int target) {
Log.d(LOGTAG, "onLoadRequest=" + uri + " where=" + target);
return false;
}