Bug 1509266 - [2.0] Update onContextMenu delegate implementations. r=snorp

Differential Revision: https://phabricator.services.mozilla.com/D12968

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eugen Sawin 2018-11-27 20:30:47 +00:00
Родитель 29411ef725
Коммит 29cc0db15f
6 изменённых файлов: 30 добавлений и 18 удалений

Просмотреть файл

@ -899,9 +899,9 @@ public abstract class GeckoApp extends GeckoActivity
}
@Override
public void onContextMenu(final GeckoSession session, final int screenX,
final int screenY, final String uri,
int elementType, final String elementSrc) {
public void onContextMenu(final GeckoSession session,
final int screenX, final int screenY,
final GeckoSession.ContentDelegate.ContextElement element) {
}
@Override

Просмотреть файл

@ -695,11 +695,12 @@ public class CustomTabsActivity extends AppCompatActivity
}
@Override
public void onContextMenu(GeckoSession session, int screenX, int screenY,
final String uri, int elementType,
final String elementSrc) {
final String content = uri != null ? uri : elementSrc != null ? elementSrc : "";
public void onContextMenu(final GeckoSession session,
int screenX, int screenY,
final ContextElement element) {
final String content = element.linkUri != null
? element.linkUri
: element.srcUri != null ? element.srcUri : "";
final Uri validUri = WebApps.getValidURL(content);
if (validUri == null) {
return;

Просмотреть файл

@ -352,9 +352,12 @@ public class WebAppActivity extends AppCompatActivity
}
@Override // GeckoSession.ContentDelegate
public void onContextMenu(GeckoSession session, int screenX, int screenY,
String uri, int elementType, String elementSrc) {
final String content = uri != null ? uri : elementSrc != null ? elementSrc : "";
public void onContextMenu(final GeckoSession session,
int screenX, int screenY,
final ContextElement element) {
final String content = element.linkUri != null
? element.linkUri
: element.srcUri != null ? element.srcUri : "";
final Uri validUri = WebApps.getValidURL(content);
if (validUri == null) {
return;

Просмотреть файл

@ -94,7 +94,8 @@ public class TestRunnerActivity extends Activity {
}
@Override
public void onContextMenu(GeckoSession session, int screenX, int screenY, String uri, int elementType, String elementSrc) {
public void onContextMenu(GeckoSession session, int screenX, int screenY,
ContextElement element) {
}

Просмотреть файл

@ -9,6 +9,7 @@ import org.mozilla.geckoview.AllowOrDeny
import org.mozilla.geckoview.GeckoResponse
import org.mozilla.geckoview.GeckoResult
import org.mozilla.geckoview.GeckoSession
import org.mozilla.geckoview.GeckoSession.ContentDelegate.ContextElement
import org.mozilla.geckoview.GeckoSession.NavigationDelegate.LoadRequest
import org.mozilla.geckoview.MediaElement
import org.mozilla.geckoview.WebRequestError
@ -38,7 +39,9 @@ class Callbacks private constructor() {
override fun onFullScreen(session: GeckoSession, fullScreen: Boolean) {
}
override fun onContextMenu(session: GeckoSession, screenX: Int, screenY: Int, uri: String, elementType: Int, elementSrc: String) {
override fun onContextMenu(session: GeckoSession,
screenX: Int, screenY: Int,
element: ContextElement) {
}
override fun onExternalResponse(session: GeckoSession, response: GeckoSession.WebResponseInfo) {

Просмотреть файл

@ -476,12 +476,16 @@ public class GeckoViewActivity extends AppCompatActivity {
}
@Override
public void onContextMenu(GeckoSession session, int screenX, int screenY,
String uri, int elementType, String elementSrc) {
public void onContextMenu(final GeckoSession session,
int screenX, int screenY,
final ContextElement element) {
Log.d(LOGTAG, "onContextMenu screenX=" + screenX +
" screenY=" + screenY + " uri=" + uri +
" elementType=" + elementType +
" elementSrc=" + elementSrc);
" screenY=" + screenY +
" type=" + element.type +
" linkUri=" + element.linkUri +
" title=" + element.title +
" alt=" + element.altText +
" srcUri=" + element.srcUri);
}
@Override