Commit 7747f225 authored by Shimi Zhang's avatar Shimi Zhang Committed by Commit Bot

[JJI] Remove AwContents param from WebMessageListener#onPostMessage()

This param is not necessary, since glue layer will figure out the
WebView instance.

In prepare of http://crrev/c/1745462.

Bug: 918065
Change-Id: I7f64f37943d008f3160a5201a7d34d77f97db9ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747247
Commit-Queue: Shimi Zhang <ctzsm@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686084}
parent 881f42fc
......@@ -2527,8 +2527,8 @@ public class AwContents implements SmartClipProvider {
messagePorts[i] = convertRawHandleToMessagePort(ports[i]);
}
MessagePort replyMessagePort = convertRawHandleToMessagePort(replyPort);
mWebMessageListener.onPostMessage(this, message, Uri.parse(sourceOrigin), isMainFrame,
replyMessagePort, messagePorts);
mWebMessageListener.onPostMessage(
message, Uri.parse(sourceOrigin), isMainFrame, replyMessagePort, messagePorts);
}
private static MessagePort convertRawHandleToMessagePort(int rawHandle) {
......
......@@ -16,7 +16,6 @@ import org.chromium.content_public.browser.MessagePort;
public interface WebMessageListener {
/**
* Receives postMessage information.
* @param awContents The associated {@link AwContents} of this onPostMessage() call.
* @param message The message from JavaScript.
* @param sourceOrigin The origin of the frame where the message is from.
* @param isMainframe If the message is from a main frame.
......@@ -25,6 +24,6 @@ public interface WebMessageListener {
* ports to establish new communication channels. Could be empty array but
* won't be null.
*/
void onPostMessage(AwContents awContents, String message, Uri sourceOrigin, boolean isMainFrame,
MessagePort replyPort, MessagePort[] ports);
void onPostMessage(String message, Uri sourceOrigin, boolean isMainFrame, MessagePort replyPort,
MessagePort[] ports);
}
......@@ -65,16 +65,14 @@ public class JsJavaInteractionTest {
private LinkedBlockingQueue<Data> mQueue = new LinkedBlockingQueue<>();
public static class Data {
public AwContents mAwContents;
public String mMessage;
public Uri mSourceOrigin;
public boolean mIsMainFrame;
public MessagePort mReplyPort;
public MessagePort[] mPorts;
public Data(AwContents awContents, String message, Uri sourceOrigin,
boolean isMainFrame, MessagePort replyPort, MessagePort[] ports) {
mAwContents = awContents;
public Data(String message, Uri sourceOrigin, boolean isMainFrame,
MessagePort replyPort, MessagePort[] ports) {
mMessage = message;
mSourceOrigin = sourceOrigin;
mIsMainFrame = isMainFrame;
......@@ -84,9 +82,9 @@ public class JsJavaInteractionTest {
}
@Override
public void onPostMessage(AwContents awContents, String message, Uri sourceOrigin,
boolean isMainFrame, MessagePort replyPort, MessagePort[] ports) {
mQueue.add(new Data(awContents, message, sourceOrigin, isMainFrame, replyPort, ports));
public void onPostMessage(String message, Uri sourceOrigin, boolean isMainFrame,
MessagePort replyPort, MessagePort[] ports) {
mQueue.add(new Data(message, sourceOrigin, isMainFrame, replyPort, ports));
}
public Data waitForOnPostMessage() throws Exception {
......
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