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

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

Issue 2438103002: Add postMessage APIs to the support lib (Closed)
Patch Set: removed unnecessary import Created 4 years, 1 month 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/CustomTabsSession.java
diff --git a/customtabs/src/android/support/customtabs/CustomTabsSession.java b/customtabs/src/android/support/customtabs/CustomTabsSession.java
index 290150db1837a46d9a91c9aae52396cbafaf3cf7..8157733298b700d7a0cb65e82d6884b2159460bb 100644
--- a/customtabs/src/android/support/customtabs/CustomTabsSession.java
+++ b/customtabs/src/android/support/customtabs/CustomTabsSession.java
@@ -24,6 +24,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.NonNull;
+import android.support.customtabs.CustomTabsService.Result;
import android.support.customtabs.CustomTabsSessionToken.DummyCallback;
import android.widget.RemoteViews;
@@ -150,6 +151,23 @@ public final class CustomTabsSession {
}
}
+ public boolean validatePostMessageOrigin() {
+ try {
+ return mService.validatePostMessageOrigin(mCallback);
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ @Result
+ public synchronized int postMessage(String message, Bundle extras) {
+ try {
+ return mService.postMessage(mCallback, message, extras);
+ } catch (RemoteException e) {
+ return CustomTabsService.RESULT_FAILURE_REMOTE_ERROR;
+ }
+ }
+
/* package */ IBinder getBinder() {
return mCallback.asBinder();
}

Powered by Google App Engine
This is Rietveld 408576698