Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1779)

Unified Diff: customtabs/src/android/support/customtabs/CustomTabsCallback.java

Issue 2438103002: Add postMessage APIs to the support lib (Closed)
Patch Set: Overridden callback in CustomTabsSessionToken Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: customtabs/src/android/support/customtabs/CustomTabsCallback.java
diff --git a/customtabs/src/android/support/customtabs/CustomTabsCallback.java b/customtabs/src/android/support/customtabs/CustomTabsCallback.java
index d7fdd3988d23385b3009c85b0532ccb8418ecf4c..9b649d5ae57eed617f5977a05da06dc3998b4656 100644
--- a/customtabs/src/android/support/customtabs/CustomTabsCallback.java
+++ b/customtabs/src/android/support/customtabs/CustomTabsCallback.java
@@ -16,6 +16,7 @@
package android.support.customtabs;
+import android.net.Uri;
import android.os.Bundle;
/**
@@ -62,6 +63,27 @@ public class CustomTabsCallback {
public void onNavigationEvent(int navigationEvent, Bundle extras) {}
/**
+ * Sent when {@link CustomTabsSession} has requested a postMessage channel through
+ * {@link CustomTabsService#validatePostMessageOrigin(CustomTabsSessionToken)} and the channel
+ * is ready for sending and receiving messages on both ends.
+ * @param origin The web origin that has been validated and will be used in all messages coming
+ * from this {@link CustomTabsSession}.
+ * @param extras Reserved for future use.
+ */
+ public void onMessageChannelReady(Uri origin, Bundle extras) {}
+
+ /**
+ * Sent when a tab controlled by this {@link CustomTabsSession} has sent a postMessage message.
+ * This method is syncronized to keep the ordering of messages sent across the binder thread
+ * pool. When received on the client side, it is the client's responsibility to preserve the
+ * ordering further.
+ *
+ * @param message The message sent.
+ * @param extras Reserved for future use.
+ */
+ public synchronized void onPostMessage(String message, Bundle extras) {}
+
+ /**
* Unsupported callbacks that may be provided by the implementation.
*
* <p>

Powered by Google App Engine
This is Rietveld 408576698