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 { ...@@ -2527,8 +2527,8 @@ public class AwContents implements SmartClipProvider {
messagePorts[i] = convertRawHandleToMessagePort(ports[i]); messagePorts[i] = convertRawHandleToMessagePort(ports[i]);
} }
MessagePort replyMessagePort = convertRawHandleToMessagePort(replyPort); MessagePort replyMessagePort = convertRawHandleToMessagePort(replyPort);
mWebMessageListener.onPostMessage(this, message, Uri.parse(sourceOrigin), isMainFrame, mWebMessageListener.onPostMessage(
replyMessagePort, messagePorts); message, Uri.parse(sourceOrigin), isMainFrame, replyMessagePort, messagePorts);
} }
private static MessagePort convertRawHandleToMessagePort(int rawHandle) { private static MessagePort convertRawHandleToMessagePort(int rawHandle) {
......
...@@ -16,7 +16,6 @@ import org.chromium.content_public.browser.MessagePort; ...@@ -16,7 +16,6 @@ import org.chromium.content_public.browser.MessagePort;
public interface WebMessageListener { public interface WebMessageListener {
/** /**
* Receives postMessage information. * Receives postMessage information.
* @param awContents The associated {@link AwContents} of this onPostMessage() call.
* @param message The message from JavaScript. * @param message The message from JavaScript.
* @param sourceOrigin The origin of the frame where the message is from. * @param sourceOrigin The origin of the frame where the message is from.
* @param isMainframe If the message is from a main frame. * @param isMainframe If the message is from a main frame.
...@@ -25,6 +24,6 @@ public interface WebMessageListener { ...@@ -25,6 +24,6 @@ public interface WebMessageListener {
* ports to establish new communication channels. Could be empty array but * ports to establish new communication channels. Could be empty array but
* won't be null. * won't be null.
*/ */
void onPostMessage(AwContents awContents, String message, Uri sourceOrigin, boolean isMainFrame, void onPostMessage(String message, Uri sourceOrigin, boolean isMainFrame, MessagePort replyPort,
MessagePort replyPort, MessagePort[] ports); MessagePort[] ports);
} }
...@@ -65,16 +65,14 @@ public class JsJavaInteractionTest { ...@@ -65,16 +65,14 @@ public class JsJavaInteractionTest {
private LinkedBlockingQueue<Data> mQueue = new LinkedBlockingQueue<>(); private LinkedBlockingQueue<Data> mQueue = new LinkedBlockingQueue<>();
public static class Data { public static class Data {
public AwContents mAwContents;
public String mMessage; public String mMessage;
public Uri mSourceOrigin; public Uri mSourceOrigin;
public boolean mIsMainFrame; public boolean mIsMainFrame;
public MessagePort mReplyPort; public MessagePort mReplyPort;
public MessagePort[] mPorts; public MessagePort[] mPorts;
public Data(AwContents awContents, String message, Uri sourceOrigin, public Data(String message, Uri sourceOrigin, boolean isMainFrame,
boolean isMainFrame, MessagePort replyPort, MessagePort[] ports) { MessagePort replyPort, MessagePort[] ports) {
mAwContents = awContents;
mMessage = message; mMessage = message;
mSourceOrigin = sourceOrigin; mSourceOrigin = sourceOrigin;
mIsMainFrame = isMainFrame; mIsMainFrame = isMainFrame;
...@@ -84,9 +82,9 @@ public class JsJavaInteractionTest { ...@@ -84,9 +82,9 @@ public class JsJavaInteractionTest {
} }
@Override @Override
public void onPostMessage(AwContents awContents, String message, Uri sourceOrigin, public void onPostMessage(String message, Uri sourceOrigin, boolean isMainFrame,
boolean isMainFrame, MessagePort replyPort, MessagePort[] ports) { MessagePort replyPort, MessagePort[] ports) {
mQueue.add(new Data(awContents, message, sourceOrigin, isMainFrame, replyPort, ports)); mQueue.add(new Data(message, sourceOrigin, isMainFrame, replyPort, ports));
} }
public Data waitForOnPostMessage() throws Exception { 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